Re: 2.6.4-mm1 entry.S errors x86_64

From: Andi Kleen
Date: Thu Mar 11 2004 - 21:17:30 EST


Sid Boyce <sboyce@xxxxxxxxxxxxxxxx> writes:
> previous .cfi_startproc
> arch/x86_64/kernel/entry.S:873: Error: no such instruction: `r8,3*8-(9*8+0)'
> arch/x86_64/kernel/entry.S:873: Error: CFI instruction used without
> previous .cfi_startproc
> etc.

This patch should fix it. It has a few unrelated changes, but
I'm too lazy to untangle them now.

Or alternatively disable CONFIG_DEBUG_INFO

-Andi

Clean up stack switching handling for IST exceptions.

Pass right pt_regs to die_chain functions.

Add missing cfi mnemonics to fix CONFIG_DEBUG_INFO compilation.

diff -X ../KDIFX -burpN linux-2.6.4-x86_64-1/arch/x86_64/kernel/entry.S linux-2.6.4-amd64/arch/x86_64/kernel/entry.S
--- linux-2.6.4-x86_64-1/arch/x86_64/kernel/entry.S 2004-03-18 14:32:08.000000000 +0100
+++ linux-2.6.4-amd64/arch/x86_64/kernel/entry.S 2004-03-18 14:27:29.000000000 +0100
@@ -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
diff -X ../KDIFX -burpN linux-2.6.4-x86_64-1/arch/x86_64/kernel/traps.c linux-2.6.4-amd64/arch/x86_64/kernel/traps.c
--- linux-2.6.4-x86_64-1/arch/x86_64/kernel/traps.c 2004-03-18 14:32:08.000000000 +0100
+++ linux-2.6.4-amd64/arch/x86_64/kernel/traps.c 2004-03-18 01:00:40.000000000 +0100
@@ -477,15 +477,17 @@ DO_ERROR_INFO(17, SIGBUS, "alignment che
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
}

/* 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
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;
}

/*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/