linux-user/microblaze: Remove non-rt signal frames
The microblaze kernel does not support these, and uses only rt style signal frames. Tested-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
4fa3876ebb
commit
49e258df83
@ -41,12 +41,6 @@ struct target_ucontext {
|
||||
};
|
||||
|
||||
/* Signal frames. */
|
||||
struct target_signal_frame {
|
||||
struct target_ucontext uc;
|
||||
uint32_t extramask[TARGET_NSIG_WORDS - 1];
|
||||
uint32_t tramp[2];
|
||||
};
|
||||
|
||||
struct target_rt_sigframe {
|
||||
target_siginfo_t info;
|
||||
struct target_ucontext uc;
|
||||
@ -137,65 +131,6 @@ static abi_ulong get_sigframe(struct target_sigaction *ka,
|
||||
return ((sp - frame_size) & -8UL);
|
||||
}
|
||||
|
||||
void setup_frame(int sig, struct target_sigaction *ka,
|
||||
target_sigset_t *set, CPUMBState *env)
|
||||
{
|
||||
struct target_signal_frame *frame;
|
||||
abi_ulong frame_addr;
|
||||
int i;
|
||||
|
||||
frame_addr = get_sigframe(ka, env, sizeof *frame);
|
||||
trace_user_setup_frame(env, frame_addr);
|
||||
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0))
|
||||
goto badframe;
|
||||
|
||||
/* Save the mask. */
|
||||
__put_user(set->sig[0], &frame->uc.tuc_mcontext.oldmask);
|
||||
|
||||
for(i = 1; i < TARGET_NSIG_WORDS; i++) {
|
||||
__put_user(set->sig[i], &frame->extramask[i - 1]);
|
||||
}
|
||||
|
||||
setup_sigcontext(&frame->uc.tuc_mcontext, env);
|
||||
|
||||
/* Set up to return from userspace. If provided, use a stub
|
||||
already in userspace. */
|
||||
/* minus 8 is offset to cater for "rtsd r15,8" offset */
|
||||
if (ka->sa_flags & TARGET_SA_RESTORER) {
|
||||
env->regs[15] = ((unsigned long)ka->sa_restorer)-8;
|
||||
} else {
|
||||
uint32_t t;
|
||||
/* Note, these encodings are _big endian_! */
|
||||
/* addi r12, r0, __NR_sigreturn */
|
||||
t = 0x31800000UL | TARGET_NR_sigreturn;
|
||||
__put_user(t, frame->tramp + 0);
|
||||
/* brki r14, 0x8 */
|
||||
t = 0xb9cc0008UL;
|
||||
__put_user(t, frame->tramp + 1);
|
||||
|
||||
/* Return from sighandler will jump to the tramp.
|
||||
Negative 8 offset because return is rtsd r15, 8 */
|
||||
env->regs[15] = frame_addr + offsetof(struct target_signal_frame, tramp)
|
||||
- 8;
|
||||
}
|
||||
|
||||
/* Set up registers for signal handler */
|
||||
env->regs[1] = frame_addr;
|
||||
/* Signal handler args: */
|
||||
env->regs[5] = sig; /* Arg 0: signum */
|
||||
env->regs[6] = 0;
|
||||
/* arg 1: sigcontext */
|
||||
env->regs[7] = frame_addr += offsetof(typeof(*frame), uc);
|
||||
|
||||
/* Offset of 4 to handle microblaze rtid r14, 0 */
|
||||
env->pc = (unsigned long)ka->_sa_handler;
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 1);
|
||||
return;
|
||||
badframe:
|
||||
force_sigsegv(sig);
|
||||
}
|
||||
|
||||
void setup_rt_frame(int sig, struct target_sigaction *ka,
|
||||
target_siginfo_t *info,
|
||||
target_sigset_t *set, CPUMBState *env)
|
||||
@ -251,38 +186,10 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
|
||||
unlock_user_struct(frame, frame_addr, 1);
|
||||
}
|
||||
|
||||
|
||||
long do_sigreturn(CPUMBState *env)
|
||||
{
|
||||
struct target_signal_frame *frame;
|
||||
abi_ulong frame_addr;
|
||||
target_sigset_t target_set;
|
||||
sigset_t set;
|
||||
int i;
|
||||
|
||||
frame_addr = env->regs[R_SP];
|
||||
trace_user_do_sigreturn(env, frame_addr);
|
||||
/* Make sure the guest isn't playing games. */
|
||||
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 1))
|
||||
goto badframe;
|
||||
|
||||
/* Restore blocked signals */
|
||||
__get_user(target_set.sig[0], &frame->uc.tuc_mcontext.oldmask);
|
||||
for(i = 1; i < TARGET_NSIG_WORDS; i++) {
|
||||
__get_user(target_set.sig[i], &frame->extramask[i - 1]);
|
||||
}
|
||||
target_to_host_sigset_internal(&set, &target_set);
|
||||
set_sigmask(&set);
|
||||
|
||||
restore_sigcontext(&frame->uc.tuc_mcontext, env);
|
||||
/* We got here through a sigreturn syscall, our path back is via an
|
||||
rtb insn so setup r14 for that. */
|
||||
env->regs[14] = env->pc;
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
badframe:
|
||||
force_sig(TARGET_SIGSEGV);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
return -TARGET_ENOSYS;
|
||||
}
|
||||
|
||||
long do_rt_sigreturn(CPUMBState *env)
|
||||
|
@ -21,5 +21,4 @@ typedef struct target_sigaltstack {
|
||||
|
||||
#include "../generic/signal.h"
|
||||
|
||||
#define TARGET_ARCH_HAS_SETUP_FRAME
|
||||
#endif /* MICROBLAZE_TARGET_SIGNAL_H */
|
||||
|
Loading…
Reference in New Issue
Block a user