Re: Why do we need to load CR3 again in pagetable_init function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



But, that happens in setup_arch(). Do we have any chance to change the
CR3 at that moment?

Thanks,
Neo

On Nov 14, 2007 6:00 PM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
>
> On Nov 9, 2007 2:56 PM, Neo Jia <neojia@xxxxxxxxx> wrote:
> > hi,
> >
> > I think the swapper_pg_dir is already loaded in head.S. Why we need to
> > load it again? Just a simple 2-level page table.
> >
> > Thanks,
> > Neo
> >
> > --
> > I would remember that if researchers were not ambitious
> > probably today we haven't the technology we are using!
> >
>
> Yes, swapper_pg_dir is already defined in head.S, and then loaded into cr3:
>
> /*
>  * Enable paging
>  */
>         movl $swapper_pg_dir-__PAGE_OFFSET,%eax
>         movl %eax,%cr3          /* set the page table pointer.. */
>         movl %cr0,%eax
>         orl $0x80000000,%eax
>         movl %eax,%cr0          /* ..and set paging (PG) bit */
>         ljmp $__BOOT_CS,$1f     /* Clear prefetch and normalize %eip */
> 1:
>         /* Set up the stack pointer */
>         lss stack_start,%esp
>
> But u also must remember that cr3 is loaded with something else
> whenever the kernel switches among userspace, kernelspace, and
> interrupt context, and ioremap() also changes the cr3 as well, in
> order to implement the so-called hardware MMU operation.
>



-- 
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux