public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: Sid Boyce <sboyce@blueyonder.co.uk>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: 2.6.4-mm1 entry.S errors x86_64
Date: Thu, 18 Mar 2004 14:39:36 +0100	[thread overview]
Message-ID: <m3oequff53.fsf@averell.firstfloor.org> (raw)
In-Reply-To: <1yJYn-3Hl-21@gated-at.bofh.it> (Sid Boyce's message of "Fri, 12 Mar 2004 02:50:11 +0100")

Sid Boyce <sboyce@blueyonder.co.uk> 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;	
 }
 
 /*


       reply	other threads:[~2004-03-12  2:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1yJYn-3Hl-21@gated-at.bofh.it>
2004-03-18 13:39 ` Andi Kleen [this message]
2004-03-12  2:47   ` 2.6.4-mm1 entry.S errors x86_64 Sid Boyce
2004-03-12  1:42 Sid Boyce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3oequff53.fsf@averell.firstfloor.org \
    --to=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyce@blueyonder.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox