diff options
author | Mike Frysinger <vapier@gentoo.org> | 2021-08-19 21:00:42 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2021-08-22 03:11:16 -0400 |
commit | fe7f0b013526b30ef657c5ad34a3c622a54499ac (patch) | |
tree | 58b8f1d0d4f56eb2cda60fbee2280e78860e5ec9 /sim | |
parent | ca4f6fe4fbf9fa0e76fca57ccf4cd4df81dcb47a (diff) | |
download | gdb-fe7f0b013526b30ef657c5ad34a3c622a54499ac.zip gdb-fe7f0b013526b30ef657c5ad34a3c622a54499ac.tar.gz gdb-fe7f0b013526b30ef657c5ad34a3c622a54499ac.tar.bz2 |
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.
Diffstat (limited to 'sim')
-rw-r--r-- | sim/m32r/traps.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sim/m32r/traps.c b/sim/m32r/traps.c index b9912f9..2d7738b 100644 --- a/sim/m32r/traps.c +++ b/sim/m32r/traps.c @@ -34,6 +34,11 @@ #include <time.h> #include <unistd.h> #include <utime.h> +/* 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 <sys/mman.h> #include <sys/poll.h> #include <sys/resource.h> @@ -49,6 +54,7 @@ #include <linux/sysctl.h> #include <linux/types.h> #include <linux/unistd.h> +#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, |