]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc: kexec: Don't mess with the tl register
authorDave Kleikamp <dave.kleikamp@oracle.com>
Thu, 23 Jun 2016 19:04:30 +0000 (14:04 -0500)
committerAllen Pais <allen.pais@oracle.com>
Tue, 8 Nov 2016 10:14:47 +0000 (15:44 +0530)
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 <dave.kleikamp@oracle.com>
(cherry picked from commit 80eb7e28d3c719bbe3af56de5a5a8c68b764dbb9)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/include/asm/kexec.h

index 889ffdb4225d9b39f00318329e46dbfa4171a192..b97d3e2c477eadb2fcc22682e315ac711a919c44 100644 (file)
@@ -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;
        }
 }