From: Dave Kleikamp Date: Thu, 23 Jun 2016 19:04:30 +0000 (-0500) Subject: sparc: kexec: Don't mess with the tl register X-Git-Tag: v4.1.12-92~30^2~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c915fa9d5788dac3ddbb4529dc6f1abe4b282490;p=users%2Fjedix%2Flinux-maple.git sparc: kexec: Don't mess with the tl register I meddled with things I didn't fully understand while implementing commit b43bc8f0 - "sparc64: add missing code for crash_setup_regs()" I had changed the tl register in order to read tstate, tpc, etc. without really knowing what I was doing. This can be a disaster if the crashing thread takes another interrupt. Currently, the crash utitility doesn't even use those values. They are found on the stack instead. Orabug: 23585248 Signed-off-by: Dave Kleikamp (cherry picked from commit 80eb7e28d3c719bbe3af56de5a5a8c68b764dbb9) Signed-off-by: Allen Pais --- diff --git a/arch/sparc/include/asm/kexec.h b/arch/sparc/include/asm/kexec.h index 889ffdb4225d9..b97d3e2c477ea 100644 --- a/arch/sparc/include/asm/kexec.h +++ b/arch/sparc/include/asm/kexec.h @@ -100,8 +100,6 @@ static inline void crash_setup_regs(struct pt_regs *newregs, if (oldregs) memcpy(newregs, oldregs, sizeof(*newregs)); else { - unsigned long tl = 1, tstate, tpc, tnpc, y; - asm volatile("stx %%g0, %0" : "=m" (newregs->u_regs[0])); asm volatile("stx %%g1, %0" : "=m" (newregs->u_regs[1])); asm volatile("stx %%g2, %0" : "=m" (newregs->u_regs[2])); @@ -118,15 +116,16 @@ static inline void crash_setup_regs(struct pt_regs *newregs, asm volatile("stx %%o5, %0" : "=m" (newregs->u_regs[13])); asm volatile("stx %%o6, %0" : "=m" (newregs->u_regs[14])); asm volatile("stx %%o7, %0" : "=m" (newregs->u_regs[15])); - asm volatile("wrpr %0, %%tl" :: "r" (tl)); - asm volatile("rdpr %%tstate, %0" : "=r" (tstate)); - newregs->tstate = tstate; - asm volatile("rdpr %%tpc, %0" : "=r" (tpc)); - newregs->tpc = tpc; - asm volatile("rdpr %%tnpc, %0" : "=r" (tnpc)); - newregs->tnpc = tnpc; - asm volatile("rd %%y, %0" : "=r" (y)); - newregs->y = y; + /* + * The following are dependent on the tl register. We + * can worry about them if the crash command ever needs + * them. + */ + newregs->tstate = 0; + newregs->tpc = 0; + newregs->tnpc = 0; + newregs->y = 0; + newregs->magic = PT_REGS_MAGIC; } }