rick@wam.UMD.EDU (06/30/89)
I've been reading the Mac edition of Xinu and I have a problem maybe someone could answer for me. Where in the source do the lowcore vectors get saved and replaced by the panic calls? I looked high and low through the init code but can't find anything. I know that all the source is not included in the book. Is the vector initialization left out too? I haven't got the source code from the publisher cuz I'm just interested in reading about the OS and how it is put together. Am I overlooking something obvious? Send replys via email. Thanx... rick@wam.umd.edu
sbm@CS.PURDUE.EDU (07/01/89)
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 <kernel.h> #include <macvars.h> 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 ----------