Skip to content

Commit d70ddac

Browse files
rth7680Linus Torvalds
authored andcommitted
[PATCH] alpha: fix kernel alignment traps
Pass in the pointer to the on-stack registers rather than using them directly as the arguments. Ivan noticed that I missed a spot when purging the registers as first stack parameter idiom. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent b620cc2 commit d70ddac

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎arch/alpha/kernel/entry.S‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ entUna:
196196
stq $26, 208($sp)
197197
stq $27, 216($sp)
198198
stq $28, 224($sp)
199+
mov $sp, $19
199200
stq $gp, 232($sp)
200201
lda $8, 0x3fff
201202
stq $31, 248($sp)

‎arch/alpha/kernel/traps.c‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -446,16 +446,15 @@ struct unaligned_stat {
446446

447447

448448
/* Macro for exception fixup code to access integer registers. */
449-
#define una_reg(r) (regs.regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)])
449+
#define una_reg(r) (regs->regs[(r) >= 16 && (r) <= 18 ? (r)+19 : (r)])
450450

451451

452452
asmlinkage void
453453
do_entUna(void * va, unsigned long opcode, unsigned long reg,
454-
unsigned long a3, unsigned long a4, unsigned long a5,
455-
struct allregs regs)
454+
struct allregs *regs)
456455
{
457456
long error, tmp1, tmp2, tmp3, tmp4;
458-
unsigned long pc = regs.pc - 4;
457+
unsigned long pc = regs->pc - 4;
459458
const struct exception_table_entry *fixup;
460459

461460
unaligned[0].count++;
@@ -636,7 +635,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
636635
printk("Forwarding unaligned exception at %lx (%lx)\n",
637636
pc, newpc);
638637

639-
(&regs)->pc = newpc;
638+
regs->pc = newpc;
640639
return;
641640
}
642641

@@ -650,7 +649,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
650649
current->comm, current->pid);
651650

652651
printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n",
653-
pc, una_reg(26), regs.ps);
652+
pc, una_reg(26), regs->ps);
654653
printk("r0 = %016lx r1 = %016lx r2 = %016lx\n",
655654
una_reg(0), una_reg(1), una_reg(2));
656655
printk("r3 = %016lx r4 = %016lx r5 = %016lx\n",
@@ -670,10 +669,10 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
670669
una_reg(22), una_reg(23), una_reg(24));
671670
printk("r25= %016lx r27= %016lx r28= %016lx\n",
672671
una_reg(25), una_reg(27), una_reg(28));
673-
printk("gp = %016lx sp = %p\n", regs.gp, &regs+1);
672+
printk("gp = %016lx sp = %p\n", regs->gp, regs+1);
674673

675674
dik_show_code((unsigned int *)pc);
676-
dik_show_trace((unsigned long *)(&regs+1));
675+
dik_show_trace((unsigned long *)(regs+1));
677676

678677
if (test_and_set_thread_flag (TIF_DIE_IF_KERNEL)) {
679678
printk("die_if_kernel recursion detected.\n");

0 commit comments

Comments
 (0)