Skip to content

Commit

Permalink
linux-user/signal.c: Remove current_exec_domain_sig()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Riku Voipio <[email protected]>
  • Loading branch information
pm215 authored and Riku Voipio committed Jan 27, 2015
1 parent b00c92e commit b6e2c93
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions linux-user/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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++) {
Expand All @@ -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;
Expand All @@ -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. */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b6e2c93

Please sign in to comment.