/* GDT */
/* This Data structure is needed for memory
.align 16
gdtp:
.word gdt_end - gdt_start - 1
/* .long (0x07C0 << 4) + gdt */
.long gdt_start
gdt_start:
.quad 0x0000000000000000 # Null Descriptor
gdt_code_segment:
# Segment limit Base address
.word 0xffff, 0x0000
.byte 0x00 # Base
# 1st flags: (present) 1 (privilege) 0 0 (descriptor type)1 -> 1001b
# Type flags: (code) 1 (conforming) 0 (readable) 1 (accessed) 0 -> 1010b
# 10011010
.byte 0x9a
# 2nd flags: (granularity) 1 (32-bit default) 1 (64-bit segment) 0 (available) 0 -> 1100b
.byte 0xcf
.byte 0x00 # Base
gdt_data_segment:
# Segment limit Base address
.word 0xffff, 0x0000
.byte 0x00 # Base
# 1st flags: (present) 1 (privilege) 0 0 (descriptor type)1 -> 1001b
# Type flags: (code) 0 (conforming) 0 (readable) 1 (accessed) 0 -> 1010b
# 10010010
.byte 0x92
# 2nd flags: (granularity) 1 (32-bit default) 1 (64-bit segment) 0 (available) 0 -> 1100b
.byte 0xcf
.byte 0x00 # Base
gdt_end:
# Where docs for 64-bit GDT? IDK, just copy it
# 64-bit GDT
.align 16
gdt64:
.quad 0 # Null
.quad 0x00209a0000000000 # Code: L-bit set, D-bit clear
.quad 0x0000920000000000 # Data
gdt64_ptr:
.word . - gdt64 - 1
.quad gdt64 # 64-bit base
/* IDT */
idt:
.word 0
.long 0
# Some messages
running_kernel: .asciz "Trying to run Kernel"
disk_err_msg: .asciz "Can't load kernel from disk"
KERNEL_OFFSET: .long 0x2000
BOOT_DRIVE: .byte 0
# This is the end we saw at part 1
.fill 510-(.-_start), 1, 0
.word 0xAA55
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)