Page 2 of 2

Re: Paging - strange(?) problem

Posted: Tue Jul 22, 2014 10:59 pm
by Combuster
PML4: 0x0000000106000003
// 0x106000 is pml4e->PhysAddr
Can you spot the difference between 106000000 and 106000?

Re: Paging - strange(?) problem

Posted: Wed Jul 23, 2014 4:04 pm
by begin
But
0x0000000106000003
is the whole struct isn´t it?
So PhysAddr = 0x106000, Present-bit = 1, RW-bit = 1, everything else = 0... ?

Re: Paging - strange(?) problem

Posted: Wed Jul 23, 2014 7:31 pm
by Marionumber1
An entry in the 64-bit paging structures has the lower 12-bits represent the page flags, and the upper 52-bits represent the physical page number.

Re: Paging - strange(?) problem

Posted: Thu Jul 24, 2014 12:21 am
by iansjack
begin wrote:But
0x0000000106000003
is the whole struct isn´t it?
So PhysAddr = 0x106000, Present-bit = 1, RW-bit = 1, everything else = 0... ?
It's not a struct; it's the physical address with the proviso that the last 12 bits of that address are always 0. Because of this they can be used as flags piggy-backed onto the address. So to get the address you take the number in the control register or page table entry and mask the last 12 bits to 0 .

Get that wrong and your page table is going to be invalid.

Re: Paging - strange(?) problem

Posted: Fri Jul 25, 2014 9:00 am
by begin
Holy **** it works now...
I think I should avoid bit fields from now... this was the real problem. I threw my struct away and used a uint64_t instead. And yes, I know bit fields should be avoided and I dont know why I used them.... :oops: :D

Thank you guys =D>