From: AceVest Date: Thu, 17 Jul 2014 01:03:54 +0000 (+0800) Subject: use sysexit to jump to ring3 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=b7184c779901227722bc39fb1f327d969445fada;p=kernel.git use sysexit to jump to ring3 --- diff --git a/kernel/init.c b/kernel/init.c index 9cddcc2..991331a 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -23,27 +23,12 @@ char __initdata kernel_init_stack[KRNL_INIT_STACK_SIZE] __attribute__ ((__aligne int debug_wait_queue_get(); -void ring3(); +extern void *ring3; extern void *ring3_stack_top; void user_task_entry() { printk("user_task_entry: %08x %08x\n", ring3_stack_top, &ring3_stack_top); -#if 1 - asm("cli;"); - asm("movl $0x23,%%eax; \ - movw %%ax,%%ds; \ - movw %%ax,%%es; \ - movw %%ax,%%fs; \ - movw %%ax,%%gs; \ - pushl $0x23; \ - pushl %%ebx; \ - pushl $0x202; \ - pushl $0x1B; \ - leal ring3,%%eax; \ - pushl %%eax; \ - iret;"::"b"(&ring3_stack_top)); -#else -#endif + asm("sti;sysexit;"::"d"(&ring3), "c"(&ring3_stack_top)); } void init_task_entry()