Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/dynarec/arm64/dynarec_arm64_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ int Table64(dynarec_arm_t *dyn, uint64_t val, int pass); // add a value to tabl

void CreateJmpNext(void* addr, void* next);

// TODO: Save and restore the temp register.
#define SAVE_ACTIVE_SCRATCH_REGISTERS do{} while(0);
#define LOAD_ACTIVE_SCRATCH_REGISTERS do{} while(0);

#define GO_TRACE(A, B, s0) \
GETIP(addr); \
MOVx_REG(x1, xRIP); \
Expand Down
2 changes: 2 additions & 0 deletions src/dynarec/dynarec_native_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,11 @@ uintptr_t native_pass(dynarec_native_t* dyn, uintptr_t addr, int alternate, int
if((trace_end == 0)
|| ((ip >= trace_start) && (ip < trace_end))) {
MESSAGE(LOG_DUMP, "TRACE ----\n");
if (BOX64ENV(dynarec_nativeflags)) SAVE_ACTIVE_SCRATCH_REGISTERS;
fpu_reflectcache(dyn, ninst, x1, x2, x3);
GO_TRACE(PrintTrace, 1, x5);
fpu_unreflectcache(dyn, ninst, x1, x2, x3);
if (BOX64ENV(dynarec_nativeflags)) LOAD_ACTIVE_SCRATCH_REGISTERS;
MESSAGE(LOG_DUMP, "----------\n");
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/dynarec/la64/dynarec_la64_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ int Table64(dynarec_la64_t *dyn, uint64_t val, int pass); // add a value to tab

void CreateJmpNext(void* addr, void* next);

// TODO: Save and restore the temp register.
#define SAVE_ACTIVE_SCRATCH_REGISTERS do{} while(0);
#define LOAD_ACTIVE_SCRATCH_REGISTERS do{} while(0);

#define GO_TRACE(A, B, s0) \
GETIP(addr, s0); \
MV(x1, xRIP); \
Expand Down
4 changes: 4 additions & 0 deletions src/dynarec/ppc64le/dynarec_ppc64le_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ int Table64(dynarec_ppc64le_t *dyn, uint64_t val, int pass); // add a value to

void CreateJmpNext(void* addr, void* next);

// TODO: Save and restore the temp register.
#define SAVE_ACTIVE_SCRATCH_REGISTERS do{} while(0);
#define LOAD_ACTIVE_SCRATCH_REGISTERS do{} while(0);

#define GO_TRACE(A, B, s0) \
GETIP(addr, s0); \
MV(x1, xRIP); \
Expand Down
26 changes: 26 additions & 0 deletions src/dynarec/rv64/dynarec_rv64_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,32 @@ int Table64(dynarec_rv64_t *dyn, uint64_t val, int pass); // add a value to tab

void CreateJmpNext(void* addr, void* next);

#define SAVE_ACTIVE_SCRATCH_REGISTERS \
do { \
uint8_t n1 = dyn->insts[ninst].nat_flags_op1; \
uint8_t n2 = dyn->insts[ninst].nat_flags_op2; \
if (IS_SCRATCH(n1) || IS_SCRATCH(n2)) { \
SUBI(xSP, xSP, 16); \
if (IS_SCRATCH(n1)) \
SD(n1, xSP, 0); \
if (n1 != n2 && IS_SCRATCH(n2)) \
SD(n2, xSP, 8); \
} \
} while(0);

#define LOAD_ACTIVE_SCRATCH_REGISTERS \
do { \
uint8_t n1 = dyn->insts[ninst].nat_flags_op1; \
uint8_t n2 = dyn->insts[ninst].nat_flags_op2; \
if (IS_SCRATCH(n1) || IS_SCRATCH(n2)) { \
if (IS_SCRATCH(n1)) \
LD(n1, xSP, 0); \
if (n1 != n2 && IS_SCRATCH(n2)) \
LD(n2, xSP, 8); \
ADDI(xSP, xSP, 16); \
} \
} while(0);

#define GO_TRACE(A, B, s0) \
GETIP(addr, s0); \
MV(x1, xRIP); \
Expand Down
1 change: 1 addition & 0 deletions src/dynarec/rv64/rv64_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ x31 t6 x6 Temporary Scratch
// convert a x86 register to native according to the register mapping
#define TO_NAT(A) (((uint8_t[]) { 16, 13, 12, 24, 9, 8, 11, 10, 14, 15, 26, 27, 18, 19, 20, 21 })[(A)])
#define IS_GPR(A) (((uint8_t[]) { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0 })[(A)])
#define IS_SCRATCH(A) (((uint8_t[]) { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 })[(A)])

#define x1 6
#define x2 7
Expand Down
Loading