summaryrefslogtreecommitdiff
path: root/arch/i386/kernel
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-02-24 06:41:48 -0600
committerDanny Holman <dholman@gymli.org>2024-02-24 06:41:48 -0600
commit5d06824289868c5a345fbcfa8ed4d1e63af84fdb (patch)
tree05cf903c665554142ee7b49d2b7f16480ec85adb /arch/i386/kernel
parentae9eeff0ce79def2c51e361acbdecdee7fc4ecb1 (diff)
arch: i386: move jump_userspace to its own file
Move the function that jumps to ring 3 to its own assembly file. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r--arch/i386/kernel/jump_userspace.s29
1 files changed, 29 insertions, 0 deletions
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