Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-lcc!unisoft!hoptoad!academ!killer!jfh From: jfh@killer.UUCP (John Haugh) Newsgroups: comp.arch Subject: Re: Interrupt vectors. Message-ID: <971@killer.UUCP> Date: Mon, 8-Jun-87 11:28:04 EDT Article-I.D.: killer.971 Posted: Mon Jun 8 11:28:04 1987 Date-Received: Fri, 12-Jun-87 01:46:41 EDT References: <7408@boring.cwi.nl> <2878@pyramid.UUCP> <19253@ucbvax.BERKELEY.EDU> Organization: The Unix(tm) Connection, Dallas, Texas Lines: 49 Keywords: interrupt handlers Summary: easy to do on mc68000 some one stole my uppercase (maybe? do you see any? :-) ... yes, this is slower, so don't flame me for it, and besides, this code wasn't my idea anyway ... start with a vector table for a 68000. .long start ; start of startup routines .long kstack ; top of kernel stack .long buserr ; bus error address .long adredor ; address error address . . .long interupt_vec ; your interupt vector now, define a little piece of code with the name you want. vectable: .long error ; only reset uses this one .. .long error ; ... and no one uses this bsr.w trap ; call trap, push pc ... bsr.w trap ; call trap, push pc (catching on yet?) . . bsr.w trap ; even your routine goes there now i write my trap routine. it figures out the vector number and does a few other things trap: movem.l #,-(sp) ; save those registers mov.l 16(sp),d0 ; get the stack pc ... sub.l #vectable, d0 ; ... and offset from ... lsr.l #2,d0 ; ... and make it into an index! mov.l usp,-(sp) ; stack user stack poiner for kicks mov.l d0, -(sp) ; stack interupt number jsr _trap ; call c trap routine add.w #8,sp ; pop args movem.l (sp)+,# ; those registers again... add.w #4,sp ; waste some cycles ... rte ; ... and poof - back you go. what is so horrible about this? (no, on second thought, don't answer that.) for a cisc machine, i can't imagine doing any better. - john. .signature: can't read: forgery