Who can help me?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
SeeSaw

Who can help me?

Post 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!
hartyl

RE:Who can help me?

Post 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
Post Reply