summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mbr/stage1.asm36
1 files changed, 33 insertions, 3 deletions
diff --git a/mbr/stage1.asm b/mbr/stage1.asm
index ea51f22..d0299e4 100644
--- a/mbr/stage1.asm
+++ b/mbr/stage1.asm
@@ -17,9 +17,39 @@ _start:
call enable_a20
call disk_load
- jmp 0x0000:0x8000
- hlt
- jmp $
+ ;; Enable protected mode
+ mov eax, cr0
+ or al, 1
+ mov cr0, eax
+
+ lgdt [GDTR]
+ jmp 0x8:0x8000
+
+GDT32:
+.null_desc:
+ dw 0x0000
+ dw 0x0000
+ db 0x00
+ db 0b00000000
+ db 0b00000000
+ db 0x00
+.code_desc:
+ dw 0xFFFF
+ dw 0x0000
+ db 0x00
+ db 0b10011010
+ db 0b11001111
+ db 0x00
+.data_desc:
+ dw 0xFFFF
+ dw 0x0000
+ db 0x00
+ db 0b10010010
+ db 0b11001111
+ db 0x00
+GDTR:
+ dw $ - GDT32 - 1
+ dd GDT32
;;
;; Write a string to the screen