unsigned long esp_top;
unsigned long *stack, addr;
- esp_top = (esp | (STACK_SIZE - 1)) - DEBUG_STACK_SIZE;
+ esp_top = (esp | (STACK_SIZE - 1)) - (DEBUG_STACK_SIZE - 1);
/* Trigger overflow trace if %esp is within 512 bytes of the guard page. */
if ( ((unsigned long)(esp - esp_top) > 512) &&
unmap_domain_page(l1t);
}
-#define DOUBLEFAULT_STACK_SIZE 1024
+#define DOUBLEFAULT_STACK_SIZE 2048
static struct tss_struct doublefault_tss;
static unsigned char doublefault_stack[DOUBLEFAULT_STACK_SIZE];
tss->ds = __HYPERVISOR_DS;
tss->es = __HYPERVISOR_DS;
tss->ss = __HYPERVISOR_DS;
- tss->esp = (unsigned long)
- &doublefault_stack[DOUBLEFAULT_STACK_SIZE];
+ tss->esp = (unsigned long)&doublefault_stack[DOUBLEFAULT_STACK_SIZE];
tss->__cr3 = __pa(idle_pg_table);
tss->cs = __HYPERVISOR_CS;
tss->eip = (unsigned long)do_double_fault;
stack_bottom = (char *)get_stack_bottom();
stack = (char *)((unsigned long)stack_bottom & ~(STACK_SIZE - 1));
- /* Double-fault handler has its own per-CPU 1kB stack. */
- init_tss[cpu].ist[0] = (unsigned long)&stack[1024];
+ /* Double-fault handler has its own per-CPU 2kB stack. */
+ init_tss[cpu].ist[0] = (unsigned long)&stack[2048];
/* NMI handler has its own per-CPU 1kB stack. */
- init_tss[cpu].ist[1] = (unsigned long)&stack[2048];
+ init_tss[cpu].ist[1] = (unsigned long)&stack[3072];
/*
* Trampoline for SYSCALL entry from long mode.
*/
/* Skip the NMI and DF stacks. */
- stack = &stack[2048];
+ stack = &stack[3072];
wrmsr(MSR_LSTAR, (unsigned long)stack, ((unsigned long)stack>>32));
/* movq %rsp, saversp(%rip) */
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/string.h>
+#include <xen/spinlock.h>
extern unsigned long symbols_addresses[];
extern unsigned long symbols_num_syms;
void __print_symbol(const char *fmt, unsigned long address)
{
const char *name;
- unsigned long offset, size;
- char namebuf[KSYM_NAME_LEN+1];
+ unsigned long offset, size, flags;
+ static DEFINE_SPINLOCK(lock);
+ static char namebuf[KSYM_NAME_LEN+1];
#define BUFFER_SIZE sizeof("%s+%#lx/%#lx [%s]") + KSYM_NAME_LEN + \
2*(BITS_PER_LONG*3/10) + 1
- char buffer[BUFFER_SIZE];
+ static char buffer[BUFFER_SIZE];
+
+ spin_lock_irqsave(&lock, flags);
name = symbols_lookup(address, &size, &offset, namebuf);
snprintf(buffer, BUFFER_SIZE, "%s+%#lx/%#lx", name, offset, size);
printk(fmt, buffer);
+
+ spin_unlock_irqrestore(&lock, flags);
}
void panic(const char *fmt, ...)
{
va_list args;
- char buf[128];
unsigned long flags;
static DEFINE_SPINLOCK(lock);
+ static char buf[128];
debugtrace_dump();
+ /* Protects buf[] and ensure multi-line message prints atomically. */
+ spin_lock_irqsave(&lock, flags);
+
va_start(args, fmt);
(void)vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
- /* Spit out multiline message in one go. */
console_start_sync();
- spin_lock_irqsave(&lock, flags);
printk("\n****************************************\n");
printk("Panic on CPU %d:\n", smp_processor_id());
printk(buf);
printk("Manual reset required ('noreboot' specified)\n");
else
printk("Reboot in five seconds...\n");
+
spin_unlock_irqrestore(&lock, flags);
debugger_trap_immediate();