Confused

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
beyondsociety

Confused

Post by beyondsociety »

Im trying to use Tims gdt mapping trick and I can't figure out how he got this base address answer. I've been trying to figure it out for the last 30 minutes and my brain is fried. I even reviewed subtracting binary numbers but no help. Can somebody explain how this makes sense, cause I'm lost.

address + base = linear.
0xC0000000 + Base = 0x100000
Base = 0x100000 - 0xC0000000
Base = -0xBFF00000 (the same as 0x40100000)

(the same as 0x40100000) = What in decimal?
Curufir

Re:Confused

Post by Curufir »

beyondsociety wrote: Im trying to use Tims gdt mapping trick and I can't figure out how he got this base address answer. I've been trying to figure it out for the last 30 minutes and my brain is fried. I even reviewed subtracting binary numbers but no help. Can somebody explain how this makes sense, cause I'm lost.

address + base = linear.
0xC0000000 + Base = 0x100000
Base = 0x100000 - 0xC0000000
Base = -0xBFF00000 (the same as 0x40100000)

(the same as 0x40100000) = What in decimal?
Look up 2's compliment notation in your nearest CompSci textbook.

I'll explain briefly. To form the negative of a number in 2's compliment you invert all the bits and add 1 to the result. The reason this form is used is that you can add two numbers together in this form and come out with the correct result. It's a mechanism which eases the pain of doing binary addition/subtraction.

-0xBff00000 has the same representation (Assuming you use 32-bits) as 0x40100000.

Hope that eases your mind ;D.
beyondsociety

Re:Confused

Post by beyondsociety »

After two hours of trying to figure this out last night, I decided to give it a rest. Lucky enough, I figured it out this morning. It must of been the caffeine I drank.

God, do I feel stupid. ;D

One question: How does this make sense?
-0xBff00000 has the same representation (Assuming you use 32-bits) as 0x40100000.
I understand now as I forgot 0xBFF00000 is negative.
Post Reply