Fix TARGET_NO_NVMEM and deprecate TARGET_NO_EXCEPTIONS

Linked them both toghether since you can't really define one and
not the other (plus Linux honors one windows the other in some
cases).
More refactoring on this area to follow.
This commit is contained in:
David Guillen Fandos 2019-05-10 18:57:28 +02:00
parent afcd7a08a3
commit be1ecbaa8b
7 changed files with 18 additions and 19 deletions

View File

@ -440,7 +440,7 @@ void _vmem_bm_reset() {
if (!virt_ram_base)
#endif
{
bm_vmem_pagefill((void**)p_sh4rcb->fpcb, FPCB_SIZE);
bm_vmem_pagefill((void**)p_sh4rcb->fpcb, sizeof(p_sh4rcb->fpcb));
}
}

View File

@ -339,9 +339,9 @@ void bm_Rebuild()
rebuild_counter=30;
}
void bm_vmem_pagefill(void** ptr,u32 PAGE_SZ)
void bm_vmem_pagefill(void** ptr, u32 size_bytes)
{
for (size_t i=0; i<PAGE_SZ/sizeof(ptr[0]); i++)
for (size_t i=0; i < size_bytes / sizeof(ptr[0]); i++)
{
ptr[i]=(void*)ngen_FailedToFindBlock;
}

View File

@ -34,7 +34,7 @@
#include "hw/sh4/dyna/ngen.h"
#if !defined(TARGET_NO_EXCEPTIONS)
#if !defined(TARGET_NO_NVMEM)
bool ngen_Rewrite(unat& addr,unat retadr,unat acc);
u32* ngen_readm_fail_v2(u32* ptr,u32* regs,u32 saddr);
bool VramLockedWrite(u8* address);
@ -57,7 +57,6 @@ void sigill_handler(int sn, siginfo_t * si, void *segfault_ctx) {
}
#endif
#if !defined(TARGET_NO_EXCEPTIONS)
void fault_handler (int sn, siginfo_t * si, void *segfault_ctx)
{
rei_host_context_t ctx;
@ -108,12 +107,9 @@ void fault_handler (int sn, siginfo_t * si, void *segfault_ctx)
signal(SIGSEGV, SIG_DFL);
}
}
#endif
#endif
void install_fault_handler (void)
void install_fault_handler(void)
{
#if !defined(TARGET_NO_EXCEPTIONS)
struct sigaction act, segv_oact;
memset(&act, 0, sizeof(act));
act.sa_sigaction = fault_handler;
@ -127,14 +123,17 @@ void install_fault_handler (void)
act.sa_sigaction = sigill_handler;
sigaction(SIGILL, &act, &segv_oact);
#endif
#endif
}
#else // !defined(TARGET_NO_NVMEM)
// No exceptions/nvmem dummy handlers.
void install_fault_handler(void) {}
#endif // !defined(TARGET_NO_NVMEM)
#include <errno.h>
void VArray2::LockRegion(u32 offset,u32 size)
{
#if !defined(TARGET_NO_EXCEPTIONS)
#if !defined(TARGET_NO_NVMEM)
u32 inpage=offset & PAGE_MASK;
u32 rv=mprotect (data+offset-inpage, size+inpage, PROT_READ );
if (rv!=0)
@ -185,7 +184,7 @@ void print_mem_addr()
void VArray2::UnLockRegion(u32 offset,u32 size)
{
#if !defined(TARGET_NO_EXCEPTIONS)
#if !defined(TARGET_NO_NVMEM)
u32 inpage=offset & PAGE_MASK;
u32 rv=mprotect (data+offset-inpage, size+inpage, PROT_READ | PROT_WRITE);
if (rv!=0)

View File

@ -8,7 +8,7 @@
#define __USE_GNU 1
#endif
#if !defined(TARGET_NO_EXCEPTIONS)
#if !defined(TARGET_NO_NVMEM)
#include <ucontext.h>
#endif
#endif
@ -29,7 +29,7 @@ void bicopy(Ta& rei, Tb& seg, bool to_segfault) {
void context_segfault(rei_host_context_t* reictx, void* segfault_ctx, bool to_segfault) {
#if !defined(TARGET_NO_EXCEPTIONS)
#if !defined(TARGET_NO_NVMEM)
#if HOST_CPU == CPU_ARM
#if defined(__FreeBSD__)
bicopy(reictx->pc, MCTX(.__gregs[_REG_PC]), to_segfault);

View File

@ -343,7 +343,7 @@ if (TARGET_NSW) # -DCMAKE_TOOLCHAIN_FILE=./cmake/devkitA64.cmake -DTARGET_NSW=ON
message("HOST_OS ${HOST_OS}")
add_definitions(-D__SWITCH__ -DGLES -DMESA_EGL_NO_X11_HEADERS)
add_definitions(-DTARGET_NO_THREADS -DTARGET_NO_EXCEPTIONS -DTARGET_NO_NIXPROF)
add_definitions(-DTARGET_NO_THREADS -DTARGET_NO_NVMEM -DTARGET_NO_NIXPROF)
add_definitions(-DTARGET_NO_COREIO_HTTP -DTARGET_NO_WEBUI -UTARGET_SOFTREND)
add_definitions(-D_GLIBCXX_USE_C99_MATH_TR1 -D_LDBL_EQ_DBL)
@ -355,7 +355,7 @@ if (TARGET_PS4) # -DCMAKE_TOOLCHAIN_FILE=./cmake/{ps4sdk,clang_scei}.cmake -DTAR
add_definitions(-DPS4 -DTARGET_PS4 -DTARGET_BSD -D__ORBIS__ -DGLES -DMESA_EGL_NO_X11_HEADERS) ## last needed for __unix__ on eglplatform.h
add_definitions(-DTARGET_NO_THREADS -DTARGET_NO_EXCEPTIONS -DTARGET_NO_NIXPROF)
add_definitions(-DTARGET_NO_THREADS -DTARGET_NO_NVMEM -DTARGET_NO_NIXPROF)
add_definitions(-DTARGET_NO_COREIO_HTTP -DTARGET_NO_WEBUI -UTARGET_SOFTREND)

View File

@ -26,7 +26,7 @@ LDFLAGS := -Wl,-Map,$(notdir $@).map,--gc-sections -Wl,-O3 -Wl,--sort-common
CXXONLYFLAGS := -std=c++11
CXXFLAGS := -O3 -D GLES -D RELEASE -c -D TARGET_EMSCRIPTEN -D TARGET_NO_REC -D TARGET_NO_NVMEM -D TARGET_NO_WEBUI -D TARGET_NO_THREADS -D TARGET_BOUNDED_EXECUTION -D TARGET_NO_EXCEPTIONS -D TARGET_NO_COREIO_HTTP
CXXFLAGS := -O3 -D GLES -D RELEASE -c -D TARGET_EMSCRIPTEN -D TARGET_NO_REC -D TARGET_NO_NVMEM -D TARGET_NO_WEBUI -D TARGET_NO_THREADS -D TARGET_BOUNDED_EXECUTION -D TARGET_NO_COREIO_HTTP
CXXFLAGS += -fno-strict-aliasing
CXXFLAGS += -ffast-math

View File

@ -23,7 +23,7 @@ CFLAGS = -Wno-error -Wno-ignored-attributes
CFLAGS += -O3 -fno-strict-aliasing -ffast-math
CFLAGS += -I$(RZDCY_SRC_DIR) -I$(RZDCY_SRC_DIR)/deps
CFLAGS += -D RELEASE -D TARGET_NO_JIT -D TARGET_NACL32 -DGLES
CFLAGS += -D TARGET_NO_EXCEPTIONS -D TARGET_NO_NVMEM -D TARGET_NO_WEBUI -D TARGET_NO_COREIO_HTTP
CFLAGS += -D TARGET_NO_NVMEM -D TARGET_NO_WEBUI -D TARGET_NO_COREIO_HTTP
SOURCES = $(RZDCY_FILES) ../../core/nacl/nacl.cpp
@ -49,4 +49,4 @@ endif
SHELL = sh
$(eval $(call NMF_RULE,$(TARGET),))
$(eval $(call NMF_RULE,$(TARGET),))