Re: [i386] Questions regarding provisional page tables initialization

Andi Kleen
2007-07-02T09:47:49Z

"Ahmed S. Darwish" <darwish.07@gmail.com> writes:
>
> There're some stuff that confused me for a full day about the code (head.S)
> that accomplishes the above words:
>
> movl $(pg0 - __PAGE_OFFSET), %edi
> movl $(swapper_pg_dir - __PAGE_OFFSET), %edx
> movl $0x007, %eax /* 0x007 = PRESENT+RW+USER */
> 10:
> leal $0x007(%edi),%ecx /* Create PDE entry */
>
> What does the address of 7 bytes displacement after %edi - the physical address
> of pg0 - represent ?.

The trick is not to know everything, but to know where to look ...

Page table entries use the first 12 bits for various flags. Take a look
at the Intel or AMD x86 documentation from their websites.

-Andi