提交 d2565875 编写于 作者: R Richard Henderson 提交者: Blue Swirl

alpha-linux-user: Fix sigaction

Unconditional bswap replaced by __get_user/__put_user.
Signed-off-by: NRichard Henderson <rth@twiddle.net>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 658f2dc9
...@@ -607,28 +607,22 @@ int do_sigaction(int sig, const struct target_sigaction *act, ...@@ -607,28 +607,22 @@ int do_sigaction(int sig, const struct target_sigaction *act,
sig, act, oact); sig, act, oact);
#endif #endif
if (oact) { if (oact) {
oact->_sa_handler = tswapal(k->_sa_handler); __put_user(k->_sa_handler, &oact->_sa_handler);
#if defined(TARGET_MIPS) || defined (TARGET_ALPHA) __put_user(k->sa_flags, &oact->sa_flags);
oact->sa_flags = bswap32(k->sa_flags);
#else
oact->sa_flags = tswapal(k->sa_flags);
#endif
#if !defined(TARGET_MIPS) #if !defined(TARGET_MIPS)
oact->sa_restorer = tswapal(k->sa_restorer); __put_user(k->sa_restorer, &oact->sa_restorer);
#endif #endif
/* Not swapped. */
oact->sa_mask = k->sa_mask; oact->sa_mask = k->sa_mask;
} }
if (act) { if (act) {
/* FIXME: This is not threadsafe. */ /* FIXME: This is not threadsafe. */
k->_sa_handler = tswapal(act->_sa_handler); __get_user(k->_sa_handler, &act->_sa_handler);
#if defined(TARGET_MIPS) || defined (TARGET_ALPHA) __get_user(k->sa_flags, &act->sa_flags);
k->sa_flags = bswap32(act->sa_flags);
#else
k->sa_flags = tswapal(act->sa_flags);
#endif
#if !defined(TARGET_MIPS) #if !defined(TARGET_MIPS)
k->sa_restorer = tswapal(act->sa_restorer); __get_user(k->sa_restorer, &act->sa_restorer);
#endif #endif
/* To be swapped in target_to_host_sigset. */
k->sa_mask = act->sa_mask; k->sa_mask = act->sa_mask;
/* we update the host linux signal state */ /* we update the host linux signal state */
......
...@@ -544,7 +544,7 @@ int do_sigaction(int sig, const struct target_sigaction *act, ...@@ -544,7 +544,7 @@ int do_sigaction(int sig, const struct target_sigaction *act,
struct target_old_sigaction { struct target_old_sigaction {
abi_ulong _sa_handler; abi_ulong _sa_handler;
abi_ulong sa_mask; abi_ulong sa_mask;
abi_ulong sa_flags; int32_t sa_flags;
}; };
struct target_rt_sigaction { struct target_rt_sigaction {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册