GDT Questions...
GDT Questions...
I'll just post some GDT questions here as they come up:
Can I make a CodeSel that can be read/write/exec?
Can I make a Stack Sel? If yes...how?
Can I make a CodeSel that can be read/write/exec?
Can I make a Stack Sel? If yes...how?
Re:GDT Questions...
Ok..I can make a stack sel...bit 010/011...
Could someone show me a example of a stack sel that is read/write? ( bit 011 )?
Also...
Can I make a CodeSel that can be read/write/exec?
Could someone show me a example of a stack sel that is read/write? ( bit 011 )?
Also...
Can I make a CodeSel that can be read/write/exec?
Re:GDT Questions...
Also...if I made a stack selector...how would I push values into there?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:GDT Questions...
a code selector can *never* be written. If you need to write to a code chunk, use a data segment that maps the same memory region (though is discourage such ancient technique
a stack segment is simply a data segment, though the "EXPAND DOWN" bit may sometimes be useful for stacks only: it will define the valid addresses ranging from limit to 0xffffffff instead of the usual [0..limit-1], which means you can easily protect from stack overflow
a stack segment is simply a data segment, though the "EXPAND DOWN" bit may sometimes be useful for stacks only: it will define the valid addresses ranging from limit to 0xffffffff instead of the usual [0..limit-1], which means you can easily protect from stack overflow
Re:GDT Questions...
hi,
i no dis is a lil off topic, but can neone give me links to some good online GDT, tutorials or docs that explain the GDT thoroughly and easily.
links would be most appreciated.
thnx
i no dis is a lil off topic, but can neone give me links to some good online GDT, tutorials or docs that explain the GDT thoroughly and easily.
links would be most appreciated.
thnx
Re:GDT Questions...
My GDT:
gdtr
dw gdt_end
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
gdt_end
And some Links:
http://osdev.neopages.net/tutorials/descripters.php
http://www.csee.umbc.edu/~plusquel/310/slides/micro_arch2.pdf
gdtr
dw gdt_end
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
gdt_end
And some Links:
http://osdev.neopages.net/tutorials/descripters.php
http://www.csee.umbc.edu/~plusquel/310/slides/micro_arch2.pdf
Re:GDT Questions...
Code: Select all
dw gdt_end
Ok, let's make it simpler by describing a scenario. Let's say you load your gdt to a base above 64k linear. Now the maximum value you can stick into that word is 0xFFFF. Do you see why it cannot possibly be the memory location of the end of the gdt?
In your GDT the correct value is:
Code: Select all
gdt_end - gdt - 1
I dunno who came up with the idea that this part of the GDTR is a memory reference but they need shooting, or pointing at the intel manuals .
Re:GDT Questions...
Do I remove the gdt_end or how do I edit it to make it correct? code please?