Skip to content

Commit

Permalink
s390/disassembler: remove confusing code
Browse files Browse the repository at this point in the history
When searching the opcode offset table within find_insn() the check
"entry->opcode == 0" was intended to clarify that 1-byte opcodes, the
first one being 0, are special.

However there is no mnemonic for an illegal opcode starting with 0.
Therefore there is also no opcode offset table entry that matches,
which again means that the check never is true. Therefore just remove
the confusing check, and add a comment which hopefully explains how
this works.

Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
heicarst authored and Martin Schwidefsky committed Nov 20, 2017
1 parent 3241d3e commit de35089
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/s390/kernel/dis.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,14 @@ struct s390_insn *find_insn(unsigned char *code)
unsigned char opfrag;
int i;

/* Search the opcode offset table to find an entry which
* matches the beginning of the opcode. If there is no match
* the last entry will be used, which is the default entry for
* unknown instructions as well as 1-byte opcode instructions.
*/
for (i = 0; i < ARRAY_SIZE(opcode_offset); i++) {
entry = &opcode_offset[i];
if (entry->opcode == code[0] || entry->opcode == 0)
if (entry->opcode == code[0])
break;
}

Expand Down

0 comments on commit de35089

Please sign in to comment.