Re: Unable to turn paging on!!

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Wed Mar 26 2003 - 15:36:22 EST


On Wed, 26 Mar 2003 ravikumar.chakaravarthy@amd.com wrote:

> I tweaked the kernel and boot loader to load the kernel at 0xdf000000,
> physical address. I did the following changes to setup the
> initial page table.
>
> However during boot, in arch/i386/kernel/head.S when the paging bit is set
> movl %eax,%cr0 /* ..and set paging (PG) bit */
>
> My computer hangs!!
>
> Any idea why??
>
> -Ravi
[SNIPPED...]
Because you can't just abitrarily change stuff around. For instance,
The PTE must be accessible as well as the GTD and the IDT when you
enable paging. In your code, you just mapped them out!
When you change the mapping, there MUST be a 1:1 physical to virtual
relationship for these descriptors. That's why they are in "low" memory.

To make this clear, let's assume you are running normally and you
want to turn the paging off. If you are at a normal virtual address,
you can't do that without crashing. You need to jump (or call) somewhere
that the physical and the virtual address are the same. Then you can
turn off paging (as long as you don't get any interrupts). Once
your EIP is at an address where there is a 1:1 correspondence
between a physical and virtual address, you can turn this off at
will. You need to turn it on before you "return".

There is nothing "magic" about low memory. You could build the GDT,
the IDT, and PTEs at 0xfff00000 and as long at the PTEs did a 1:1
mapping for this address __and__ your code that executed the mov CR0
instruction was up where there is a 1:1 mapping for the code, too.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:25 EST