Changed the x86 disassembler to use 'std::ostream &' internally
This commit is contained in:
parent
9f7819cb35
commit
7303dfd3aa
@ -3993,7 +3993,11 @@ bool i386_device::memory_translate(address_spacenum spacenum, int intention, off
|
|||||||
|
|
||||||
offs_t i386_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
|
offs_t i386_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
|
||||||
{
|
{
|
||||||
return i386_dasm_one(buffer, pc, oprom, m_sreg[CS].d ? 32 : 16);
|
std::ostringstream stream;
|
||||||
|
offs_t result = i386_dasm_one(stream, pc, oprom, m_sreg[CS].d ? 32 : 16);
|
||||||
|
std::string stream_str = stream.str();
|
||||||
|
strcpy(buffer, stream_str.c_str());
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@
|
|||||||
#define MMXOP(XX) mmx_##XX
|
#define MMXOP(XX) mmx_##XX
|
||||||
#define SSEOP(XX) sse_##XX
|
#define SSEOP(XX) sse_##XX
|
||||||
|
|
||||||
extern int i386_dasm_one(char *buffer, uint32_t pc, const uint8_t *oprom, int mode);
|
extern int i386_dasm_one(std::ostream &stream, uint32_t pc, const uint8_t *oprom, int mode);
|
||||||
|
|
||||||
enum SREGS { ES, CS, SS, DS, FS, GS };
|
enum SREGS { ES, CS, SS, DS, FS, GS };
|
||||||
|
|
||||||
|
@ -510,8 +510,12 @@ void i8086_common_cpu_device::execute_set_input( int inptnum, int state )
|
|||||||
|
|
||||||
offs_t i8086_common_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
|
offs_t i8086_common_cpu_device::disasm_disassemble(char *buffer, offs_t pc, const uint8_t *oprom, const uint8_t *opram, uint32_t options)
|
||||||
{
|
{
|
||||||
extern int i386_dasm_one(char *buffer, offs_t eip, const uint8_t *oprom, int mode);
|
extern int i386_dasm_one(std::ostream &stream, offs_t eip, const uint8_t *oprom, int mode);
|
||||||
return i386_dasm_one(buffer, pc, oprom, 1);
|
std::ostringstream stream;
|
||||||
|
offs_t result = i386_dasm_one(stream, pc, oprom, 1);
|
||||||
|
std::string stream_str = stream.str();
|
||||||
|
strcpy(buffer, stream_str.c_str());
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t i8086_common_cpu_device::read_port_byte(uint16_t port)
|
uint8_t i8086_common_cpu_device::read_port_byte(uint16_t port)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static void reset_log(x86log_context *log) noexcept;
|
static void reset_log(x86log_context *log) noexcept;
|
||||||
extern int i386_dasm_one_ex(char *buffer, uint64_t eip, const uint8_t *oprom, int mode);
|
extern int i386_dasm_one_ex(std::ostream &stream, uint64_t eip, const uint8_t *oprom, int mode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ void x86log_disasm_code_range(x86log_context *log, const char *label, x86code *s
|
|||||||
/* loop from the start until the cache top */
|
/* loop from the start until the cache top */
|
||||||
while (cur < stop)
|
while (cur < stop)
|
||||||
{
|
{
|
||||||
char buffer[100];
|
std::string buffer;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
/* skip past any past data ranges */
|
/* skip past any past data ranges */
|
||||||
@ -129,10 +129,10 @@ void x86log_disasm_code_range(x86log_context *log, const char *label, x86code *s
|
|||||||
switch (curdata->size)
|
switch (curdata->size)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 1: sprintf(buffer, "db %02X", *cur); break;
|
case 1: buffer = string_format("db %02X", *cur); break;
|
||||||
case 2: sprintf(buffer, "dw %04X", *(uint16_t *)cur); break;
|
case 2: buffer = string_format("dw %04X", *(uint16_t *)cur); break;
|
||||||
case 4: sprintf(buffer, "dd %08X", *(uint32_t *)cur); break;
|
case 4: buffer = string_format("dd %08X", *(uint32_t *)cur); break;
|
||||||
case 8: sprintf(buffer, "dq %08X%08X", ((uint32_t *)cur)[1], ((uint32_t *)cur)[0]); break;
|
case 8: buffer = string_format("dq %08X%08X", ((uint32_t *)cur)[1], ((uint32_t *)cur)[0]); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,9 @@ void x86log_disasm_code_range(x86log_context *log, const char *label, x86code *s
|
|||||||
/* otherwise, do a disassembly of the current instruction */
|
/* otherwise, do a disassembly of the current instruction */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bytes = i386_dasm_one_ex(buffer, (uintptr_t)cur, cur, sizeof(void *) * 8) & DASMFLAG_LENGTHMASK;
|
std::stringstream strbuffer;
|
||||||
|
bytes = i386_dasm_one_ex(strbuffer, (uintptr_t)cur, cur, sizeof(void *) * 8) & DASMFLAG_LENGTHMASK;
|
||||||
|
buffer = strbuffer.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we have a matching comment, output it */
|
/* if we have a matching comment, output it */
|
||||||
@ -155,12 +157,12 @@ void x86log_disasm_code_range(x86log_context *log, const char *label, x86code *s
|
|||||||
/* if we have additional matching comments at the same address, output them first */
|
/* if we have additional matching comments at the same address, output them first */
|
||||||
for ( ; curcomment + 1 < lastcomment && cur == curcomment[1].base; curcomment++)
|
for ( ; curcomment + 1 < lastcomment && cur == curcomment[1].base; curcomment++)
|
||||||
x86log_printf(log, "%p: %-50s; %s\n", cur, "", curcomment->string);
|
x86log_printf(log, "%p: %-50s; %s\n", cur, "", curcomment->string);
|
||||||
x86log_printf(log, "%p: %-50s; %s\n", cur, buffer, curcomment->string);
|
x86log_printf(log, "%p: %-50s; %s\n", cur, buffer.c_str(), curcomment->string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we don't, just print the disassembly and move on */
|
/* if we don't, just print the disassembly and move on */
|
||||||
else
|
else
|
||||||
x86log_printf(log, "%p: %s\n", cur, buffer);
|
x86log_printf(log, "%p: %s\n", cur, buffer.c_str());
|
||||||
|
|
||||||
/* advance past this instruction */
|
/* advance past this instruction */
|
||||||
cur += bytes;
|
cur += bytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user