diff options
Diffstat (limited to 'src/devices/cpu/i386/i386dasm.cpp')
-rw-r--r-- | src/devices/cpu/i386/i386dasm.cpp | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/src/devices/cpu/i386/i386dasm.cpp b/src/devices/cpu/i386/i386dasm.cpp index 374f2a24a41..6b882259574 100644 --- a/src/devices/cpu/i386/i386dasm.cpp +++ b/src/devices/cpu/i386/i386dasm.cpp @@ -131,22 +131,22 @@ const i386_disassembler::I386_OPCODE i386_disassembler::i386_opcode_table1[256] {"outsb", 0, PARAM_PREIMP, 0, 0 }, {"outsw\0outsd\0outsd",VAR_NAME, PARAM_PREIMP, 0, 0 }, // 0x70 - {"jo", 0, PARAM_REL8, 0, 0 }, - {"jno", 0, PARAM_REL8, 0, 0 }, - {"jb", 0, PARAM_REL8, 0, 0 }, - {"jae", 0, PARAM_REL8, 0, 0 }, - {"je", 0, PARAM_REL8, 0, 0 }, - {"jne", 0, PARAM_REL8, 0, 0 }, - {"jbe", 0, PARAM_REL8, 0, 0 }, - {"ja", 0, PARAM_REL8, 0, 0 }, - {"js", 0, PARAM_REL8, 0, 0 }, - {"jns", 0, PARAM_REL8, 0, 0 }, - {"jp", 0, PARAM_REL8, 0, 0 }, - {"jnp", 0, PARAM_REL8, 0, 0 }, - {"jl", 0, PARAM_REL8, 0, 0 }, - {"jge", 0, PARAM_REL8, 0, 0 }, - {"jle", 0, PARAM_REL8, 0, 0 }, - {"jg", 0, PARAM_REL8, 0, 0 }, + {"jo", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jno", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jb", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jae", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"je", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jne", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jbe", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"ja", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"js", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jns", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jp", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jnp", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jl", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jge", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jle", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jg", 0, PARAM_REL8, 0, 0, STEP_COND}, // 0x80 {"group80", GROUP, 0, 0, 0 }, {"group81", GROUP, 0, 0, 0 }, @@ -230,7 +230,7 @@ const i386_disassembler::I386_OPCODE i386_disassembler::i386_opcode_table1[256] {"retf", 0, 0, 0, 0, STEP_OUT}, {"int 3", 0, 0, 0, 0, STEP_OVER}, {"int", 0, PARAM_UI8, 0, 0, STEP_OVER}, - {"into", 0, 0, 0, 0 }, + {"into", 0, 0, 0, 0, STEP_OVER | STEP_COND}, {"iret", 0, 0, 0, 0, STEP_OUT}, // 0xd0 {"groupD0", GROUP, 0, 0, 0 }, @@ -250,10 +250,10 @@ const i386_disassembler::I386_OPCODE i386_disassembler::i386_opcode_table1[256] {"escape", FPU, 0, 0, 0 }, {"escape", FPU, 0, 0, 0 }, // 0xe0 - {"loopne", 0, PARAM_REL8, 0, 0, STEP_OVER}, - {"loopz", 0, PARAM_REL8, 0, 0, STEP_OVER}, - {"loop", 0, PARAM_REL8, 0, 0, STEP_OVER}, - {"jcxz\0jecxz\0jrcxz",VAR_NAME, PARAM_REL8, 0, 0 }, + {"loopne", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"loopz", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"loop", 0, PARAM_REL8, 0, 0, STEP_COND}, + {"jcxz\0jecxz\0jrcxz",VAR_NAME, PARAM_REL8, 0, 0, STEP_COND}, {"in", 0, PARAM_AL, PARAM_UI8, 0 }, {"in", 0, PARAM_EAX, PARAM_UI8, 0 }, {"out", 0, PARAM_UI8, PARAM_AL, 0 }, @@ -1914,9 +1914,9 @@ char *i386_disassembler::hexstring(uint32_t value, int digits) static char buffer[20]; buffer[0] = '0'; if (digits) - sprintf(&buffer[1], "%0*Xh", digits, value); + snprintf(&buffer[1], 19, "%0*Xh", digits, value); else - sprintf(&buffer[1], "%Xh", value); + snprintf(&buffer[1], 19, "%Xh", value); return (buffer[1] >= '0' && buffer[1] <= '9') ? &buffer[1] : &buffer[0]; } @@ -1925,30 +1925,28 @@ char *i386_disassembler::hexstring64(uint32_t lo, uint32_t hi) static char buffer[40]; buffer[0] = '0'; if (hi != 0) - sprintf(&buffer[1], "%X%08Xh", hi, lo); + snprintf(&buffer[1], 39, "%X%08Xh", hi, lo); else - sprintf(&buffer[1], "%Xh", lo); + snprintf(&buffer[1], 39, "%Xh", lo); return (buffer[1] >= '0' && buffer[1] <= '9') ? &buffer[1] : &buffer[0]; } -char *i386_disassembler::hexstringpc(uint64_t pc) +std::string i386_disassembler::hexstringpc(uint64_t pc) { if (m_config->get_mode() == 64) - return hexstring64((uint32_t)pc, (uint32_t)(pc >> 32)); + return hexstring64(uint32_t(pc), uint32_t(pc >> 32)); else - return hexstring((uint32_t)pc, 0); + return hexstring(uint32_t(pc), 0); } -char *i386_disassembler::shexstring(uint32_t value, int digits, bool always) +std::string i386_disassembler::shexstring(uint32_t value, int digits, bool always) { - static char buffer[20]; if (value >= 0x80000000) - sprintf(buffer, "-%s", hexstring(-value, digits)); + return util::string_format("-%s", hexstring(-value, digits)); else if (always) - sprintf(buffer, "+%s", hexstring(value, digits)); + return util::string_format("+%s", hexstring(value, digits)); else return hexstring(value, digits); - return buffer; } void i386_disassembler::handle_sib_byte(std::ostream &stream, uint8_t mod, offs_t base_pc, offs_t &pc, const data_buffer &opcodes) @@ -2847,7 +2845,7 @@ void i386_disassembler::decode_opcode(std::ostream &stream, const I386_OPCODE *o case GROUP: handle_modrm(modrm_string, base_pc, pc, opcodes); - for( i=0; i < ARRAY_LENGTH(group_op_table); i++ ) { + for( i=0; i < std::size(group_op_table); i++ ) { if( strcmp(op->mnemonic, group_op_table[i].mnemonic) == 0 ) { if (op->flags & GROUP_MOD) decode_opcode(stream, &group_op_table[i].opcode[MODRM_MOD()], op1, base_pc, pc, opcodes); |