From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 2/8] Fix disassembly of RX_URRD, SI_URD & PC-relative instructions.
Date: Tue, 17 Jul 2007 14:17:49 +0200 [thread overview]
Message-ID: <20070717122231.050011517@de.ibm.com> (raw)
In-Reply-To: 20070717121747.591687140@de.ibm.com
[-- Attachment #1: 001-disassembler.diff --]
[-- Type: text/plain, Size: 2289 bytes --]
From: Christian Borntraeger <borntraeger@de.ibm.com>
The instructions with format RX_URRD and SI_URD and instructions
with a PC relative operand are not disassembled correctly.
For RX_URRD and SI_URD instructions find_insn sets opfrag to code[0].
The mask byte of these two formats is 0x00. table->opfrag will never
be identical to (opfrag & opmask) and no matching instruction will
be found. Set the mask byte to 0xff to actually check byte 0 against
the table.
For PC relative instructions the (unsigned) offset value needs to be
casted to an signed integer so that negative branch offsets are
handled correctly.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/kernel/dis.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: quilt-2.6/arch/s390/kernel/dis.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/dis.c
+++ quilt-2.6/arch/s390/kernel/dis.c
@@ -240,8 +240,8 @@ static const unsigned char formats[][7]
[INSTR_RXY_FRRD] = { 0xff, F_8,D20_20,X_12,B_16,0,0 },/* e.g. ley */
[INSTR_RX_FRRD] = { 0xff, F_8,D_20,X_12,B_16,0,0 }, /* e.g. ae */
[INSTR_RX_RRRD] = { 0xff, R_8,D_20,X_12,B_16,0,0 }, /* e.g. l */
- [INSTR_RX_URRD] = { 0x00, U4_8,D_20,X_12,B_16,0,0 }, /* e.g. bc */
- [INSTR_SI_URD] = { 0x00, D_20,B_16,U8_8,0,0,0 }, /* e.g. cli */
+ [INSTR_RX_URRD] = { 0xff, U4_8,D_20,X_12,B_16,0,0 }, /* e.g. bc */
+ [INSTR_SI_URD] = { 0xff, D_20,B_16,U8_8,0,0,0 }, /* e.g. cli */
[INSTR_SIY_URD] = { 0xff, D20_20,B_16,U8_8,0,0,0 }, /* e.g. tmy */
[INSTR_SSE_RDRD] = { 0xff, D_20,B_16,D_36,B_32,0,0 }, /* e.g. mvsdk */
[INSTR_SS_L0RDRD] = { 0xff, D_20,L8_8,B_16,D_36,B_32,0 },
@@ -1190,7 +1190,8 @@ static int print_insn(char *buffer, unsi
else if (operand->flags & OPERAND_CR)
ptr += sprintf(ptr, "%%c%i", value);
else if (operand->flags & OPERAND_PCREL)
- ptr += sprintf(ptr, "%lx", value + addr);
+ ptr += sprintf(ptr, "%lx", (signed int) value
+ + addr);
else if (operand->flags & OPERAND_SIGNED)
ptr += sprintf(ptr, "%i", value);
else
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2007-07-17 12:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-17 12:17 [patch 0/8] s390 update Martin Schwidefsky
2007-07-17 12:17 ` [patch 1/8] Update default configuration Martin Schwidefsky
2007-07-17 12:17 ` Martin Schwidefsky [this message]
2007-07-17 12:17 ` [patch 3/8] qdio: output queue stall on FCP and network devices Martin Schwidefsky
2007-07-17 12:17 ` [patch 4/8] vmcp cleanup Martin Schwidefsky
2007-07-17 12:17 ` [patch 5/8] z/VM unit record device driver Martin Schwidefsky
2007-07-17 12:17 ` [patch 6/8] Simplify stack trace Martin Schwidefsky
2007-07-17 12:17 ` [patch 7/8] cio: Dont print trailing \0 in modalias_show() Martin Schwidefsky
2007-07-17 12:17 ` [patch 8/8] Fix broken logic, SIGA flags must be bitwise ORed Martin Schwidefsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070717122231.050011517@de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox