From 7498b41d94b2f34468833b55ad0472d75b63064e Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Sat, 24 Jul 2021 02:27:40 -0500 Subject: arch: i386: add GDT setup routines Add a set of routines that setup the x86's global descriptor table. Signed-off-by: Danny Holman --- arch/i386/boot/boot.s | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'arch/i386/boot/boot.s') 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 -- cgit v1.2.3