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