Below is my GDT.
I wish I could say I wrote it, and fully understand it, but I dont.
I thought I understood it, but alas my modifications either had no visible impact, or crashed Bochs.
I've tried writing to 0xA0000, such as : memset(0xA0000, 0, 65535) but there is no change, either as soon as the mode is set, or when I blindly type 'cls' at the command terminal app.
Heres the gdt:
Code: Select all
gdt_tss:
.word 103
.word 0
.byte 0
.byte 0x89 /* present, ring 0, available 32-bit TSS */
.byte 0
.byte 0
/* ring 0 kernel code segment descriptor */
.equ KERNEL_CS,(.-gdt)
gdt_kcode:
.word 0xFFFF
.word 0
.byte 0
.byte 0x9A /* present, ring 0, code, non-conforming, readable */
.byte 0xCF
.byte 0
/* ring 0 kernel data segment descriptor */
.equ KERNEL_DS,(.-gdt)
gdt_kdata:
.word 0xFFFF
.word 0
.byte 0
.byte 0x92 /* present, ring 0, data, expand-up, writable */
.byte 0xCF
.byte 0
/* ring 3 user code segment descriptor */
.equ USER_CS,((.-gdt)|3)
gdt_ucode:
.word 0xFFFF
.word 0
.byte 0
.byte 0xFA /* present, ring 3, code, non-conforming, readable */
.byte 0xCF
.byte 0
/* ring 3 user data segment descriptor */
.equ USER_DS,((.-gdt)|3)
gdt_udata:
.word 0xFFFF
.word 0
.byte 0
.byte 0xF2 /* present, ring 3, data, expand-up, writable */
.byte 0xCF
.byte 0
gdt_end:
gdt_ptr:
.word gdt_end - gdt - 1 /* GDT limit */
.long gdt /* linear adr of GDT (set above) */
Also, I'm trying to write to the address from kernel space and kernel modules (which run on the kernel level.)