Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!CS.PURDUE.EDU!sbm From: sbm@CS.PURDUE.EDU Newsgroups: comp.os.xinu Subject: Re: Mac-Xinu question Message-ID: <8906301910.AA00893@merlin.cs.purdue.edu> Date: 30 Jun 89 19:10:11 GMT References: <8906291924.AA04550@cscwam.UMD.EDU> Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 58 wam.UMD.EDU!rick@decwrl.dec.com asked the question: > Where in the source do the lowcore vectors get saved > and replaced by the panic calls? The exception and interrupt vectors are initialized by a function called vecinit. It is not listed in the book, but it is called by macinit on p. 248. Vecinit simply swaps the values in the array lowcore with those starting at memory location 0. The array lowcore is in lowcore.s, p. 438. Vecinit does not touch the locations in low memory that correspond to entries in lowcore that contain 0. Notice that Xinu has to be careful to call vecinit only once, not calling it on subsequent reboots after it has already been called. Here is the source code for vecinit: /* vecinit.c - vecinit */ #include #include extern int *lowcore[], *endvec; /* New interrupt vectors */ /*------------------------------------------------------------------------ * vecinit -- initialize exception, interrupt and trap vectors *------------------------------------------------------------------------ */ vecinit() { register int v, *swap; for (v = 0; v < &endvec-lowcore; ++v) if (lowcore[v] != 0) { swap = intvec[v]; intvec[v] = lowcore[v]; lowcore[v] = swap; } setdebug(intvec[DEBUG]); } /*------------------------------------------------------------------------ * setdebug -- set interrupt switch interrupt vector to specified value *------------------------------------------------------------------------ */ setdebug(newvec) int *newvec; { register int v; if (_newrom() == 2) /* Mac II: set level 7 vector */ intvec[DEBUG] = newvec; else /* Otherwise: set levels 4-7 */ for (v = INT4; v <= DEBUG; ++v) intvec[v] = newvec; } Steve Munson sbm@Purdue.EDU sbm@Purdue.CSNET ----------