From 1cc3490f51ed3876b76e0a6f863ddb217ff88fab Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 13 Mar 2021 11:37:13 +0100 Subject: [PATCH] Remove HOST_OS references --- core/build.h | 20 -------------------- core/hw/aica/dsp_x64.cpp | 2 +- core/hw/aica/dsp_x86.cpp | 2 +- core/hw/arm7/arm7_rec.cpp | 6 ++---- core/hw/sh4/dyna/blockmanager.cpp | 2 +- core/hw/sh4/dyna/driver.cpp | 2 +- core/hw/sh4/modules/serial.cpp | 4 ++-- core/linux-dist/main.cpp | 2 +- core/linux/common.cpp | 4 ++-- core/linux/context.cpp | 12 ++++++------ core/linux/posix_vmem.cpp | 2 +- core/rend/gui.cpp | 2 +- core/rend/gui_util.cpp | 2 +- 13 files changed, 20 insertions(+), 42 deletions(-) diff --git a/core/build.h b/core/build.h index ab5cde624..901f2e6e0 100755 --- a/core/build.h +++ b/core/build.h @@ -131,20 +131,6 @@ #define DC_PLATFORM_HIKARU 5 /* Needs to be done, 2xsh4, 2x aica , custom vpu */ #define DC_PLATFORM_AURORA 6 /* Needs to be done, Uses newer 300 mhz sh4 + 150 mhz pvr mbx SoC */ - - -//HOST_OS -#define OS_WINDOWS 0x10000001 -#define OS_LINUX 0x10000002 -#define OS_DARWIN 0x10000003 -#define OS_IOS 0x10000004 -#define OS_ANDROID 0x10000005 - -#define OS_UWP 0x10000011 -#define OS_NSW_HOS 0x80000001 -#define OS_PS4_BSD 0x80000002 - - //HOST_CPU #define CPU_X86 0x20000001 #define CPU_ARM 0x20000002 @@ -178,12 +164,6 @@ #define HOST_CPU CPU_GENERIC #endif -#if defined(__APPLE__) - #define HOST_OS OS_DARWIN -#elif defined(__unix__) - #define HOST_OS OS_LINUX -#endif - #if defined(TARGET_NO_REC) #define FEAT_SHREC DYNAREC_NONE #define FEAT_AREC DYNAREC_NONE diff --git a/core/hw/aica/dsp_x64.cpp b/core/hw/aica/dsp_x64.cpp index 3c660261a..6daf1bed8 100644 --- a/core/hw/aica/dsp_x64.cpp +++ b/core/hw/aica/dsp_x64.cpp @@ -34,7 +34,7 @@ alignas(4096) static u8 CodeBuffer[32 * 1024] #if defined(_WIN32) ; -#elif HOST_OS == OS_LINUX +#elif defined(__unix__) __attribute__((section(".text"))); #elif defined(__APPLE__) __attribute__((section("__TEXT,.text"))); diff --git a/core/hw/aica/dsp_x86.cpp b/core/hw/aica/dsp_x86.cpp index 3c293c9f2..a6dd29f78 100644 --- a/core/hw/aica/dsp_x86.cpp +++ b/core/hw/aica/dsp_x86.cpp @@ -35,7 +35,7 @@ alignas(4096) static u8 CodeBuffer[32 * 1024] #if defined(_WIN32) ; -#elif HOST_OS == OS_LINUX +#elif defined(__unix__) __attribute__((section(".text"))); #elif defined(__APPLE__) __attribute__((section("__TEXT,.text"))); diff --git a/core/hw/arm7/arm7_rec.cpp b/core/hw/arm7/arm7_rec.cpp index 394d74a8c..122043b23 100644 --- a/core/hw/arm7/arm7_rec.cpp +++ b/core/hw/arm7/arm7_rec.cpp @@ -51,11 +51,9 @@ void (*EntryPoints[ARAM_SIZE_MAX / 4])(); #ifdef _WIN32 alignas(4096) static u8 ARM7_TCB[ICacheSize]; -#elif HOST_OS == OS_LINUX - +#elif defined(__unix__) alignas(4096) static u8 ARM7_TCB[ICacheSize] __attribute__((section(".text"))); - -#elif HOST_OS==OS_DARWIN +#elif defined(__APPLE__) alignas(4096) static u8 ARM7_TCB[ICacheSize] __attribute__((section("__TEXT, .text"))); #else #error ARM7_TCB ALLOC diff --git a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp index 6d751b2a6..a1a4b7e12 100644 --- a/core/hw/sh4/dyna/blockmanager.cpp +++ b/core/hw/sh4/dyna/blockmanager.cpp @@ -15,7 +15,7 @@ #include "hw/sh4/sh4_sched.h" -#if HOST_OS==OS_LINUX && defined(DYNA_OPROF) +#if defined(__unix__) && defined(DYNA_OPROF) #include op_agent_t oprofHandle; #endif diff --git a/core/hw/sh4/dyna/driver.cpp b/core/hw/sh4/dyna/driver.cpp index b3adb8b1d..3be32518e 100644 --- a/core/hw/sh4/dyna/driver.cpp +++ b/core/hw/sh4/dyna/driver.cpp @@ -24,7 +24,7 @@ u8 SH4_TCB[CODE_SIZE + TEMP_CODE_SIZE + 4096] #if defined(_WIN32) || FEAT_SHREC != DYNAREC_JIT ; -#elif HOST_OS == OS_LINUX +#elif defined(__unix__) __attribute__((section(".text"))); #elif defined(__APPLE__) __attribute__((section("__TEXT,.text"))); diff --git a/core/hw/sh4/modules/serial.cpp b/core/hw/sh4/modules/serial.cpp index db4be916e..3f9b987c1 100644 --- a/core/hw/sh4/modules/serial.cpp +++ b/core/hw/sh4/modules/serial.cpp @@ -78,7 +78,7 @@ static void SerialWrite(u32 addr, u32 data) //SCIF_SCFSR2 read static u32 ReadSerialStatus(u32 addr) { -#if HOST_OS == OS_LINUX || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) int count = 0; if (config::SerialConsole && tty != 1 && ioctl(tty, FIONREAD, &count) == 0 && count > 0) @@ -169,7 +169,7 @@ void serial_init() //SCIF SCLSR2 0xFFE80024 0x1FE80024 16 0x0000 0x0000 Held Held Pclk sh4_rio_reg(SCIF,SCIF_SCLSR2_addr,RIO_DATA,16); -#if HOST_OS == OS_LINUX || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) if (config::SerialConsole && config::SerialPTY) { tty = open("/dev/ptmx", O_RDWR | O_NDELAY | O_NOCTTY | O_NONBLOCK); diff --git a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp index 96016fe74..3696fa826 100644 --- a/core/linux-dist/main.cpp +++ b/core/linux-dist/main.cpp @@ -1,6 +1,6 @@ #include "types.h" -#if HOST_OS==OS_LINUX +#if defined(__unix__) #include "hw/sh4/dyna/blockmanager.h" #include "log/LogManager.h" #include "emulator.h" diff --git a/core/linux/common.cpp b/core/linux/common.cpp index 9a531374b..7f68b2aa1 100644 --- a/core/linux/common.cpp +++ b/core/linux/common.cpp @@ -1,6 +1,6 @@ #include "types.h" -#if HOST_OS==OS_LINUX || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) #if defined(__APPLE__) #define _XOPEN_SOURCE 1 #define __USE_GNU 1 @@ -136,7 +136,7 @@ double os_GetSeconds() void os_DebugBreak() { __asm__("trap"); } -#elif HOST_OS != OS_LINUX +#elif !defined(__unix__) void os_DebugBreak() { __builtin_trap(); diff --git a/core/linux/context.cpp b/core/linux/context.cpp index 293b899fa..09334a334 100644 --- a/core/linux/context.cpp +++ b/core/linux/context.cpp @@ -37,7 +37,7 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx) for (int i = 0; i < 15; i++) bicopy(hostctx->reg[i], MCTX(.__gregs[i])); - #elif HOST_OS == OS_LINUX + #elif defined(__unix__) bicopy(hostctx->pc, MCTX(.arm_pc)); u32* reg =(u32*) &MCTX(.arm_r0); @@ -50,7 +50,7 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx) for (int i = 0; i < 15; i++) bicopy(hostctx->reg[i], MCTX(->__ss.__r[i])); #else - #error HOST_OS + #error "Unsupported OS" #endif #elif HOST_CPU == CPU_ARM64 #if defined(__APPLE__) @@ -68,7 +68,7 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx) bicopy(hostctx->esp, MCTX(.mc_esp)); bicopy(hostctx->eax, MCTX(.mc_eax)); bicopy(hostctx->ecx, MCTX(.mc_ecx)); - #elif HOST_OS == OS_LINUX + #elif defined(__unix__) bicopy(hostctx->pc, MCTX(.gregs[REG_EIP])); bicopy(hostctx->esp, MCTX(.gregs[REG_ESP])); bicopy(hostctx->eax, MCTX(.gregs[REG_EAX])); @@ -79,7 +79,7 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx) bicopy(hostctx->eax, MCTX(->__ss.__eax)); bicopy(hostctx->ecx, MCTX(->__ss.__ecx)); #else - #error HOST_OS + #error "Unsupported OS" #endif #elif HOST_CPU == CPU_X64 #if defined(__FreeBSD__) || defined(__DragonFly__) @@ -89,7 +89,7 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx) bicopy(hostctx->rsp, MCTX(.__gregs[REG_RSP])); bicopy(hostctx->r9, MCTX(.__gregs[REG_R9])); bicopy(hostctx->rdi, MCTX(.__gregs[REG_RDI])); - #elif HOST_OS == OS_LINUX + #elif defined(__unix__) bicopy(hostctx->pc, MCTX(.gregs[REG_RIP])); bicopy(hostctx->rsp, MCTX(.gregs[REG_RSP])); bicopy(hostctx->r9, MCTX(.gregs[REG_R9])); @@ -100,7 +100,7 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx) bicopy(hostctx->r9, MCTX(->__ss.__r9)); bicopy(hostctx->rdi, MCTX(->__ss.__rdi)); #else - #error HOST_OS + #error "Unsupported OS" #endif #elif HOST_CPU == CPU_MIPS bicopy(hostctx->pc, MCTX(.pc)); diff --git a/core/linux/posix_vmem.cpp b/core/linux/posix_vmem.cpp index 5c8b258dc..13a47bdf4 100644 --- a/core/linux/posix_vmem.cpp +++ b/core/linux/posix_vmem.cpp @@ -346,7 +346,7 @@ void vmem_platform_flush_cache(void *icache_start, void *icache_end, void *dcach #elif HOST_CPU == CPU_ARM -#if HOST_OS == OS_DARWIN +#if defined(__APPLE__) #include static void CacheFlush(void* code, void* pEnd) diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index a570652a3..a9969855c 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -1552,7 +1552,7 @@ static void gui_display_settings() ImGui::Text("Operating System: %s", #ifdef __ANDROID__ "Android" -#elif HOST_OS == OS_LINUX +#elif defined(__unix__) "Linux" #elif defined(__APPLE__) #ifdef TARGET_IPHONE diff --git a/core/rend/gui_util.cpp b/core/rend/gui_util.cpp index 691238fc4..eefaca878 100644 --- a/core/rend/gui_util.cpp +++ b/core/rend/gui_util.cpp @@ -57,7 +57,7 @@ void select_directory_popup(const char *prompt, float scaling, StringCallback ca else select_current_directory = home; } -#elif HOST_OS == OS_LINUX || defined(__APPLE__) +#elif defined(__unix__) || defined(__APPLE__) const char *home = nowide::getenv("HOME"); if (home != NULL) select_current_directory = home;