A poorly written OS for the x86 arch. (WIP)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
eOS/bootloader/pm/gdt.asm

44 lines
1.1 KiB

3 years ago
; GDT
gdt_start:
gdt_null: ; NULL descriptor
dd 0x0 ; 4-bytes of
dd 0x0 ; 0x0 (0) = NULL
gdt_code: ; Code SD
; Range: 0x0 - 0xfffff
; Flags1: 1001b (present:2 privilege:descriptor type)
; Type: 1010b (code:conforming:readable:accessed)
; Flags2: 1100b (granularity:32bit default:64bit seg:AVL)
3 years ago
dw 0xffff ; Limit (bits 0-15)
dw 0x0 ; Base (bits 0-15)
db 0x0 ; Base (bits 16-23)
3 years ago
db 10011010b ; Flags1 : Type
db 11001111b ; Flags2 : Limit (16-19)
3 years ago
db 0x0 ; Base (bits 24-31)
3 years ago
3 years ago
gdt_data: ; Data SD
3 years ago
; Same flags as gdt_code but different type flags
; Type: 0010b (code:expand dowm:writable:accessed)
3 years ago
dw 0xffff ; Limit (bits 0-15)
dw 0x0 ; Base (bits 0-15)
db 0x0 ; Base (bits 16-23)
3 years ago
db 10010010b ; Flags1 : Type
db 11001111b ; Flags2 : Limit (16-19)
3 years ago
db 0x0 ; Base (bits 24-31)
3 years ago
gdt_end: ; Mark the end so we can get the delta-memory (size of GDT)
; GDT descriptor
gdt_descriptor:
3 years ago
dw gdt_end - gdt_start - 1 ; GDT size
dd gdt_start ; GDT pointer
3 years ago
; Lazy constants
GDT_CODE_SEG equ gdt_code - gdt_start
GDT_DATA_SEG equ gdt_data - gdt_start