mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86/boot: Explicitly clean pcpu stacks in debug builds
This reduces confusion when looking at a hexdump of the pcpu stacks and wondering were on earth some of the junk was coming from. Also leave some grep fodder for finding where the BSP switches stack (because it took me far longer to find than I care to admit to). Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
483814219b
commit
8a3c4acc99
2 files changed
+13
No files matched your search
@@ -13,6 +13,15 @@
|
||||
mov mmu_cr4_features(%rip),%rcx
|
||||
mov %rcx,%cr4
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* Clean stack. */
|
||||
mov stack_start(%rip),%rdi
|
||||
mov $(STACK_SIZE / 8),%rcx
|
||||
xor %eax,%eax
|
||||
rep stosq
|
||||
#endif
|
||||
|
||||
/* Switch to cpu0_stack. */
|
||||
mov stack_start(%rip),%rsp
|
||||
or $(STACK_SIZE-CPUINFO_sizeof),%rsp
|
||||
|
||||
|
||||
@@ -659,6 +659,10 @@ static int cpu_smpboot_alloc(unsigned int cpu)
|
||||
stack_base[cpu] = alloc_xenheap_pages(STACK_ORDER, 0);
|
||||
if ( stack_base[cpu] == NULL )
|
||||
goto oom;
|
||||
#ifndef NDEBUG
|
||||
for ( order = 0 ; order < (1<<STACK_ORDER); ++order )
|
||||
clear_page(stack_base[cpu] + order * PAGE_SIZE);
|
||||
#endif
|
||||
memguard_guard_stack(stack_base[cpu]);
|
||||
|
||||
order = get_order_from_pages(NR_RESERVED_GDT_PAGES);
|
||||
|
||||