bitkeeper revision 1.1466.1.1 (428cceb2sTCzL9rItLSMlnmH9XrnTQ)

Ensure correct alignment of CPU0 stack -- it must be aligned on a
2^STACK_ORDER page boundary. This requirement is now also checked
at run-time, and a clear fatal error given if it is not satisfied.
This bug affected both x86/32 and x86/64.
Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2005-05-19 17:36:50 +00:00
1 parent 1d6bf7557e
commit 63b5c765a2
3 files changed
+25 -12

No files matched your search

+7 -3
View File
@@ -212,9 +212,13 @@ ENTRY(gdt_table)
.fill 2*NR_CPUS,8,0 /* space for TSS and LDT per CPU */
.org 0x2000
ENTRY(idle_pg_table) # Initial page directory is 4kB
.org 0x3000
/* Maximum STACK_ORDER for x86/32 is 1. We must therefore ensure that the */
/* CPU0 stack is aligned on an even page boundary! */
ENTRY(cpu0_stack)
.org 0x3000 + STACK_SIZE
.org 0x2000 + STACK_SIZE
ENTRY(idle_pg_table)
.org 0x2000 + STACK_SIZE + PAGE_SIZE
ENTRY(stext)
ENTRY(_stext)
+7 -5
View File
@@ -243,8 +243,13 @@ ENTRY(idle_pg_table_4)
ENTRY(idle_pg_table_l3)
.quad idle_pg_table_l2 - __PAGE_OFFSET + 7
/* Initial PDE -- level-2 page table. Maps first 64MB physical memory. */
.org 0x4000
/* Maximum STACK_ORDER for x86/64 is 2. We must therefore ensure that the */
/* CPU0 stack is aligned on a 4-page boundary. */
ENTRY(cpu0_stack)
/* Initial PDE -- level-2 page table. Maps first 64MB physical memory. */
.org 0x4000 + STACK_SIZE
ENTRY(idle_pg_table_l2)
.macro identmap from=0, count=32
.if \count-1
@@ -256,10 +261,7 @@ ENTRY(idle_pg_table_l2)
.endm
identmap /* Too orangey for crows :-) */
.org 0x5000
ENTRY(cpu0_stack)
.org 0x5000 + STACK_SIZE
.org 0x4000 + STACK_SIZE + PAGE_SIZE
.code64
ENTRY(stext)
ENTRY(_stext)
+11 -4
View File
@@ -69,6 +69,8 @@ extern void ac_timer_init(void);
extern void initialize_keytable();
extern int do_timer_lists_from_pit;
extern unsigned long cpu0_stack[];
struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1 };
#if defined(CONFIG_X86_64)
@@ -381,11 +383,8 @@ static void __init do_initcalls(void)
static void __init start_of_day(void)
{
#ifdef MEMORY_GUARD
/* Unmap the first page of CPU0's stack. */
extern unsigned long cpu0_stack[];
memguard_guard_stack(cpu0_stack);
#endif
open_softirq(NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ, new_tlbflush_clock_period);
@@ -469,6 +468,8 @@ static void __init start_of_day(void)
#endif
}
#define EARLY_FAIL() for ( ; ; ) __asm__ __volatile__ ( "hlt" )
void __init __start_xen(multiboot_info_t *mbi)
{
char *cmdline;
@@ -495,7 +496,13 @@ void __init __start_xen(multiboot_info_t *mbi)
if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) )
{
printk("FATAL ERROR: Require at least one Multiboot module.\n");
for ( ; ; ) ;
EARLY_FAIL();
}
if ( ((unsigned long)cpu0_stack & (STACK_SIZE-1)) != 0 )
{
printk("FATAL ERROR: Misaligned CPU0 stack.\n");
EARLY_FAIL();
}
xenheap_phys_end = opt_xenheap_megabytes << 20;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.