[S390] disassembler: mark exception causing instructions
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 27 Dec 2011 10:27:32 +0000 (11:27 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 27 Dec 2011 10:27:14 +0000 (11:27 +0100)
If an exception happens the PSW either points to the instruction that
caused the exception or to the instruction that follows the exception
causing instruction, depending on the exception type.
Since the inkernel disassembler adds a ">" in front of the disassembly
many people assume incorrectly that the instruction that is pointed to
must be the cause of the exception. To make people aware that this is
not necessarily the case add a different character in front of the
disassembled instruction that precedes the current instructions.

The output now looks like this:

Krnl PSW : 0704200180000000 0000000000120de8 (test_function+0x0/0x100)
           R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:2 PM:0 EA:3
Krnl GPRS: 000003ff00000000 0000000000120de4 000000000091bb40 0000000000000001
           000003fffd2ea000 0000000030fb7df8 0000000030fb7f10 000003ffffa113c8
           000000000091bb40 000003fffd2ea000 0000000000000002 0000000030fb7f10
           000000003f290240 0000000000606220 00000000002cfb5c 0000000030fb7d58
Krnl Code: 0000000000120ddcb90400a9           lgr     %r10,%r9
           0000000000120de0a7f4ff88           brc     15,120cf0
          #0000000000120de4a7f40001           brc     15,120de6
          >0000000000120de8a7f13f80           tmll    %r15,16256
           0000000000120deceb8ff0580024       stmg    %r8,%r15,88(%r15)
           0000000000120df2a7840001           brc     8,120df4
           0000000000120df6b90400ef           lgr     %r14,%r15
           0000000000120dfaa7fbffb8           aghi    %r15,-72

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/kernel/dis.c

index 45df6d4..e2f8475 100644 (file)
@@ -1578,10 +1578,15 @@ void show_code(struct pt_regs *regs)
        ptr += sprintf(ptr, "%s Code:", mode);
        hops = 0;
        while (start < end && hops < 8) {
-               *ptr++ = (start == 32) ? '>' : ' ';
+               opsize = insn_length(code[start]);
+               if  (start + opsize == 32)
+                       *ptr++ = '#';
+               else if (start == 32)
+                       *ptr++ = '>';
+               else
+                       *ptr++ = ' ';
                addr = regs->psw.addr + start - 32;
                ptr += sprintf(ptr, ONELONG, addr);
-               opsize = insn_length(code[start]);
                if (start + opsize >= end)
                        break;
                for (i = 0; i < opsize; i++)