[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/18] signal/all: remove return value from restore_s
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 05/18] signal/all: remove return value from restore_sigcontext |
Date: |
Mon, 9 Jun 2014 15:46:30 +0300 |
From: Riku Voipio <address@hidden>
make most implementations of restore_sigcontext void and
remove checking it's return value from functions calling
restore_sigcontext.
The exception is the X86 version of the function that is
too different from others to deal in this way, and arm
version, to keep possibility of erroring out from failed
valid_user_regs.
v3: keep arm valid_user_regs for filling in near future.
Signed-off-by: Riku Voipio <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
---
linux-user/signal.c | 43 ++++++++++++-------------------------------
1 file changed, 12 insertions(+), 31 deletions(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 421bd48..b2bc729 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -2889,10 +2889,9 @@ static inline void setup_sigcontext(CPUMIPSState *regs,
}
}
-static inline int
+static inline void
restore_sigcontext(CPUMIPSState *regs, struct target_sigcontext *sc)
{
- int err = 0;
int i;
__get_user(regs->CP0_EPC, &sc->sc_pc);
@@ -2919,8 +2918,6 @@ 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]);
}
-
- return err;
}
/*
@@ -3031,8 +3028,7 @@ long do_sigreturn(CPUMIPSState *regs)
target_to_host_sigset_internal(&blocked, &target_set);
do_sigprocmask(SIG_SETMASK, &blocked, NULL);
- if (restore_sigcontext(regs, &frame->sf_sc))
- goto badframe;
+ restore_sigcontext(regs, &frame->sf_sc);
#if 0
/*
@@ -3135,8 +3131,7 @@ long do_rt_sigreturn(CPUMIPSState *env)
target_to_host_sigset(&blocked, &frame->rs_uc.tuc_sigmask);
do_sigprocmask(SIG_SETMASK, &blocked, NULL);
- if (restore_sigcontext(env, &frame->rs_uc.tuc_mcontext))
- goto badframe;
+ restore_sigcontext(env, &frame->rs_uc.tuc_mcontext);
if (do_sigaltstack(frame_addr +
offsetof(struct target_rt_sigframe, rs_uc.tuc_stack),
@@ -3249,10 +3244,9 @@ static void setup_sigcontext(struct target_sigcontext
*sc,
__put_user(mask, &sc->oldmask);
}
-static int restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc,
+static void restore_sigcontext(CPUSH4State *regs, struct target_sigcontext *sc,
target_ulong *r0_p)
{
- unsigned int err = 0;
int i;
#define COPY(x) __get_user(regs->x, &sc->sc_##x)
@@ -3277,7 +3271,6 @@ static int restore_sigcontext(CPUSH4State *regs, struct
target_sigcontext *sc,
regs->tra = -1; /* disable syscall checks */
__get_user(*r0_p, &sc->sc_gregs[0]);
- return err;
}
static void setup_frame(int sig, struct target_sigaction *ka,
@@ -3422,8 +3415,7 @@ long do_sigreturn(CPUSH4State *regs)
target_to_host_sigset_internal(&blocked, &target_set);
do_sigprocmask(SIG_SETMASK, &blocked, NULL);
- if (restore_sigcontext(regs, &frame->sc, &r0))
- goto badframe;
+ restore_sigcontext(regs, &frame->sc, &r0);
unlock_user_struct(frame, frame_addr, 0);
return r0;
@@ -3451,8 +3443,7 @@ long do_rt_sigreturn(CPUSH4State *regs)
target_to_host_sigset(&blocked, &frame->uc.tuc_sigmask);
do_sigprocmask(SIG_SETMASK, &blocked, NULL);
- if (restore_sigcontext(regs, &frame->uc.tuc_mcontext, &r0))
- goto badframe;
+ restore_sigcontext(regs, &frame->uc.tuc_mcontext, &r0);
if (do_sigaltstack(frame_addr +
offsetof(struct target_rt_sigframe, uc.tuc_stack),
@@ -5086,10 +5077,9 @@ static void setup_sigcontext(struct target_sigcontext
*sc, CPUM68KState *env,
__put_user(env->pc, &sc->sc_pc);
}
-static int
+static void
restore_sigcontext(CPUM68KState *env, struct target_sigcontext *sc, int *pd0)
{
- int err = 0;
int temp;
__get_user(env->aregs[7], &sc->sc_usp);
@@ -5101,8 +5091,6 @@ restore_sigcontext(CPUM68KState *env, struct
target_sigcontext *sc, int *pd0)
env->sr = (env->sr & 0xff00) | (temp & 0xff);
*pd0 = tswapl(sc->sc_d0);
-
- return err;
}
/*
@@ -5343,8 +5331,7 @@ long do_sigreturn(CPUM68KState *env)
/* restore registers */
- if (restore_sigcontext(env, &frame->sc, &d0))
- goto badframe;
+ restore_sigcontext(env, &frame->sc, &d0);
unlock_user_struct(frame, frame_addr, 0);
return d0;
@@ -5462,11 +5449,11 @@ static void setup_sigcontext(struct target_sigcontext
*sc, CPUAlphaState *env,
__put_user(0, &sc->sc_traparg_a2); /* FIXME */
}
-static int restore_sigcontext(CPUAlphaState *env,
+static void restore_sigcontext(CPUAlphaState *env,
struct target_sigcontext *sc)
{
uint64_t fpcr;
- int i, err = 0;
+ int i;
__get_user(env->pc, &sc->sc_pc);
@@ -5479,8 +5466,6 @@ static int restore_sigcontext(CPUAlphaState *env,
__get_user(fpcr, &sc->sc_fpcr);
cpu_alpha_store_fpcr(env, fpcr);
-
- return err;
}
static inline abi_ulong get_sigframe(struct target_sigaction *sa,
@@ -5614,9 +5599,7 @@ long do_sigreturn(CPUAlphaState *env)
target_to_host_sigset_internal(&set, &target_set);
do_sigprocmask(SIG_SETMASK, &set, NULL);
- if (restore_sigcontext(env, sc)) {
- goto badframe;
- }
+ restore_sigcontext(env, sc);
unlock_user_struct(sc, sc_addr, 0);
return env->ir[IR_V0];
@@ -5637,9 +5620,7 @@ long do_rt_sigreturn(CPUAlphaState *env)
target_to_host_sigset(&set, &frame->uc.tuc_sigmask);
do_sigprocmask(SIG_SETMASK, &set, NULL);
- if (restore_sigcontext(env, &frame->uc.tuc_mcontext)) {
- goto badframe;
- }
+ restore_sigcontext(env, &frame->uc.tuc_mcontext);
if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe,
uc.tuc_stack),
0, env->ir[IR_SP]) == -EFAULT) {
--
2.0.0.rc2
- [Qemu-devel] [PULL 17/18] linux-user: Return correct errno for unsupported netlink socket, (continued)
- [Qemu-devel] [PULL 17/18] linux-user: Return correct errno for unsupported netlink socket, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 10/18] signal/ppc/{save, restore}_user_regs remove __put/get error checks, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 12/18] signal/ppc/do_setcontext remove __get_user return check, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 13/18] linux-user: fix gcc-4.9 compiler error on __{get, put]}_user, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 08/18] signal/all/do_sigreturn - remove __get_user checks, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 01/18] signal/all: remove __get/__put_user return value reading, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 18/18] User mode support for Linux ELF files with no section header, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 07/18] signal/all/do_sigaltstack remove __get_user value check, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 03/18] signal/all: remove return value from copy_siginfo_to_user, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 06/18] signal/sparc/restore_fpu_state: remove, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 05/18] signal/all: remove return value from restore_sigcontext,
riku . voipio <=
- [Qemu-devel] [PULL 15/18] linux-user: Don't overrun guest buffer in sched_getaffinity, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 14/18] linux-user/uname: Return correct uname string for x86_64, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 11/18] signal/sparc64_set_context: remove __get_user checks, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 16/18] linux-user: Tell guest about big host page sizes, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 04/18] signal/all: remove return value from setup_sigcontext, riku . voipio, 2014/06/09
- [Qemu-devel] [PULL 09/18] signal/all/setup_frame remove __put_user checks, riku . voipio, 2014/06/09
- Re: [Qemu-devel] [PULL 00/18] linux-user fixes, Peter Maydell, 2014/06/09