Commit c8c41d00 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] Fix CONFIG_DEBUG build on x86-64 & small cleanup

This fixes the CONFIG_DEBUG_INFO build on x86-64 (there were missing
.cfi_endprocs)

Also some minor cleanup in the exception stack handling.
parent a1f846e8
......@@ -803,9 +803,6 @@ ENTRY(debug)
pushq $0
CFI_ADJUST_CFA_OFFSET 8
paranoidentry do_debug
paranoid_stack_switch:
testq %rax,%rax
jz paranoid_exit
/* switch back to process stack to restore the state ptrace touched */
movq %rax,%rsp
jmp paranoid_exit
......@@ -870,8 +867,11 @@ ENTRY(reserved)
/* runs on exception stack */
ENTRY(double_fault)
CFI_STARTPROC
paranoidentry do_double_fault
jmp paranoid_stack_switch
movq %rax,%rsp
jmp paranoid_exit
CFI_ENDPROC
ENTRY(invalid_TSS)
errorentry do_invalid_TSS
......@@ -881,8 +881,11 @@ ENTRY(segment_not_present)
/* runs on exception stack */
ENTRY(stack_segment)
CFI_STARTPROC
paranoidentry do_stack_segment
jmp paranoid_stack_switch
movq %rax,%rsp
jmp paranoid_exit
CFI_ENDPROC
ENTRY(general_protection)
errorentry do_general_protection
......
......@@ -477,15 +477,17 @@ DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, get_cr
DO_ERROR(18, SIGSEGV, "reserved", reserved)
#define DO_ERROR_STACK(trapnr, signr, str, name) \
asmlinkage unsigned long do_##name(struct pt_regs * regs, long error_code) \
asmlinkage void *do_##name(struct pt_regs * regs, long error_code) \
{ \
struct pt_regs *pr = ((struct pt_regs *)(current->thread.rsp0))-1; \
if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) == NOTIFY_BAD) \
return 0; \
if (regs->cs & 3) \
return regs; \
if (regs->cs & 3) { \
memcpy(pr, regs, sizeof(struct pt_regs)); \
regs = pr; \
} \
do_trap(trapnr, signr, str, regs, error_code, NULL); \
return (regs->cs & 3) ? (unsigned long)pr : 0; \
return regs; \
}
DO_ERROR_STACK(12, SIGBUS, "stack segment", stack_segment)
......@@ -605,16 +607,18 @@ asmlinkage void default_do_nmi(struct pt_regs * regs)
}
/* runs on IST stack. */
asmlinkage unsigned long do_debug(struct pt_regs * regs, unsigned long error_code)
asmlinkage void *do_debug(struct pt_regs * regs, unsigned long error_code)
{
struct pt_regs *processregs;
struct pt_regs *pr;
unsigned long condition;
struct task_struct *tsk = current;
siginfo_t info;
processregs = (struct pt_regs *)(current->thread.rsp0)-1;
if (regs->cs & 3)
memcpy(processregs, regs, sizeof(struct pt_regs));
pr = (struct pt_regs *)(current->thread.rsp0)-1;
if (regs->cs & 3) {
memcpy(pr, regs, sizeof(struct pt_regs));
regs = pr;
}
#ifdef CONFIG_CHECKING
{
......@@ -673,8 +677,7 @@ asmlinkage unsigned long do_debug(struct pt_regs * regs, unsigned long error_cod
clear_dr7:
asm volatile("movq %0,%%db7"::"r"(0UL));
notify_die(DIE_DEBUG, "debug", regs, condition, 1, SIGTRAP);
out:
return (regs->cs & 3) ? (unsigned long)processregs : 0;
return regs;
clear_TF_reenable:
printk("clear_tf_reenable\n");
......@@ -685,8 +688,7 @@ asmlinkage unsigned long do_debug(struct pt_regs * regs, unsigned long error_cod
if (notify_die(DIE_DEBUG, "debug2", regs, condition, 1, SIGTRAP)
!= NOTIFY_BAD)
regs->eflags &= ~TF_MASK;
goto out;
return regs;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment