summaryrefslogtreecommitdiff
path: root/arch/i386
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386')
-rw-r--r--arch/i386/boot/boot.s19
-rw-r--r--arch/i386/kernel/jump_userspace.s29
2 files changed, 30 insertions, 18 deletions
diff --git a/arch/i386/boot/boot.s b/arch/i386/boot/boot.s
index 005b07b..4b9106d 100644
--- a/arch/i386/boot/boot.s
+++ b/arch/i386/boot/boot.s
@@ -82,7 +82,7 @@ load_page_dir:
pushl %ebp
movl %esp, %ebp
- movl 8(%ebp), %eax
+ movl 8(%esp), %eax
movl %eax, %cr3
movl %ebp, %esp
@@ -111,20 +111,3 @@ flush_gdt:
jmp $0x08, $.flush
.flush:
ret
-
-.global jump_userspace
-.type jump_userspace, @function
-jump_userspace:
- movw $0x23, %ax
- movw %ax, %ds
- movw %ax, %es
- movw %ax, %fs
- movw %ax, %gs
-
- pushl $0x23
- pushl %esp
- pushf
- orl $0x200, (%esp)
- pushl $0x1B
- pushl test_user_function
- iret
diff --git a/arch/i386/kernel/jump_userspace.s b/arch/i386/kernel/jump_userspace.s
new file mode 100644
index 0000000..fe69880
--- /dev/null
+++ b/arch/i386/kernel/jump_userspace.s
@@ -0,0 +1,29 @@
+.global jump_userspace
+.type jump_userspace, @function
+jump_userspace:
+ movw $0x23, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %fs
+ movw %ax, %gs
+
+ movl %esp, %eax
+ pushl $0x23
+ pushl %eax
+ pushf
+ push $0x1B
+ pushl $start_init
+
+ pushl %esp
+ call set_kernel_esp
+ addl $4, %esp
+
+ movl $0x0004, %eax
+ orl $0x0002, %eax
+ pushl %eax
+ call init_page_dir
+ addl $4, %esp
+
+ movl %eax, %cr3
+
+ iret