From 3a9ccbd8e762477f75d8b164a1d99383a01414ae Mon Sep 17 00:00:00 2001 From: Aleksa Vučković Date: Sat, 9 Oct 2021 02:34:21 +0200 Subject: Adding gdt --- src/boot.s | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/boot.s') diff --git a/src/boot.s b/src/boot.s index 385ee70..a0f0c2e 100644 --- a/src/boot.s +++ b/src/boot.s @@ -9,7 +9,15 @@ .long MAGIC .long FLAGS .long CHECKSUM - + +.global _start +.global load_gdt + +load_gdt: + movl 4(%esp), %edx + lgdt (%edx) + ret + .section .bss .align 16 stack_bottom: @@ -17,15 +25,19 @@ stack_bottom: stack_top: .section .text -.global _start .type _start, @function _start: + call init_gdt_table + mov 0x10, %ax + mov %ds, %ax + mov %es, %ax + mov %fs, %ax + mov %gs, %ax + mov %ss, %ax mov $stack_top, %esp - + cli call _init call kernel_main - - cli 1: hlt jmp 1b -- cgit v1.2.3