Skip to content

Commit 774df57

Browse files
committed
JIT: enabled udis86 logging
1 parent d62da37 commit 774df57

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

libudis86/include/udis86.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#ifndef UDIS86_H
2727
#define UDIS86_H
2828

29-
#include "libudis86/types.h"
30-
#include "libudis86/extern.h"
31-
#include "libudis86/itab.h"
29+
#include "../src/types.h"
30+
#include "../src/extern.h"
31+
#include "../src/itab.h"
3232

3333
#endif

src/jit/codegen_udis86.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
if (dSize > 0) { \
1818
uint8_t* p = (uint8_t*)(udis_func); \
1919
for ( ; dSize && (!p[dSize-1] || (0x90 == p[dSize-1])); --dSize) ; /* Find ending */ \
20-
JITLOG("Disassembling %s (size %u bytes) @ 0x%p:", #udis_func, dSize, p) \
20+
jit_log("Disassembling %s (size %u bytes) @ 0x%p:", #udis_func, dSize, p) \
2121
for (int i = 0; i < dSize; i += 0x10) { \
2222
write_log("%08x ", i); \
2323
for (int j = 0; j < 16; ++j) \
@@ -31,10 +31,10 @@
3131
ud_set_syntax(&ud_obj, UD_SYN_INTEL); \
3232
while (dSize > 0) { \
3333
dSize -= ud_disassemble(&ud_obj); \
34-
JITLOG(" [x86] %s", ud_insn_asm(&ud_obj)); \
34+
jit_log(" [x86] %s", ud_insn_asm(&ud_obj)); \
3535
} \
3636
} else \
37-
JITLOG("Can't dissassemble %s, start (0x%08lx) is larger than end (0x%08lx)", \
37+
jit_log("Can't dissassemble %s, start (0x%08lx) is larger than end (0x%08lx)", \
3838
#udis_func, (uintptr_t)udis_func, (uintptr_t)udis_end); \
3939
}
4040

src/jit/codegen_x86.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -3360,6 +3360,11 @@ cpuid(uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32 *edx)
33603360
raw_pop_l_r(1);
33613361
raw_pop_l_r(0);
33623362
raw_ret();
3363+
#ifdef USE_UDIS86
3364+
if (!op) { /* Only disassemble once! */
3365+
UDISFN(cpuid_space, target)
3366+
}
3367+
#endif
33633368
set_target(tmp);
33643369

33653370
((compop_func*)cpuid_space)(0);

src/jit/compemu_support.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@
8282
#include "comptbl.h"
8383
#ifdef UAE
8484
#include "compemu.h"
85+
#ifdef FSUAE
86+
#include "codegen_udis86.h"
87+
#endif
8588
#else
8689
#include "compiler/compemu.h"
8790
#include "fpu/fpu.h"
@@ -3648,6 +3651,9 @@ static inline void create_popalls(void)
36483651

36493652
#ifdef UAE
36503653
/* FIXME: write-protect popallspace? */
3654+
#ifdef USE_UDIS86
3655+
UDISFN(pushall_call_handler, get_target());
3656+
#endif
36513657
#else
36523658
// no need to further write into popallspace
36533659
vm_protect(popallspace, POPALLSPACE_SIZE, VM_PAGE_READ | VM_PAGE_EXECUTE);
@@ -4552,6 +4558,10 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles)
45524558
align_target(align_jumps);
45534559
current_compile_p=get_target();
45544560

4561+
#ifdef USE_UDIS86
4562+
UDISFN(current_block_start_target, target)
4563+
#endif
4564+
45554565
raise_in_cl_list(bi);
45564566
bi->nexthandler=current_compile_p;
45574567

0 commit comments

Comments
 (0)