mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
Added support for outputting 64-bit target addresses.
This commit is contained in:
parent
c09a3df1e9
commit
8240d56dd9
@ -1092,7 +1092,7 @@ static const char *const i386_sreg[8] = {"es", "cs", "ss", "ds", "fs", "gs", "??
|
|||||||
|
|
||||||
static int address_size;
|
static int address_size;
|
||||||
static int operand_size;
|
static int operand_size;
|
||||||
static UINT32 pc;
|
static UINT64 pc;
|
||||||
static UINT8 modrm;
|
static UINT8 modrm;
|
||||||
static UINT32 segment;
|
static UINT32 segment;
|
||||||
static offs_t dasm_flags;
|
static offs_t dasm_flags;
|
||||||
@ -1186,6 +1186,14 @@ static char *hexstring64(UINT32 lo, UINT32 hi)
|
|||||||
return (buffer[1] >= '0' && buffer[1] <= '9') ? &buffer[1] : &buffer[0];
|
return (buffer[1] >= '0' && buffer[1] <= '9') ? &buffer[1] : &buffer[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *hexstringpc(UINT64 pc)
|
||||||
|
{
|
||||||
|
if (curmode == 64)
|
||||||
|
return hexstring64((UINT32)pc, (UINT32)(pc >> 32));
|
||||||
|
else
|
||||||
|
return hexstring((UINT32)pc, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static char *shexstring(UINT32 value, int digits, int always)
|
static char *shexstring(UINT32 value, int digits, int always)
|
||||||
{
|
{
|
||||||
static char buffer[20];
|
static char buffer[20];
|
||||||
@ -1531,17 +1539,17 @@ static char* handle_param(char* s, UINT32 param)
|
|||||||
case PARAM_REL:
|
case PARAM_REL:
|
||||||
if( operand_size ) {
|
if( operand_size ) {
|
||||||
d32 = FETCHD32();
|
d32 = FETCHD32();
|
||||||
s += sprintf( s, "%s", hexstring(pc + d32, 0) );
|
s += sprintf( s, "%s", hexstringpc(pc + d32) );
|
||||||
} else {
|
} else {
|
||||||
/* make sure to keep the relative offset within the segment */
|
/* make sure to keep the relative offset within the segment */
|
||||||
d16 = FETCHD16();
|
d16 = FETCHD16();
|
||||||
s += sprintf( s, "%s", hexstring((pc & 0xFFFF0000) | ((pc + d16) & 0x0000FFFF), 0) );
|
s += sprintf( s, "%s", hexstringpc((pc & 0xFFFF0000) | ((pc + d16) & 0x0000FFFF)) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PARAM_REL8:
|
case PARAM_REL8:
|
||||||
d8 = FETCHD();
|
d8 = FETCHD();
|
||||||
s += sprintf( s, "%s", hexstring(pc + d8, 0) );
|
s += sprintf( s, "%s", hexstringpc(pc + d8) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PARAM_MEM_OFFS_B:
|
case PARAM_MEM_OFFS_B:
|
||||||
@ -2104,7 +2112,7 @@ handle_unknown:
|
|||||||
sprintf(s, "???");
|
sprintf(s, "???");
|
||||||
}
|
}
|
||||||
|
|
||||||
int i386_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom, int mode)
|
int i386_dasm_one_ex(char *buffer, UINT64 eip, const UINT8 *oprom, int mode)
|
||||||
{
|
{
|
||||||
UINT8 op;
|
UINT8 op;
|
||||||
|
|
||||||
@ -2123,3 +2131,8 @@ int i386_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom, int mode)
|
|||||||
decode_opcode( buffer, &i386_opcode_table1[op], op );
|
decode_opcode( buffer, &i386_opcode_table1[op], op );
|
||||||
return (pc-eip) | dasm_flags | DASMFLAG_SUPPORTED;
|
return (pc-eip) | dasm_flags | DASMFLAG_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i386_dasm_one(char *buffer, offs_t eip, const UINT8 *oprom, int mode)
|
||||||
|
{
|
||||||
|
return i386_dasm_one_ex(buffer, eip, oprom, mode);
|
||||||
|
}
|
||||||
|
@ -73,7 +73,7 @@ struct _x86log_context
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static void reset_log(x86log_context *log);
|
static void reset_log(x86log_context *log);
|
||||||
static int x86log_i386_dasm_one(char *buffer, UINT32 eip, const UINT8 *oprom, int mode);
|
static int x86log_i386_dasm_one_ex(char *buffer, UINT64 eip, const UINT8 *oprom, int mode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -237,9 +237,9 @@ void x86log_disasm_code_range(x86log_context *log, const char *label, x86code *s
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef PTR64
|
#ifdef PTR64
|
||||||
bytes = x86log_i386_dasm_one(buffer, (UINT32)(FPTR)cur, cur, 64) & DASMFLAG_LENGTHMASK;
|
bytes = x86log_i386_dasm_one_ex(buffer, (FPTR)cur, cur, 64) & DASMFLAG_LENGTHMASK;
|
||||||
#else
|
#else
|
||||||
bytes = x86log_i386_dasm_one(buffer, (UINT32)(FPTR)cur, cur, 32) & DASMFLAG_LENGTHMASK;
|
bytes = x86log_i386_dasm_one_ex(buffer, (FPTR)cur, cur, 32) & DASMFLAG_LENGTHMASK;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,4 +313,5 @@ static void reset_log(x86log_context *log)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#define i386_dasm_one x86log_i386_dasm_one
|
#define i386_dasm_one x86log_i386_dasm_one
|
||||||
|
#define i386_dasm_one_ex x86log_i386_dasm_one_ex
|
||||||
#include "cpu/i386/i386dasm.c"
|
#include "cpu/i386/i386dasm.c"
|
||||||
|
Loading…
Reference in New Issue
Block a user