GDT bit

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
jrfritz

GDT bit

Post by jrfritz »

Could someone show me how to change this GDT to have the granularity bit set so I can have a 0xFFFFFFFF stack?

Thankyou ( I do have the a20 enabled in RM...is the PM a20 code ok for RM?)

GDTR
dw GDTEnd-1
dd GDT
GDT
nullsel equ $-GDT
GDT0
dd 0
dd 0
CodeSel equ $-GDT
dw 0ffffh
dw 0
db 0
db 09ah
db 0cfh
db 0h
DataSel equ $-GDT
dw 0ffffh
dw 0h
db 0h
db 092h
db 0cfh
db 0
GDTEnd
pskyboy

Re:GDT bit

Post by pskyboy »

I think you'll find its in the 4th byte the one that you have 9ah in. You then just use calculator in windows and convert it to binary set the granularity bit convert back to hex and then put that in palce of 9ah.

Peter
jrfritz

Re:GDT bit

Post by jrfritz »

I didn't understand that...maybe you could do that for me?
pskyboy

Re:GDT bit

Post by pskyboy »

Okay its bit 55, 23 of the second DWORD so it will be in the 5th declaration so the one with 0cfh. You then convert this to binary which is:-

11001111

check bit 23 is set whihc is the last bit of this byte. It looks like granunaltiy is already enabled as the lasy bit in this byte is 1. If you want to turn it off you would put the value 4Fh in place of 0CF which is 01001111 in binary.

hope this helps

Peter
Post Reply