[comp.os.minix] Kernel Startup Question

dpd@tellab5.UUCP (Dan Dietrich) (11/12/87)

I have a question that probably has an obvious answer.  The answer is
just not obvious to me.  I do not understand how the memory manager
is run when the kernel boots up.  Looking at kernel/main() in the book,
line 914 sets the process table PC value from the array task[].
This array (line 5143) has 0 entered for the memory manager, file system and
init().  main() does ready the memory manager and file system (line 915)
but how do they start up when their PCs are 0 ??  I can't seem to find
where the PC values get set.

Dan Dietrich
...!ihnp4!tellab5!dpd
dpd@tellab5.UUCP

NU070156%NDSUVM1.BITNET@cunyvm.cuny.edu (Glen Overby) (11/14/87)

In his article of 12 Nov 87, Dan Dietrich <dpd@tellab5.uucp> writes:
> I do not understand how the memory manager
>is run when the kernel boots up.  Looking at kernel/main() in the book,
>line 914 sets the process table PC value from the array task[].
>This array (line 5143) has 0 entered for the memory manager, file system and
>init().  main() does ready the memory manager and file system (line 915)
>but how do they start up when their PCs are 0 ??  I can't seem to find
>where the PC values get set.

   You found it.  All Minix processes (not device tasks) start at
offset 0 in their code or data segment (code segment for split I&D;
data segment for non split).  Their segment registers will be set to
point at the click- (16-byte) aligned segment.  So, while it's not
immediately obvious, it is correct to set their initial PC to 0.

   Also notice that the initial stack for these three processes gets
set to INIT_SP (0x10).  The specialised startup in head.s
(lib/MINIX/head.s) sets the stack to point inside of an array in the
process' data space.  This is one of Minix's articles of "dirty
laundry".

Glen Overby
Bitnet: nu070156@ndsuvm1
UUCP: uunet!ndsuvax!ncoverby