the part that i dont understand about the macro is well first off its a macro. havn't bothered to understand how they work.
![Shocked :shock:](./images/smilies/icon_eek.gif)
A macro is a piece of code where you can fill in the parameters at compile (assemble) time.
if you'd take the macro from above
Code: Select all
macro gdt_entry base,limit,flags {
dw limit and 0xFFFF
dw base and 0xFFFF
db (base shr 16) and 0xFF
db flags
db ((limit shr 16) and 0xF) or 0xC0
db (base shr 24) and 0xFF
}
gdt_entry 0x00000000, 0xFFFFF, 10010010b
Code: Select all
dw 0xFFFFF and 0xFFFF
dw 0x00000000 and 0xFFFF
db (0x00000000 shr 16) and 0xFF
db 10010010b
db ((0xFFFFF shr 16) and 0xF) or 0xC0
db (0x00000000 shr 24) and 0xFF
The G bit determines how the limit field should be interpreted. if its set, the limit is multiplied by 4096, if its clear, its multiplied with 1.another question i have is the granularity (g).
if im not mistaken the g is 1 bit and is either on or off. if g is set is the max mem 4gigs and if its not is the max 1 gig. or did just just not understand what they were saying at all.
a limit of 0xfffff with the G bit set results in a limit of 0xffffffff. if the g bit is clear, the actual limit used will be 0x000fffff. (=1MB)