I'm trying to switch to a process with the following code :
===================================================================
printk ("Switching to process %s with cr3 at 0x%x\n",
current_process->name,
current_process->cr3) ;
// Set the page repertory address
set_cr3 (current_process->cr3) ;
printk ("CR3 is set to: 0x%x\n",
get_cr3 ()) ;
// eoi () ;
// Jump to the code
asm ("ljmp $0x08, $0x300000") ;
===================================================================
At this point, cr3 is correctly set to 0x10d000, the cr3 for the process. But when I'm trying to jump, with the jump instrunction to 0x300000 a page exception occurs:
===================================================================
Kernel panic: Page fault asking 0x300000 (cr2) with cr3: 0x106984.
===================================================================
I don't know why the cr3 was changed, 0x106984 is some point in my kernel stack.