diff mbox

[PULL,01/11] linux-user/signal.c: Remove current_exec_domain_sig()

Message ID b6e2c9353a5bd8649ee71a52c35344ce3fb1c7d2.1422392096.git.riku.voipio@linaro.org
State Accepted
Commit b6e2c9353a5bd8649ee71a52c35344ce3fb1c7d2
Headers show

Commit Message

Riku Voipio Jan. 27, 2015, 9:07 p.m. UTC
From: Peter Maydell <peter.maydell@linaro.org>

Remove the function current_exec_domain_sig(), which always returns
its argument. This was intended as a stub for supporting the kernel's
exec_domain handling, but:
 * we don't have any of the other code for execution domains
 * in the kernel this handling is architecture-specific, not generic
 * we only call this function in the x86, ppc and sh4 signal code paths,
   and the PPC one is wrong anyway because the PPC kernel doesn't
   have this signal-remapping code

So it's best to simply delete the function; any future attempt to
implement exec domains will be better served by adding the correct
code from scratch based on the kernel sources at that time.

This change also fixes some clang warnings about the function being
defined but not used for some target architectures.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 linux-user/signal.c | 31 ++++++-------------------------
 1 file changed, 6 insertions(+), 25 deletions(-)
diff mbox

Patch

diff --git a/linux-user/signal.c b/linux-user/signal.c
index e11b208..fa955ef 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -738,12 +738,6 @@  static inline void copy_siginfo_to_user(target_siginfo_t *tinfo,
     tswap_siginfo(tinfo, info);
 }
 
-static inline int current_exec_domain_sig(int sig)
-{
-    return /* current->exec_domain && current->exec_domain->signal_invmap
-	      && sig < 32 ? current->exec_domain->signal_invmap[sig] : */ sig;
-}
-
 #if defined(TARGET_I386) && TARGET_ABI_BITS == 32
 
 /* from the Linux kernel */
@@ -926,8 +920,7 @@  static void setup_frame(int sig, struct target_sigaction *ka,
 	if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 		goto give_sigsegv;
 
-    __put_user(current_exec_domain_sig(sig),
-               &frame->sig);
+    __put_user(sig, &frame->sig);
 
 	setup_sigcontext(&frame->sc, &frame->fpstate, env, set->sig[0],
                          frame_addr + offsetof(struct sigframe, fpstate));
@@ -988,7 +981,7 @@  static void setup_rt_frame(int sig, struct target_sigaction *ka,
 	if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 		goto give_sigsegv;
 
-    __put_user(current_exec_domain_sig(sig), &frame->sig);
+    __put_user(sig, &frame->sig);
         addr = frame_addr + offsetof(struct rt_sigframe, info);
     __put_user(addr, &frame->pinfo);
         addr = frame_addr + offsetof(struct rt_sigframe, uc);
@@ -3228,14 +3221,11 @@  static void setup_frame(int sig, struct target_sigaction *ka,
     abi_ulong frame_addr;
     int i;
     int err = 0;
-    int signal;
 
     frame_addr = get_sigframe(ka, regs->gregs[15], sizeof(*frame));
     if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 	goto give_sigsegv;
 
-    signal = current_exec_domain_sig(sig);
-
     setup_sigcontext(&frame->sc, regs, set->sig[0]);
 
     for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) {
@@ -3259,7 +3249,7 @@  static void setup_frame(int sig, struct target_sigaction *ka,
 
     /* Set up registers for signal handler */
     regs->gregs[15] = frame_addr;
-    regs->gregs[4] = signal; /* Arg for signal handler */
+    regs->gregs[4] = sig; /* Arg for signal handler */
     regs->gregs[5] = 0;
     regs->gregs[6] = frame_addr += offsetof(typeof(*frame), sc);
     regs->pc = (unsigned long) ka->_sa_handler;
@@ -3280,14 +3270,11 @@  static void setup_rt_frame(int sig, struct target_sigaction *ka,
     abi_ulong frame_addr;
     int i;
     int err = 0;
-    int signal;
 
     frame_addr = get_sigframe(ka, regs->gregs[15], sizeof(*frame));
     if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
 	goto give_sigsegv;
 
-    signal = current_exec_domain_sig(sig);
-
     copy_siginfo_to_user(&frame->info, info);
 
     /* Create the ucontext.  */
@@ -3322,7 +3309,7 @@  static void setup_rt_frame(int sig, struct target_sigaction *ka,
 
     /* Set up registers for signal handler */
     regs->gregs[15] = frame_addr;
-    regs->gregs[4] = signal; /* Arg for signal handler */
+    regs->gregs[4] = sig; /* Arg for signal handler */
     regs->gregs[5] = frame_addr + offsetof(typeof(*frame), info);
     regs->gregs[6] = frame_addr + offsetof(typeof(*frame), uc);
     regs->pc = (unsigned long) ka->_sa_handler;
@@ -4680,7 +4667,6 @@  static void setup_frame(int sig, struct target_sigaction *ka,
     struct target_sigcontext *sc;
     target_ulong frame_addr, newsp;
     int err = 0;
-    int signal;
 #if defined(TARGET_PPC64)
     struct image_info *image = ((TaskState *)thread_cpu->opaque)->info;
 #endif
@@ -4690,8 +4676,6 @@  static void setup_frame(int sig, struct target_sigaction *ka,
         goto sigsegv;
     sc = &frame->sctx;
 
-    signal = current_exec_domain_sig(sig);
-
     __put_user(ka->_sa_handler, &sc->handler);
     __put_user(set->sig[0], &sc->oldmask);
 #if TARGET_ABI_BITS == 64
@@ -4724,7 +4708,7 @@  static void setup_frame(int sig, struct target_sigaction *ka,
 
     /* Set up registers for signal handler.  */
     env->gpr[1] = newsp;
-    env->gpr[3] = signal;
+    env->gpr[3] = sig;
     env->gpr[4] = frame_addr + offsetof(struct target_sigframe, sctx);
 
 #if defined(TARGET_PPC64)
@@ -4765,7 +4749,6 @@  static void setup_rt_frame(int sig, struct target_sigaction *ka,
     struct target_mcontext *mctx = 0;
     target_ulong rt_sf_addr, newsp = 0;
     int i, err = 0;
-    int signal;
 #if defined(TARGET_PPC64)
     struct image_info *image = ((TaskState *)thread_cpu->opaque)->info;
 #endif
@@ -4774,8 +4757,6 @@  static void setup_rt_frame(int sig, struct target_sigaction *ka,
     if (!lock_user_struct(VERIFY_WRITE, rt_sf, rt_sf_addr, 1))
         goto sigsegv;
 
-    signal = current_exec_domain_sig(sig);
-
     copy_siginfo_to_user(&rt_sf->info, info);
 
     __put_user(0, &rt_sf->uc.tuc_flags);
@@ -4821,7 +4802,7 @@  static void setup_rt_frame(int sig, struct target_sigaction *ka,
 
     /* Set up registers for signal handler.  */
     env->gpr[1] = newsp;
-    env->gpr[3] = (target_ulong) signal;
+    env->gpr[3] = (target_ulong) sig;
     env->gpr[4] = (target_ulong) h2g(&rt_sf->info);
     env->gpr[5] = (target_ulong) h2g(&rt_sf->uc);
     env->gpr[6] = (target_ulong) h2g(rt_sf);