Re: failed 'ljmp' in linear addressing mode

From: Jun Sun
Date: Wed Nov 29 2006 - 23:54:04 EST

On Tue, Nov 28, 2006 at 05:40:56PM -0800, Jun Sun wrote:
> Can you elaborate more why this last ljmp will fail? I thought at this point
> the paging is turned off, and 0x1000-0000 would simply mean a physical
> address - which is a valid physical address in RAM, btw.

I finally got it working, even though I don't understand at all. :)

I realized that after paging mode is turned off, 0x1000-0000 is actually
at the same flag 4G code segment as caller code. So I tried to just
"call" and that worked.

Here is the excerpt of the related code in case someone else needs to
do the same:

In arch/i386/kernel/machine_kexec.c:

extern void do_os_switching(void);
void os_switch(void)
void (*foo)(void);

/* absolutely no irq */

/* create identity mapping */
identity_map_page((unsigned long)foo);

/* jump to the real address */

In arch/i386/kernel/acpi/wakeup.S:

.align 4096
/* JSUN, 0x11 was the boot up value for cr0. */
movl $0x11, %eax
movl %eax, %cr0

/* clear cr4 */
movl $0, %eax
movl %eax, %cr4

/* clear cr3, flush TLB */
movl $0, %eax
movl %eax, %cr3

movl $0x10000000,%eax
call *%eax

I have a second Linux kernel loaded at 0x1000-0000. Now the only matter
remaining is to figure out why the tsc timer stopped working ... :)


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at