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?
Confused
Re:Confused
Look up 2's compliment notation in your nearest CompSci textbook.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?
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.
Re:Confused
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?
God, do I feel stupid. ;D
One question: How does this make sense?
I understand now as I forgot 0xBFF00000 is negative.-0xBff00000 has the same representation (Assuming you use 32-bits) as 0x40100000.