Page 1 of 1
Who can help me?
Posted: Wed Mar 24, 2004 12:00 am
by SeeSaw
How do you read or write a memory location without using the segment selecotrs and offsets while in protected mode? For example, how do you right into the GDT? It is not a segment. Please explain it both with assembler and C.
Thanx a lot for your kind help!
RE:Who can help me?
Posted: Wed Mar 24, 2004 12:00 am
by hartyl
to prevent this question from being unanswered:
i don't understand?
i assume: do you mean, how to write "directly" into the memory? to make somehow ignore the segments? and that way you want to write to the GDT?
in that case you have to make a GDT-entry:
base: 0x00000000
limit: 4GB (pg: 4kbyte)
ring0
when you use this selector, you can access all the memory.
mov ax, <4GB-selector>
mov es,ax
mov eax,0xdeadbeef
mov [es:0x00000000],eax ;write into the very first byte of the memory
in C it's actually not possible. you'll have to do it inline-assembler. as i don't really got the AT&T-syntax, i can't explain you.
greets, hartyl