[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 71/77] linux-user: Add signal.c for nanoMIPS
From: |
Stefan Markovic |
Subject: |
[Qemu-devel] [PATCH v6 71/77] linux-user: Add signal.c for nanoMIPS |
Date: |
Thu, 2 Aug 2018 16:16:58 +0200 |
From: Dimitrije Nikolic <address@hidden>
Add signal.c as a redirection to regular mips' signal.c, but at the
same time amend regular mips' signal.c with bits and pieces specific
for nanoMIPS. This was done this way to avoid duplication of large
pieces of code.
Signed-off-by: Aleksandar Rikalo <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
Signed-off-by: Stefan Markovic <address@hidden>
---
linux-user/mips/signal.c | 25 ++++++++++++++++++++-----
linux-user/nanomips/signal.c | 1 +
2 files changed, 21 insertions(+), 5 deletions(-)
create mode 100644 linux-user/nanomips/signal.c
diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c
index 6aa303e..ab66429 100644
--- a/linux-user/mips/signal.c
+++ b/linux-user/mips/signal.c
@@ -21,7 +21,15 @@
#include "signal-common.h"
#include "linux-user/trace.h"
-# if defined(TARGET_ABI_MIPSO32)
+#if defined(TARGET_ABI_MIPSP32)
+struct target_sigcontext {
+ uint64_t sc_regs[32];
+ uint64_t sc_pc;
+ uint32_t sc_used_math;
+ uint32_t sc_reserved;
+};
+#define TARGET_ALMASK (~15)
+#elif defined(TARGET_ABI_MIPSO32)
struct target_sigcontext {
uint32_t sc_regmask; /* Unused */
uint32_t sc_status;
@@ -43,6 +51,7 @@ struct target_sigcontext {
target_ulong sc_hi3;
target_ulong sc_lo3;
};
+#define TARGET_ALMASK (~7)
# else /* N32 || N64 */
struct target_sigcontext {
uint64_t sc_regs[32];
@@ -61,6 +70,7 @@ struct target_sigcontext {
uint32_t sc_dsp;
uint32_t sc_reserved;
};
+#define TARGET_ALMASK (~15)
# endif /* O32 */
struct sigframe {
@@ -100,6 +110,7 @@ static inline int install_sigtramp(unsigned int *tramp,
unsigned int syscall)
__put_user(0x24020000 + syscall, tramp + 0);
__put_user(0x0000000c , tramp + 1);
+
return err;
}
@@ -116,6 +127,7 @@ static inline void setup_sigcontext(CPUMIPSState *regs,
__put_user(regs->active_tc.gpr[i], &sc->sc_regs[i]);
}
+#if !defined(TARGET_ABI_MIPSP32)
__put_user(regs->active_tc.HI[0], &sc->sc_mdhi);
__put_user(regs->active_tc.LO[0], &sc->sc_mdlo);
@@ -137,6 +149,7 @@ static inline void setup_sigcontext(CPUMIPSState *regs,
for (i = 0; i < 32; ++i) {
__put_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]);
}
+#endif
}
static inline void
@@ -146,13 +159,14 @@ restore_sigcontext(CPUMIPSState *regs, struct
target_sigcontext *sc)
__get_user(regs->CP0_EPC, &sc->sc_pc);
- __get_user(regs->active_tc.HI[0], &sc->sc_mdhi);
- __get_user(regs->active_tc.LO[0], &sc->sc_mdlo);
-
for (i = 1; i < 32; ++i) {
__get_user(regs->active_tc.gpr[i], &sc->sc_regs[i]);
}
+#if !defined(TARGET_ABI_MIPSP32)
+ __get_user(regs->active_tc.HI[0], &sc->sc_mdhi);
+ __get_user(regs->active_tc.LO[0], &sc->sc_mdlo);
+
__get_user(regs->active_tc.HI[1], &sc->sc_hi1);
__get_user(regs->active_tc.HI[2], &sc->sc_hi2);
__get_user(regs->active_tc.HI[3], &sc->sc_hi3);
@@ -168,6 +182,7 @@ restore_sigcontext(CPUMIPSState *regs, struct
target_sigcontext *sc)
for (i = 0; i < 32; ++i) {
__get_user(regs->active_fpu.fpr[i].d, &sc->sc_fpregs[i]);
}
+#endif
}
/*
@@ -185,7 +200,7 @@ get_sigframe(struct target_sigaction *ka, CPUMIPSState
*regs, size_t frame_size)
*/
sp = target_sigsp(get_sp_from_cpustate(regs) - 32, ka);
- return (sp - frame_size) & ~7;
+ return (sp - frame_size) & TARGET_ALMASK;
}
static void mips_set_hflags_isa_mode_from_pc(CPUMIPSState *env)
diff --git a/linux-user/nanomips/signal.c b/linux-user/nanomips/signal.c
new file mode 100644
index 0000000..86efc21
--- /dev/null
+++ b/linux-user/nanomips/signal.c
@@ -0,0 +1 @@
+#include "../mips/signal.c"
--
1.9.1
- Re: [Qemu-devel] [PATCH v6 61/77] linux-user: Add syscall numbers for nanoMIPS, (continued)
- [Qemu-devel] [PATCH v6 62/77] linux-user: Add target_signal.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 63/77] linux-user: Add termbits.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 64/77] linux-user: Update syscall_defs.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 65/77] linux-user: Add target_fcntl.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 66/77] linux-user: Add sockbits.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 67/77] linux-user: Add target_syscall.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 68/77] linux-user: Add target_cpu.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 69/77] linux-user: Add target_structs.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 70/77] linux-user: Add target_elf.h header for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 71/77] linux-user: Add signal.c for nanoMIPS,
Stefan Markovic <=
- [Qemu-devel] [PATCH v6 72/77] linux-user: Add support for nanoMIPS signal trampoline, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 73/77] linux-user: Add cpu_loop.c for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 74/77] linux-user: Amend support for sigaction() syscall for nanoMIPS, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 75/77] linux-user: Add support for statx() syscall for all platforms, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 76/77] linux-user: Add nanoMIPS linux user mode configuration support, Stefan Markovic, 2018/08/02
- [Qemu-devel] [PATCH v6 77/77] linux-user: Add nanoMIPS support in scripts/qemu-binfmt-conf.sh, Stefan Markovic, 2018/08/02
- Re: [Qemu-devel] [PATCH v6 00/77] Add nanoMIPS support to QEMU, no-reply, 2018/08/02