From 387f4a4019e6201fd12d92c71bd7c09154f8c3aa Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Mon, 10 Oct 2022 10:03:39 -0700 Subject: [PATCH] Match and link OSSync Former-commit-id: 9203a4e0bc1ae47cf0fe8fda562ccdd5fd2012d9 --- configure.py | 2 +- libc/stddef.h | 8 +++++--- obj_files.mk | 2 +- src/Dolphin/os/OSSync.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 src/Dolphin/os/OSSync.c diff --git a/configure.py b/configure.py index 05e2070e..8cd3e130 100755 --- a/configure.py +++ b/configure.py @@ -815,7 +815,7 @@ LIBS = [ "Dolphin/os/OSReset", "Dolphin/os/OSResetSW", "Dolphin/os/OSRtc", - "Dolphin/os/OSSync", + ["Dolphin/os/OSSync", True], "Dolphin/os/OSThread", "Dolphin/os/OSTime", ["Dolphin/os/__ppc_eabi_init", True], diff --git a/libc/stddef.h b/libc/stddef.h index 51b0f2ce..d6b4a8df 100644 --- a/libc/stddef.h +++ b/libc/stddef.h @@ -7,9 +7,11 @@ extern "C" { #define offsetof(type, member) ((size_t) & (((type*)0)->member)) -typedef __typeof__(sizeof(0)) size_t; -typedef __typeof__((char*)0 - (char*)0) ptrdiff_t; - +/* These break 1.2.5 */ +//typedef __typeof__(sizeof(0)) size_t; +//typedef __typeof__((char*)0 - (char*)0) ptrdiff_t; +typedef unsigned long size_t; +typedef long ptrdiff_t; #ifndef NULL #define NULL 0L #endif diff --git a/obj_files.mk b/obj_files.mk index 0366d761..69c0445e 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -703,7 +703,7 @@ OS_FILES :=\ $(BUILD_DIR)/asm/Dolphin/os/OSReset.o\ $(BUILD_DIR)/asm/Dolphin/os/OSResetSW.o\ $(BUILD_DIR)/asm/Dolphin/os/OSRtc.o\ - $(BUILD_DIR)/asm/Dolphin/os/OSSync.o\ + $(BUILD_DIR)/src/Dolphin/os/OSSync.o\ $(BUILD_DIR)/asm/Dolphin/os/OSThread.o\ $(BUILD_DIR)/asm/Dolphin/os/OSTime.o\ $(BUILD_DIR)/src/Dolphin/os/__ppc_eabi_init.ep.o\ diff --git a/src/Dolphin/os/OSSync.c b/src/Dolphin/os/OSSync.c new file mode 100644 index 00000000..b5aeccf7 --- /dev/null +++ b/src/Dolphin/os/OSSync.c @@ -0,0 +1,29 @@ +#include "string.h" +#include "dolphin/PPCArch.h" +#include "dolphin/os.h" + +void __OSSystemCallVectorStart(); +void __OSSystemCallVectorEnd(); +static asm void SystemCallVector() { + nofralloc +entry __OSSystemCallVectorStart + mfspr r9, HID0 + ori r10, r9, 8 + mtspr HID0, r10 + isync + sync + mtspr HID0, r9 + + rfi + +entry __OSSystemCallVectorEnd + nop +} + +void __OSInitSystemCall() { + void* addr = OSPhysicalToCached(0x00C00); + memcpy(addr, __OSSystemCallVectorStart, (size_t)__OSSystemCallVectorEnd - (size_t)__OSSystemCallVectorStart); + DCFlushRangeNoSync(addr, 0x100); + __sync(); + ICInvalidateRange(addr, 0x100); +}