Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: opcodes/xgate-dis.c

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « opcodes/v850-opc.c ('k') | opcodes/xgate-opc.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: opcodes/xgate-dis.c
diff --git a/opcodes/xgate-dis.c b/opcodes/xgate-dis.c
index 31f44d63f9e5de7000c267f9f2836f9efa519f18..61dfbe1fd9bccd711360291ba6b70196424da804 100644
--- a/opcodes/xgate-dis.c
+++ b/opcodes/xgate-dis.c
@@ -124,83 +124,69 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info)
(*info->fprintf_func)(info->stream, "%s", decodePTR->opcodePTR->name);
/* First we compare the shorthand format of the constraints. If we
- still are unable to pinpoint the operands
- we analyze the opcodes constraint string. */
- switch (decodePTR->opcodePTR->sh_format)
- {
- case XG_R_C:
- (*info->fprintf_func)(info->stream, " R%x, CCR",
- (raw_code >> 8) & 0x7);
- break;
- case XG_C_R:
- (*info->fprintf_func)(info->stream, " CCR, R%x",
- (raw_code >> 8) & 0x7);
- break;
- case XG_R_P:
- (*info->fprintf_func)(info->stream, " R%x, PC",
- (raw_code >> 8) & 0x7);
- break;
- case XG_INH:
- break;
- case XG_R_R_R:
- if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_TRI))
- {
- (*info->fprintf_func)(info->stream, " R%x, R%x, R%x",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
- (raw_code >> 2) & 0x7);
- }
- else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IDR))
- {
- if (raw_code & 0x01)
- {
- (*info->fprintf_func)(info->stream, " R%x, (R%x, R%x+)",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
- (raw_code >> 2) & 0x7);
- }
- else if (raw_code & 0x02)
- {
- (*info->fprintf_func)(info->stream, " R%x, (R%x, -R%x)",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
- (raw_code >> 2) & 0x7);
- }
- else
- {
- (*info->fprintf_func)(info->stream, " R%x, (R%x, R%x)",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
- (raw_code >> 2) & 0x7);
- }
- }
- else
- {
- (*info->fprintf_func)(info->stream, " unhandled mode %s",
- decodePTR->opcodePTR->constraints);
- }
- break;
- case XG_R_R:
- if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_DYA))
- {
- operandOne = ripBits (&operMaskReg, 3, opcodePTR, raw_code);
- operandTwo = ripBits (&operMaskReg, 3, opcodePTR, raw_code);
- (*info->fprintf_func)(info->stream, " R%x, R%x", operandOne,
- operandTwo);
- }
- else
- {
- (*info->fprintf_func)(info->stream, " unhandled mode %s",
- opcodePTR->constraints);
- }
- break;
- case XG_R_R_I:
- (*info->fprintf_func)(info->stream, " R%x, (R%x, #0x%x)",
- (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7, raw_code & 0x1f);
- break;
- case XG_R:
- operandOne = ripBits (&operMaskReg, 3, decodePTR->opcodePTR,
- raw_code);
- (*info->fprintf_func)(info->stream, " R%x", operandOne);
- break;
- case XG_I | XG_PCREL:
- if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_REL9))
+ still are unable to pinpoint the operands
+ we analyze the opcodes constraint string. */
+ if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_MON_R_C))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, CCR",
+ (raw_code >> 8) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_MON_C_R))
+ {
+ (*info->fprintf_func)(info->stream, " CCR, R%x",
+ (raw_code >> 8) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_MON_R_P))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, PC",
+ (raw_code >> 8) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_TRI))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, R%x, R%x",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
+ (raw_code >> 2) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IDR))
+ {
+ if (raw_code & 0x01)
+ {
+ (*info->fprintf_func)(info->stream, " R%x, (R%x, R%x+)",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
+ (raw_code >> 2) & 0x7);
+ }
+ else if (raw_code & 0x02)
+ {
+ (*info->fprintf_func)(info->stream, " R%x, (R%x, -R%x)",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
+ (raw_code >> 2) & 0x7);
+ }
+ else
+ {
+ (*info->fprintf_func)(info->stream, " R%x, (R%x, R%x)",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7,
+ (raw_code >> 2) & 0x7);
+ }
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_DYA))
+ {
+ operandOne = ripBits (&operMaskReg, 3, opcodePTR, raw_code);
+ operandTwo = ripBits (&operMaskReg, 3, opcodePTR, raw_code);
+ ( *info->fprintf_func)(info->stream, " R%x, R%x", operandOne,
+ operandTwo);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IDO5))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, (R%x, #0x%x)",
+ (raw_code >> 8) & 0x7, (raw_code >> 5) & 0x7, raw_code & 0x1f);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_MON))
+ {
+ operandOne = ripBits (&operMaskReg, 3, decodePTR->opcodePTR,
+ raw_code);
+ (*info->fprintf_func)(info->stream, " R%x", operandOne);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_REL9))
{
/* If address is negative handle it accordingly. */
if (raw_code & XGATE_NINE_SIGNBIT)
@@ -215,10 +201,10 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info)
relAddr = raw_code & 0xff;
relAddr = (relAddr << 1) + 2;
}
- (*info->fprintf_func)(info->stream, " *%d", relAddr);
- (*info->fprintf_func)(info->stream, " Abs* 0x");
- (*info->print_address_func)(memaddr + relAddr, info);
- }
+ (*info->fprintf_func)(info->stream, " *%d", relAddr);
+ (*info->fprintf_func)(info->stream, " Abs* 0x");
+ (*info->print_address_func)(memaddr + relAddr, info);
+ }
else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_REL10))
{
/* If address is negative handle it accordingly. */
@@ -238,54 +224,44 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info)
(*info->fprintf_func)(info->stream, " Abs* 0x");
(*info->print_address_func)(memaddr + relAddr, info);
}
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM4))
+ {
+ (*info->fprintf_func)(info->stream, " R%x, #0x%02x",
+ (raw_code >> 8) & 0x7, (raw_code >> 4) & 0xF);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM8))
+ {
+ if (macro_search (decodePTR->opcodePTR->name, previousOpName) &&
+ previousOpName[0])
+ {
+ absAddress = (0xFF & raw_code) << 8;
+ absAddress |= perviousBin & 0xFF;
+ (*info->fprintf_func)(info->stream, " R%x, #0x%02x Abs* 0x",
+ (raw_code >> 8) & 0x7, raw_code & 0xff);
+ (*info->print_address_func)(absAddress, info);
+ previousOpName[0] = 0;
+ }
+ else
+ {
+ strcpy (previousOpName, decodePTR->opcodePTR->name);
+ (*info->fprintf_func)(info->stream, " R%x, #0x%02x",
+ (raw_code >> 8) & 0x7, raw_code & 0xff);
+ }
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM3))
+ {
+ (*info->fprintf_func)(info->stream, " #0x%x",
+ (raw_code >> 8) & 0x7);
+ }
+ else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_INH))
+ {
+ //
+ }
else
{
- (*info->fprintf_func)(info->stream,
- " Can't disassemble for mode) %s",
- decodePTR->opcodePTR->constraints);
+ (*info->fprintf_func)(info->stream, " unhandled mode %s",
+ opcodePTR->constraints);
}
- break;
- case XG_R_I:
- if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM4))
- {
- (*info->fprintf_func)(info->stream, " R%x, #0x%02x",
- (raw_code >> 8) & 0x7, (raw_code >> 4) & 0xF);
- }
- else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_IMM8))
- {
- if (macro_search (decodePTR->opcodePTR->name, previousOpName) &&
- previousOpName[0])
- {
- absAddress = (0xFF & raw_code) << 8;
- absAddress |= perviousBin & 0xFF;
- (*info->fprintf_func)(info->stream, " R%x, #0x%02x Abs* 0x",
- (raw_code >> 8) & 0x7, raw_code & 0xff);
- (*info->print_address_func)(absAddress, info);
- previousOpName[0] = 0;
- }
- else
- {
- strcpy (previousOpName, decodePTR->opcodePTR->name);
- (*info->fprintf_func)(info->stream, " R%x, #0x%02x",
- (raw_code >> 8) & 0x7, raw_code & 0xff);
- }
- }
- else
- {
- (*info->fprintf_func)(info->stream,
- " Can't disassemble for mode %s",
- decodePTR->opcodePTR->constraints);
- }
- break;
- case XG_I:
- (*info->fprintf_func)(info->stream, " #0x%x",
- (raw_code >> 8) & 0x7);
- break;
- default:
- (*info->fprintf_func)(info->stream, "address mode not found\t %x",
- opcodePTR->bin_opcode);
- break;
- }
perviousBin = raw_code;
}
else
« no previous file with comments | « opcodes/v850-opc.c ('k') | opcodes/xgate-opc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698