Added the Global Descriptor Table.

This commit is contained in:
2020-06-19 12:08:17 -05:00
parent b409b3e9d2
commit 84f64badaf
6 changed files with 102 additions and 5 deletions
+20 -1
View File
@@ -16,6 +16,25 @@ global inb
; stack: [esp + 4] The address of the I/O port
; [esp ] The return address
inb:
mov dx, [esp + 4] ; Move the address of the I/O port to the dx register.
mov dx, [esp + 4] ; Move the address of the I/O port to the dx register
in al, dx ; Read a byte from the I/O port and store it in the al register
ret
global load_gdt
; load_gdt - Installs a new GDT
; stack: [esp + 4] The address of the GDT
; [esp ] The return addess
load_gdt:
mov eax, [esp + 4]
lgdt [eax]
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
jmp 0x08:return ; Perform a "far jump" to load 0x08 in the CS register
return:
ret ; Now we've changed CS to 0x08