Skip to content

Commit

Permalink
fix build without dynarec
Browse files Browse the repository at this point in the history
  • Loading branch information
flyinghead committed Dec 14, 2024
1 parent 667e390 commit ecd0305
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 8 deletions.
5 changes: 5 additions & 0 deletions core/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
#define HOST_CPU CPU_GENERIC
#endif

#if defined(TARGET_IPHONE) && !defined(__aarch64__)
// iOS simulator
#define TARGET_NO_REC
#endif

#if defined(TARGET_NO_REC)
#define FEAT_SHREC DYNAREC_NONE
#define FEAT_AREC DYNAREC_NONE
Expand Down
20 changes: 18 additions & 2 deletions core/hw/sh4/dyna/blockmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,31 @@ void bm_Init();
void bm_Term();

void bm_vmem_pagefill(void** ptr,u32 size_bytes);
bool bm_RamWriteAccess(void *p);
void bm_RamWriteAccess(u32 addr);
static inline bool bm_IsRamPageProtected(u32 addr)
{
extern bool unprotected_pages[RAM_SIZE_MAX/PAGE_SIZE];
addr &= RAM_MASK;
return !unprotected_pages[addr / PAGE_SIZE];
}

#if FEAT_SHREC != DYNAREC_NONE

bool bm_RamWriteAccess(void *p);
void bm_RamWriteAccess(u32 addr);
void bm_LockPage(u32 addr, u32 size = PAGE_SIZE);
void bm_UnlockPage(u32 addr, u32 size = PAGE_SIZE);
u32 bm_getRamOffset(void *p);

#else

inline static bool bm_RamWriteAccess(void *p) {
return false;
}
inline static void bm_RamWriteAccess(u32 addr) {}
inline static void bm_LockPage(u32 addr, u32 size = PAGE_SIZE) {}
inline static void bm_UnlockPage(u32 addr, u32 size = PAGE_SIZE) {}
inline static u32 bm_getRamOffset(void *p) {
return 0;
}

#endif
4 changes: 2 additions & 2 deletions core/hw/sh4/dyna/decoder_opcodes.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#pragma once
#if FEAT_SHREC != DYNAREC_NONE
#define sh4dec(str) void dec_##str (u32 op)
void dec_illegalOp(u32 op);
#else
#define sh4dec(str) static void dec_##str (u32 op) { }
inline static void dec_illegalOp(u32 op) {}
#endif

sh4dec(i1000_1011_iiii_iiii);
Expand Down Expand Up @@ -33,5 +35,3 @@ sh4dec(i0100_nnnn_0110_1010);
sh4dec(i0100_nnnn_0110_0110);
sh4dec(i0100_nnnn_0001_1011);
sh4dec(i0100_nnnn_0000_0011);

void dec_illegalOp(u32 op);
7 changes: 4 additions & 3 deletions core/hw/sh4/dyna/shil.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#include <sstream>

#include "types.h"
#if FEAT_SHREC != DYNAREC_NONE
#include "hw/sh4/sh4_mem.h"
#include "hw/sh4/sh4_mmr.h"

#include "ngen.h"
#include "ssa.h"
#include <sstream>

void AnalyseBlock(RuntimeBlockInfo* blk)
{
Expand Down Expand Up @@ -180,3 +179,5 @@ const char* shil_opcode_name(int op)
{
return shilop_str[op];
}

#endif // FEAT_SHREC != DYNAREC_NONE
3 changes: 3 additions & 0 deletions core/hw/sh4/dyna/ssa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
You should have received a copy of the GNU General Public License
along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "build.h"
#if FEAT_SHREC != DYNAREC_NONE
#include "blockmanager.h"
#include "ssa.h"

Expand Down Expand Up @@ -369,3 +371,4 @@ bool SSAOptimizer::ExecuteConstOp(shil_opcode* op)
return false;
}
}
#endif // FEAT_SHREC != DYNAREC_NONE
2 changes: 1 addition & 1 deletion core/linux/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ void fault_handler(int sn, siginfo_t * si, void *segfault_ctx)
// texture protection in VRAM
if (VramLockedWrite((u8*)si->si_addr))
return;
#if FEAT_SHREC == DYNAREC_JIT
// FPCB jump table protection
if (addrspace::bm_lockedWrite((u8*)si->si_addr))
return;

#if FEAT_SHREC == DYNAREC_JIT
// fast mem access rewriting
host_context_t ctx;
context_from_segfault(&ctx, segfault_ctx);
Expand Down
2 changes: 2 additions & 0 deletions core/ui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2804,6 +2804,7 @@ static void gui_settings_network()

static void gui_settings_advanced()
{
#if FEAT_SHREC != DYNAREC_NONE
header("CPU Mode");
{
ImGui::Columns(2, "cpu_modes", false);
Expand All @@ -2819,6 +2820,7 @@ static void gui_settings_advanced()
"%d MHz");
}
ImGui::Spacing();
#endif
header("Other");
{
OptionCheckbox("HLE BIOS", config::UseReios, "Force high-level BIOS emulation");
Expand Down
2 changes: 2 additions & 0 deletions core/windows/fault_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ static LONG WINAPI exceptionHandler(EXCEPTION_POINTERS *ep)
// texture protection in VRAM
if (VramLockedWrite(address))
return EXCEPTION_CONTINUE_EXECUTION;
#if FEAT_SHREC == DYNAREC_JIT
// FPCB jump table protection
if (addrspace::bm_lockedWrite(address))
return EXCEPTION_CONTINUE_EXECUTION;
#endif

host_context_t context;
readContext(ep, context);
Expand Down

0 comments on commit ecd0305

Please sign in to comment.