forked from Ports/goldeneye-pc-port
- Replace setjmp/longjmp green threads with real pthreads (8MB stacks); PortQueue side table (mutex+condvar) for OSMesgQueue; dedicated tick thread posts VI retrace + services timers (D24). - Dual-mapped N64 DRAM: one 8MB store at V1 0x70000000 (s32-safe, all game RAM symbols) and V2 0x80000000 (KSEG0 mirror for offset|0x80000000 rebuilds). Windows: CreateFileMappingW + MapViewOfFileEx; POSIX: memfd + MAP_FIXED. dram_syms.s pins cfb_16/_bssSegmentEnd/tlb block (D25). - Address-width shims: PHYS_TO_K0 identity, OS_K0_TO_PHYSICAL = offset from V1 base, OS_PHYSICAL_TO_K0 identity; fast3d seg_addr() remaps small offsets into V2 (D26). - ASLR off (-Wl,--disable-dynamicbase): absolute symbols referenced through pointer-typed externs (.refptr + BASE reloc) must not rebase; startup sanity check on image base 0x140000000 (D27). - osPiStartDma posts its completion message on every path (fixes romReceiveMesg deadlock) (D29). - SEH-free crash handler: raw fault log first, validated manual EBP-chain walk second (-fno-omit-frame-pointer), TerminateProcess; crashDumpThreads via Toolhelp32 for heartbeat hang dumps (D30). - PD fast3d integrated (port/fast3d/), replaces gfxstub.c; real src/sched.c compiled; mainproc runs as a real pthread, host thread pumps SDL events. - Docs: findings D24-D31 + Phase 2 status (section F/G). Current state: boots through bossInitMainthreadData to langInit(), then SIGSEGVs on the first file load — stack frame clobbered by a table of truncated s32 pointers (D31, open). Next: attribute the write with 'set scheduler-locking on' + hardware watchpoint.
61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
#ifndef PORT_PLATFORM_H
|
|
#define PORT_PLATFORM_H
|
|
|
|
/*
|
|
* Platform abstraction for the GE PC port.
|
|
*
|
|
* Provides the small set of host primitives the port layer needs, with
|
|
* per-OS implementations selected at compile time. Modelled on the PD port's
|
|
* port/include/platform.h.
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
#define PLATFORM_WINDOWS 1
|
|
#elif defined(__APPLE__)
|
|
#include <TargetConditionals.h>
|
|
#if TARGET_OS_IPHONE
|
|
#define PLATFORM_IOS 1
|
|
#else
|
|
#define PLATFORM_MACOS 1
|
|
#endif
|
|
#elif defined(__linux__)
|
|
#define PLATFORM_LINUX 1
|
|
#else
|
|
#error "Unsupported platform"
|
|
#endif
|
|
|
|
#if defined(_M_X64) || defined(__x86_64__) || defined(__aarch64__)
|
|
#define PLATFORM_64BIT 1
|
|
#endif
|
|
|
|
#if defined(_M_IX86) || defined(__i386__)
|
|
#define PLATFORM_X86 1
|
|
#elif defined(_M_X64) || defined(__x86_64__)
|
|
#define PLATFORM_X86_64 1
|
|
#elif defined(__aarch64__)
|
|
#define PLATFORM_ARM 1
|
|
#endif
|
|
|
|
/* Constructor attribute: run before main(). */
|
|
#if defined(_MSC_VER)
|
|
#define PD_CONSTRUCTOR
|
|
#define PD_EXPORT
|
|
#else
|
|
#define PD_CONSTRUCTOR __attribute__((constructor))
|
|
#define PD_EXPORT __attribute__((visibility("default")))
|
|
#endif
|
|
|
|
/* Log levels (see system.h). */
|
|
enum LogLevel {
|
|
LOG_ERROR = 0,
|
|
LOG_WARNING,
|
|
LOG_NOTE,
|
|
LOG_INFO,
|
|
LOG_DEBUG,
|
|
};
|
|
|
|
#endif /* PORT_PLATFORM_H */
|