sub $sym_offs(1b), %esi
/* Set up stack. */
- lea STACK_SIZE + sym_esi(cpu0_stack), %esp
+ lea STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
mov %ebx, sym_esi(pvh_start_info_pa)
sub $sym_offs(1b), %esi
/* Set up stack. */
- lea STACK_SIZE + sym_esi(cpu0_stack), %esp
+ lea STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
/* Bootloaders may set multiboot{1,2}.mem_lower to a nonzero value. */
xor %edx,%edx
cmpb $0,sym_fs(efi_platform)
jnz 1f
- /* Initialize BSS (no nasty surprises!). */
+ /*
+ * Initialise the BSS.
+ *
+ * !!! WARNING - also zeroes the current stack !!!
+ */
lea sym_esi(__bss_start), %edi
lea sym_esi(__bss_end), %ecx
sub %edi,%ecx
mov %rcx,%cr4
mov stack_start(%rip),%rsp
- or $(STACK_SIZE-CPUINFO_sizeof),%rsp
/* Reset EFLAGS (subsumes CLI and CLD). */
pushq $0
.long 0
GLOBAL(stack_start)
- .quad cpu0_stack
+ .quad cpu0_stack + STACK_SIZE - CPUINFO_sizeof
.section .data.page_aligned, "aw", @progbits
.align PAGE_SIZE, 0
"or $"__stringify(X86_CR4_PGE)", %[cr4]\n\t"
"mov %[cr4], %%cr4\n\t"
#endif
- "movabs $__start_xen, %[rip]\n\t"
"lgdt boot_gdtr(%%rip)\n\t"
- "mov stack_start(%%rip), %%rsp\n\t"
"mov %[ds], %%ss\n\t"
"mov %[ds], %%ds\n\t"
"mov %[ds], %%es\n\t"
"mov %[ds], %%fs\n\t"
"mov %[ds], %%gs\n\t"
- "movl %[cs], 8(%%rsp)\n\t"
- "mov %[rip], (%%rsp)\n\t"
- "lretq %[stkoff]-16"
+
+ /* Jump to higher mappings. */
+ "mov stack_start(%%rip), %%rsp\n\t"
+ "movabs $__start_xen, %[rip]\n\t"
+ "push %[cs]\n\t"
+ "push %[rip]\n\t"
+ "lretq"
: [rip] "=&r" (efer/* any dead 64-bit variable */),
[cr4] "+&r" (cr4)
: [cr3] "r" (idle_pg_table),
- [cs] "ir" (__HYPERVISOR_CS),
+ [cs] "i" (__HYPERVISOR_CS),
[ds] "r" (__HYPERVISOR_DS),
- [stkoff] "i" (STACK_SIZE - sizeof(struct cpu_info)),
"D" (&mbi)
: "memory" );
unreachable();
printk("Booting processor %d/%d eip %lx\n",
cpu, apicid, start_eip);
- stack_start = stack_base[cpu];
+ stack_start = stack_base[cpu] + STACK_SIZE - sizeof(struct cpu_info);
/* This grunge runs the startup process for the targeted processor. */
boot_cpu_physical_apicid = get_apic_id();
x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
- stack_base[0] = stack_start;
+ stack_base[0] = (void *)((unsigned long)stack_start & ~(STACK_SIZE - 1));
rc = setup_cpu_root_pgt(0);
if ( rc )