[comp.os.minix] wierd problem building boot disk

rwberry@hubcap.UUCP (Robert W Berry) (12/19/88)

Has anybody ever gotten an error from build saying:
    bad magic number in kernel data space

I looked through build.c and found that it checks for a magic number at
some wierd offset in the kernel binary.  I looked through the kernel to
try and find where the magic number is defined.  I know that build has
to patch some values into the kernel binary so it knows where the other
tasks are.  Where is this space reserved?  Is it just some initialized
variable?

What bother's me is that I re-compiled and the error went away.  I
didn't change any of the files.  It just went away.  Wierd.

Anybody have any insight into this?

Another quick question: why do you not have to link /usr/lib/head.s
into the kernel.  I can understand bootblok.s not needing this header,
but why the kernel?  Does it have anything to do with the entry point to
Minix being in assembler (mpx88.s?)

Thanks in advance, and have a nice Christmas out there in NetLand.

Bob

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-=- Bob Berry -=- PC-Guru's Inc. ! INTERNET:rwberry@hubcap.clemson.edu  -=-
-=- Good questions all, Sir.     ! Voice: 803-654-7623 or 803-656-2635  -=-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

ast@cs.vu.nl (Andy Tanenbaum) (12/20/88)

In article <3931@hubcap.UUCP> rwberry@hubcap.UUCP (Robert W Berry) writes:
>Another quick question: why do you not have to link /usr/lib/head.s
>into the kernel.  
It has a lot to do with mpx88 being in assembly code, but more with the
fact that when MM or FS is started up, the kernel pushes a simulated
3 word interrupt sequence onto the stack and then does an RTI.  The head.s
file provides space for that stack.  The kernel isn't started up this way.

Andy Tanenbaum (ast@cs.vu.nl)

allbery@ncoast.UUCP (Brandon S. Allbery) (12/26/88)

As quoted from <3931@hubcap.UUCP> by rwberry@hubcap.UUCP (Robert W Berry):
+---------------
| Another quick question: why do you not have to link /usr/lib/head.s
| into the kernel.  I can understand bootblok.s not needing this header,
| but why the kernel?  Does it have anything to do with the entry point to
| Minix being in assembler (mpx88.s?)
+---------------

No, it has to do with the entry point to Minix not being entered *from*
Minix.  head.s under Minix, and crt0.s under Unix, construct C arrays from
the argument and environment strings placed in the stack by exec, store a
pointer to the environment array in the variable "environ", invoke the
user's "main" with the argument and environment arrays as arguments, and
perform an exit system call to return to the kernel.  Since Minix is invoked
as a standalone program, there are neither arguments nor environment to be
munged and the only way to exit is to reboot or cycle power; thus, head.s is
not needed.

++Brandon
-- 
Brandon S. Allbery, comp.sources.misc moderator and one admin of ncoast PA UN*X
uunet!hal.cwru.edu!ncoast!allbery		    ncoast!allbery@hal.cwru.edu
comp.sources.misc is moving off ncoast -- please do NOT send submissions direct
      Send comp.sources.misc submissions to comp-sources-misc@<backbone>.