x86-32: Start out cr0 clean, disable paging before modifying cr3/4
Patch
5a5a51db78
x86-32: Start out eflags and cr4 clean
... made x86-32 match x86-64 in that we initialize %eflags and %cr4
from scratch. This broke OLPC XO-1.5, because the XO enters the
kernel with paging enabled, which the kernel doesn't expect.
Since we no longer support 386 (the source of most of the variability
in %cr0 configuration), we can simply match further x86-64 and
initialize %cr0 to a fixed value -- the one variable part remaining in
%cr0 is for FPU control, but all that is handled later on in
initialization; in particular, configuring %cr0 as if the FPU is
present until proven otherwise is correct and necessary for the probe
to work.
To deal with the XO case sanely, explicitly disable paging in %cr0
before we muck with %cr3, %cr4 or EFER -- those operations are
inherently unsafe with paging enabled.
NOTE: There is still a lot of 386-related junk in head_32.S which we
can and should get rid of, however, this is intended as a minimal fix
whereas the cleanup can be deferred to the next merge window.
Reported-by: Andres Salomon <dilinger@queued.net>
Tested-by: Daniel Drake <dsd@laptop.org>
Link: http://lkml.kernel.org/r/50FA0661.2060400@linux.intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
7d1f9aeff1
commit
021ef050fc
1 changed files with 7 additions and 2 deletions
|
@ -300,6 +300,12 @@ ENTRY(startup_32_smp)
|
||||||
leal -__PAGE_OFFSET(%ecx),%esp
|
leal -__PAGE_OFFSET(%ecx),%esp
|
||||||
|
|
||||||
default_entry:
|
default_entry:
|
||||||
|
#define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
|
||||||
|
X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
|
||||||
|
X86_CR0_PG)
|
||||||
|
movl $(CR0_STATE & ~X86_CR0_PG),%eax
|
||||||
|
movl %eax,%cr0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* New page tables may be in 4Mbyte page mode and may
|
* New page tables may be in 4Mbyte page mode and may
|
||||||
* be using the global pages.
|
* be using the global pages.
|
||||||
|
@ -364,8 +370,7 @@ default_entry:
|
||||||
*/
|
*/
|
||||||
movl $pa(initial_page_table), %eax
|
movl $pa(initial_page_table), %eax
|
||||||
movl %eax,%cr3 /* set the page table pointer.. */
|
movl %eax,%cr3 /* set the page table pointer.. */
|
||||||
movl %cr0,%eax
|
movl $CR0_STATE,%eax
|
||||||
orl $X86_CR0_PG,%eax
|
|
||||||
movl %eax,%cr0 /* ..and set paging (PG) bit */
|
movl %eax,%cr0 /* ..and set paging (PG) bit */
|
||||||
ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */
|
ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */
|
||||||
1:
|
1:
|
||||||
|
|
Loading…
Reference in a new issue