summaryrefslogtreecommitdiff
path: root/arch/i386/boot/boot.s
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.xyz>2021-07-24 02:27:40 -0500
committerDanny Holman <dholman@gymli.xyz>2021-07-24 02:27:40 -0500
commit7498b41d94b2f34468833b55ad0472d75b63064e (patch)
treea16b9c728edd4116b401f7fd337cb36b8d33fd78 /arch/i386/boot/boot.s
parentd4003f1d6daf6883acb83a398e3fdba5336aefef (diff)
arch: i386: add GDT setup routines
Add a set of routines that setup the x86's global descriptor table. Signed-off-by: Danny Holman <dholman@gymli.xyz>
Diffstat (limited to 'arch/i386/boot/boot.s')
-rw-r--r--arch/i386/boot/boot.s18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/i386/boot/boot.s b/arch/i386/boot/boot.s
index 792a790..842519f 100644
--- a/arch/i386/boot/boot.s
+++ b/arch/i386/boot/boot.s
@@ -68,8 +68,26 @@ _start:
movl $stack_top, %esp
+ call tty_init
+ call gdt_install
call kernel_main
cli
1: hlt
jmp 1b
+
+.global flush_gdt
+.type flush_gdt, @function
+
+flush_gdt:
+ cli
+ movl 4(%esp), %eax
+ lgdt (%eax)
+ movw $0x10, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %fs
+ movw %ax, %gs
+ movw %ax, %ss
+ jmp $0x08, $.flush
+.flush: ret