]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix CONFIG_DEBUG build on x86-64 & small cleanup
authorAndi Kleen <ak@suse.de>
Mon, 15 Mar 2004 13:25:01 +0000 (05:25 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 15 Mar 2004 13:25:01 +0000 (05:25 -0800)
This fixes the CONFIG_DEBUG_INFO build on x86-64 (there were missing
.cfi_endprocs)

Also some minor cleanup in the exception stack handling.

arch/x86_64/kernel/entry.S
arch/x86_64/kernel/traps.c

index 7f73e3a1d62888b5806420ad0058750394512df4..141211f7d994d0e138cf48f5bff5a972cea8286e 100644 (file)
@@ -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
index 963baab39f26523c6cf22757003b82f52831beb4..5afe235c0474755237e2e6379a01a8854816c95b 100644 (file)
@@ -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 @@ clear_TF:
        if (notify_die(DIE_DEBUG, "debug2", regs, condition, 1, SIGTRAP) 
            != NOTIFY_BAD)
        regs->eflags &= ~TF_MASK;
-       
-       goto out;
+       return regs;    
 }
 
 /*