Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

i386 start routine


I am playing with multiboot 2 support for our kernel, and I get a crash
involving stuff beyond my x86 knowledge.

The thing happens in the start routine (from
src/sys/arch/i386/i386/locore.S) at the time the kernel has been copied
to high memory and we try to jump there:

         * 3. Enable paging and the rest of it.
        movl    %cr0,%eax
        orl     $(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_MP|CR0_WP|CR0_AM),%eax
        movl    %eax,%cr0
        pushl   $begin                  /* jump to high mem */


The CR0 change cause the memory pointed by the stack pointer to be
unmapped. As a result, the pushl $begin does not push begin adddress on
the stack, and ret launches us in the twilight zone.

Why enabling protected mode and paging makes a mapping disapear?

Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index