From fe7f0b013526b30ef657c5ad34a3c622a54499ac Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 19 Aug 2021 21:00:42 -0400 Subject: [PATCH] sim: m32r: add __linux__ hack for non-Linux hosts The m32r Linux syscall emulation logic assumes the host environment directly matches -- it's being run on 32-bit little endian Linux. This breaks building for non-Linux systems, so put all the code in __linux__ ifdef checks. This code needs a lot of love to make it work everywhere, but let's at least unbreak it for non-Linux hosts. --- sim/m32r/traps.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index b9912f95106..2d7738b1f3c 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -34,6 +34,11 @@ #include #include #include +/* TODO: The Linux syscall emulation needs work to support non-Linux hosts. + Use an OS hack for now so the CPU emulation is available everywhere. + NB: The emulation is also missing argument conversion (endian & bitsize) + even on Linux hosts. */ +#ifdef __linux__ #include #include #include @@ -49,6 +54,7 @@ #include #include #include +#endif #define TRAP_LINUX_SYSCALL 2 #define TRAP_FLUSH_CACHE 12 @@ -203,6 +209,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) break; } +#ifdef __linux__ case TRAP_LINUX_SYSCALL: { CB_SYSCALL s; @@ -1302,6 +1309,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num) m32rbf_h_gr_set (current_cpu, 0, result); break; } +#endif case TRAP_BREAKPOINT: sim_engine_halt (sd, current_cpu, NULL, pc, -- 2.30.2