stack segment descriptor
Posted: Thu Jan 31, 2008 3:50 pm
hi
suppose i want to write a stack segment descriptor for a stack segment that stretches from 0100000h to 0110000h, would that be correct:
it keeps giving me errors. what goes in the base address? the top or the bottom of the stack? i understand that in order to calculate the value that goes in the limit field, i subtract the size s of the segment from 0ffffffffh, is that right? i have tried all thinkable and unthinkable combinations but i keep getting read/write errors
ok, i tend to read DOUBLE WORD instead of DEFINE WORD whenever i see "dw", so i guess it really has to look like this:
but its not working out! i mean my question, as simple as that: what do i have to change about this descriptor to make it a stack segment from 0100000h - 0110000h ?
suppose i want to write a stack segment descriptor for a stack segment that stretches from 0100000h to 0110000h, would that be correct:
Code: Select all
dw 0ffff0000h ;limit of the segment
dw 0110000h ;base address of segment
db 0 ;still belonging to base address of segment
db 10010010b ;1 for "segment is present"
;00 for "privilege 0"
;1 for "data or code segment"
;0 for "data segment"
;0 for "expand downward"
;1 for writable
;0 (access flag set by cpu on 1st access)
db 01000000b ;0 for byte-granularity
;1 for 32-bit stack pointer
;0 (reserved bit)
;0 (available to system programmers)
;0000b for last bits of segment limit
db 0 ;last byte of base address
ok, i tend to read DOUBLE WORD instead of DEFINE WORD whenever i see "dw", so i guess it really has to look like this:
Code: Select all
dw 0fff0h ;limit of the segment
sbase1: dw 0700h ;base address of segment
sbase2: db 010h ;still belonging to base address of segment
db 10010010b ;1 for "segment is present"
;00 for "privilege 0"
;1 for "data or code segment"
;0 for "data segment"
;0 for "expand downward"
;1 for writable
;0 (access flag set by cpu on 1st access)
db 11001111b ;1 for page-granularity
;1 for 32-bit stack pointer
;0 (reserved bit)
;0 (available to system programmers)
;1111b for last bits of segment limit
db 0 ;last byte of base address