Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit 605e00e

Browse files
authored
Merge pull request #1617 from davidgfnet/x64imp
Cleanup and unify x64 asm implementation
2 parents 76e0b5c + a9fe901 commit 605e00e

File tree

11 files changed

+98
-212
lines changed

11 files changed

+98
-212
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ if(${FEAT_SHREC} EQUAL ${DYNAREC_JIT})
9292
)
9393
elseif(${HOST_CPU} EQUAL ${CPU_X64})
9494

95-
### FIXME: asm with cmake ninja+VC
96-
if(${BUILD_COMPILER} EQUAL ${COMPILER_VC})
97-
list(APPEND core_SRCS ${d_core}/rec-x64/msvc.asm)
98-
endif()
99-
10095
list(APPEND core_SRCS ${d_core}/rec-x64/rec_x64.cpp ${d_core}/rec-x64/x64_regalloc.h)
10196

10297
elseif(${HOST_CPU} EQUAL ${CPU_A64})

core/hw/sh4/dyna/driver.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ uintptr_t cc_rx_offset;
3838
u32 LastAddr;
3939
u32 LastAddr_min;
4040
u32* emit_ptr=0;
41+
MainloopFnPtr_t mainloop_function;
4142

4243
void* emit_GetCCPtr() { return emit_ptr==0?(void*)&CodeCache[LastAddr]:(void*)emit_ptr; }
4344
void emit_SetBaseAddr() { LastAddr_min = LastAddr; }
@@ -88,7 +89,7 @@ void recSh4_Run()
8889
printf("Warning: SMC check mode is %d\n", settings.dynarec.SmcCheckLevel);
8990

9091
verify(rcb_noffs(&next_pc)==-184);
91-
ngen_mainloop(sh4_dyna_rcb);
92+
mainloop_function(sh4_dyna_rcb);
9293

9394
#if !defined(TARGET_BOUNDED_EXECUTION)
9495
sh4_int_bCpuRun=false;
@@ -417,10 +418,6 @@ void recSh4_Reset(bool Manual)
417418
Sh4_int_Reset(Manual);
418419
}
419420

420-
#if HOST_OS == OS_DARWIN
421-
#include <sys/mman.h>
422-
#endif
423-
424421
void recSh4_Init()
425422
{
426423
printf("recSh4 Init\n");
@@ -453,7 +450,7 @@ void recSh4_Init()
453450
verify(CodeCache != NULL);
454451

455452
memset(CodeCache, 0xFF, CODE_SIZE);
456-
ngen_init();
453+
mainloop_function = ngen_init();
457454
bm_Reset();
458455
}
459456

core/hw/sh4/dyna/ngen.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ u32 DYNACALL rdv_DoInterrupts_pc(u32 pc);
9595

9696
//Stuff to be implemented per dynarec core
9797

98-
void ngen_init();
98+
typedef void (*MainloopFnPtr_t) (void*);
99+
MainloopFnPtr_t ngen_init();
99100

100101
//Called to compile a block
101102
void ngen_Compile(RuntimeBlockInfo* block, SmcCheckEnum smc_checks, bool reset, bool staging,bool optimise);
@@ -105,8 +106,6 @@ void ngen_ResetBlocks();
105106
//Value to be returned when the block manager failed to find a block,
106107
//should call rdv_FailedToFindBlock and then jump to the return value
107108
extern void (*ngen_FailedToFindBlock)();
108-
//the dynarec mainloop
109-
void ngen_mainloop(void* cntx);
110109

111110
void ngen_GetFeatures(ngen_features* dst);
112111

core/rec-ARM/rec_arm.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,10 @@ void ngen_ResetBlocks()
22742274
add
22752275
str
22762276
*/
2277-
void ngen_init()
2277+
2278+
extern "C" void ngen_mainloop(void*);
2279+
2280+
MainloopFnPtr_t ngen_init()
22782281
{
22792282
printf("Initializing the ARM32 dynarec\n");
22802283
verify(FPCB_OFFSET == -0x2100000 || FPCB_OFFSET == -0x4100000);
@@ -2372,6 +2375,7 @@ void ngen_init()
23722375
//ccmap[shop_fseteq]=CC_EQ;
23732376
//ccmap[shop_fsetgt]=CC_GT;
23742377

2378+
return &ngen_mainloop;
23752379
}
23762380

23772381

core/rec-ARM64/rec_arm64.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ __asm__
122122
"br x0 \n"
123123
);
124124

125-
void ngen_mainloop(void* v_cntx)
125+
void rec_mainloop(void* v_cntx)
126126
{
127127
Sh4RCB* ctx = (Sh4RCB*)((u8*)v_cntx - sizeof(Sh4RCB));
128128

@@ -202,10 +202,11 @@ void ngen_mainloop(void* v_cntx)
202202
);
203203
}
204204

205-
void ngen_init()
205+
MainloopFnPtr_t ngen_init()
206206
{
207207
printf("Initializing the ARM64 dynarec\n");
208208
ngen_FailedToFindBlock = &ngen_FailedToFindBlock_;
209+
return &rec_mainloop;
209210
}
210211

211212
void ngen_ResetBlocks()

core/rec-cpp/rec_cpp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct DynaRBI : RuntimeBlockInfo
3636
int cycle_counter;
3737
extern int mips_counter;
3838

39-
void ngen_mainloop(void* v_cntx)
39+
void rec_mainloop(void* v_cntx)
4040
{
4141
Sh4RCB* ctx = (Sh4RCB*)((u8*)v_cntx - sizeof(Sh4RCB));
4242

@@ -59,8 +59,9 @@ void ngen_mainloop(void* v_cntx)
5959
}
6060
}
6161

62-
void ngen_init()
62+
MainloopFnPtr_t ngen_init()
6363
{
64+
return &rec_mainloop;
6465
}
6566

6667
void ngen_GetFeatures(ngen_features* dst)

core/rec-x64/msvc.asm

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)