Regarding enable paging code and swapper_pg_dir.

James Light jlight at srcit.stevens.edu
Sat Apr 2 12:31:54 EDT 2011


If you look at the 2.6.38 code for head.S, you may find the newer way it is
written to be a bit easier to read.

------------------------------------------------------------------------------
25 /* Physical address */
26 #define pa(X) ((X) - __PAGE_OFFSET)

...

345 /*
346 * Enable paging
347 */
348        movl $pa(initial_page_table), %eax
349        movl %eax,%cr3          /* set the page table pointer.. */
350        movl %cr0,%eax
351        orl  $X86_CR0_PG,%eax
352        movl %eax,%cr0          /* ..and set paging (PG) bit */
353        ljmp $__BOOT_CS,$1f     /* Clear prefetch and normalize %eip */

------------------------------------------------------------------------------

     -James



More information about the Kernelnewbies mailing list