lkml.org 
[lkml]   [2006]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectfailed 'ljmp' in linear addressing mode

I am plowing along as I am learning about the in'n'outs about i386. I am
totally stuck on this one. I would appreciate any help.

As you can see, the function turns off paging mode (of course it
runs from identically mapped page) and tries to jump to an absolute
address at 0x10000000. It appears the machine would reboot when running
"ljmp" instruction.

Any pointers?

I was not too certain about the %cs, %ds business and did quite
a few experiments with different values but with no luck.

Thanks in advance.

Jun

--------------------------

/* [JSUN] we will map this page into identity mapping before execution */
.align 4096
ENTRY(do_os_switching)
/* interrupt is disabled! */

/* the black magic, some copied form relocate_new_kernel, JSUN */
/* Set cr0 to a known state:
* 31 0 == Paging disabled
* 18 0 == Alignment check disabled
* 16 0 == Write protect disabled
* 3 0 == No task switch
* 2 0 == Don't do FP software emulation.
* 0 1 == Proctected mode enabled
*/

movl %cr0, %eax
andl $~((1<<31)|(1<<18)|(1<<16)|(1<<3)|(1<<2)), %eax
orl $(1<<0), %eax
movl %eax, %cr0


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

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

/* why this? */
jmp 1f
1:

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

/*
movl $(__KERNEL_DS),%eax
movl %eax,%ds
movl %eax,%es
movl %eax,%fs
movl %eax,%gs
movl %eax,%ss
*/

ljmp $(__KERNEL_CS), $0x10000000

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-23 00:43    [W:0.127 / U:5.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site