Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ca35ef5)
raw | patch | inline | side by side (parent: ca35ef5)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Thu, 17 Jul 2014 00:56:32 +0000 (08:56 +0800) | ||
| committer | zhaoyanbai <zhaoyanbai@126.com> | |
| Wed, 3 Nov 2021 02:45:38 +0000 (10:45 +0800) |
| kernel/init.c | patch | blob | history | |
| kernel/syscall.S | patch | blob | history |
diff --git a/kernel/init.c b/kernel/init.c
--- a/kernel/init.c
+++ b/kernel/init.c
@@ -23,25 +23,11 @@ char __initdata kernel_init_stack[KRNL_INIT_STACK_SIZE] __attribute__ ((__aligne
int debug_wait_queue_get();
-#if 0
-void ring3()
-{
- int i = 0;
- while(1)
- {
- i++;
-// printk("fuck\n");
- systest();
- }
-}
-#else
void ring3();
-#endif
-static char user_task_stack[PAGE_SIZE] __attribute__ ((__aligned__(PAGE_SIZE)));
+extern void *ring3_stack_top;
void user_task_entry()
{
- printk("user_task_entry\n");
- //while(1);
+ printk("user_task_entry: %08x %08x\n", ring3_stack_top, &ring3_stack_top);
#if 1
asm("cli;");
asm("movl $0x23,%%eax; \
pushl $0x1B; \
leal ring3,%%eax; \
pushl %%eax; \
- iret;"::"b"(user_task_stack+PAGE_SIZE));
+ iret;"::"b"(&ring3_stack_top));
#else
- asm("xorl %eax,%eax; \
- sti; \
- pushfl; \
- movw %cs,%ax; \
- pushl %eax; \
- leal ring3,%eax; \
- pushl %eax; \
- iret;");
#endif
}
diff --git a/kernel/syscall.S b/kernel/syscall.S
--- a/kernel/syscall.S
+++ b/kernel/syscall.S
ret
.global ring3
+.global ring3_stack_top
ring3:
nop;
nop;
- movl $(ring3_stack+100), %esp
+ #movl $(ring3_stack+100), %esp
movl $11, %eax;
jmp ring3
ring3_stack:
- .byte 200
+ .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ring3_stack_top:
+ .long 0x12345678