diff --git a/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s b/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s index 25e4cebe0f..8481cb9f87 100644 --- a/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s +++ b/repos/base-hw/src/core/spec/x86_64/kernel/crt0.s @@ -117,3 +117,35 @@ .quad 0 .quad 0x20018f .fill 510, 8, 0x0 + + /******************************************* + ** Global Descriptor Table ** + ** See Intel SDM Vol. 3A, section 3.5.1. ** + *******************************************/ + + .align 4 + .space 2 + + _gdt_ptr: + .word _gdt_end - _gdt_start - 1 /* limit */ + .long _gdt_start /* base address */ + + .align 8 + _gdt_start: + /* Null descriptor */ + .quad 0 + /* 64-bit code segment descriptor */ + .long 0 + /* GDTE_LONG | GDTE_PRESENT | GDTE_CODE | GDTE_NON_SYSTEM */ + .long 0x209800 + /* 64-bit data segment descriptor */ + .long 0 + /* GDTE_LONG | GDTE_PRESENT | GDTE_TYPE_DATA_A | GDTE_TYPE_DATA_W | GDTE_NON_SYSTEM */ + .long 0x209300 + /* Task segment descriptor */ + .long 0 + /* GDTE_PRESENT | GDTE_SYS_TSS */ + .long 0x8900 + .long 0 + .long 0 + _gdt_end: