Commit 2b47d466 authored by Paul Mackerras's avatar Paul Mackerras

PPC32: Better handling of program check exceptions on 4xx, patch from Kumar Gala.

With this patch we read the ESR (exception syndrome register) early on in handling
the program check exception, before reenabling the MMU and save it in the stack
frame.  This avoids having the value overwritten by a subsequent exception.
parent 1ce0a37a
......@@ -447,7 +447,12 @@ label:
EXC_XFER_EE(0x600, AlignmentException)
/* 0x0700 - Program Exception */
EXCEPTION(0x700, ProgramCheck, ProgramCheckException, EXC_XFER_EE)
START_EXCEPTION(0x0700, ProgramCheck)
NORMAL_EXCEPTION_PROLOG
mfspr r4,SPRN_ESR /* Grab the ESR and save it */
stw r4,_ESR(r11)
addi r3,r1,STACK_FRAME_OVERHEAD
EXC_XFER_EE(0x700, ProgramCheckException)
EXCEPTION(0x0800, Trap_08, UnknownException, EXC_XFER_EE)
EXCEPTION(0x0900, Trap_09, UnknownException, EXC_XFER_EE)
......@@ -469,7 +474,7 @@ label:
lis r0,TSR_PIS@h
mtspr SPRN_TSR,r0 /* Clear the PIT exception */
addi r3,r1,STACK_FRAME_OVERHEAD
EXC_XFER_EE(0x1000, timer_interrupt)
EXC_XFER_LITE(0x1000, timer_interrupt)
#if 0
/* NOTE:
......
......@@ -302,7 +302,7 @@ ProgramCheckException(struct pt_regs *regs)
int errcode;
#if defined(CONFIG_4xx)
unsigned int esr = mfspr(SPRN_ESR);
unsigned int esr = regs->dsisr;
int isbpt = esr & ESR_PTR;
extern int do_mathemu(struct pt_regs *regs);
......
......@@ -33,7 +33,7 @@ struct pt_regs {
/* N.B. for critical exceptions on 4xx, the dar and dsisr
fields are overloaded to hold srr0 and srr1. */
unsigned long dar; /* Fault registers */
unsigned long dsisr;
unsigned long dsisr; /* on 4xx/Book-E used for ESR */
unsigned long result; /* Result of a system call */
};
......
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