GDT misconfigured
Posted: Tue Aug 30, 2016 9:51 am
Hi !
I got a problem setting a 'test' GDT.
I want a short code segment starting from 0x1000 to 0x2000 but i can't figure out how to set up this code segment.
I know that the problem comes from my code segment cause if i set my code segment to start from 0x0 and end like my data segment, it works. So the problem is my code segment ...
Thanks in advance !
Here's my GDT :
I got a problem setting a 'test' GDT.
I want a short code segment starting from 0x1000 to 0x2000 but i can't figure out how to set up this code segment.
I know that the problem comes from my code segment cause if i set my code segment to start from 0x0 and end like my data segment, it works. So the problem is my code segment ...
Thanks in advance !
Here's my GDT :
Code: Select all
GDT_NULL:
dd 0
dd 0
; The problem is here ...
; CS 0x1000 to 0x2000
; 0x1000 = 1000 0000 00000 (bin)
GDT_CS:
dw 0001 0000 0000 0000b ; Limit (low 2 bytes)
db 0000 0000b ; Base (low 3 bytes)
db 0001 0000b ; Base again
db 0000 0000b ; Base again
db 1001 1000b ; Access
db 0000 0100b ; Limit (high 4 bits) & Flags
db 0000 0000b ; Base (high byte)
GDT_DS:
dw 1111111111111111b
db 00000000b
db 00000000b
db 00000000b
db 10010010b ; Access
db 11110100b ; Limit & Flags
db 00000000b
END_GDT:
GDT_PTR:
dw END_GDT - GDT_NULL - 1
dd GDT_NULL