save_syscall_return_value(): separate from check_signal() and call from syscall() (for ARM64)
This commit is contained in:
@@ -1323,6 +1323,17 @@ interrupt_from_user(void *regs0)
|
||||
return((regs->pstate & PSR_MODE_MASK) == PSR_MODE_EL0t);
|
||||
}
|
||||
|
||||
void save_syscall_return_value(int num, unsigned long rc)
|
||||
{
|
||||
/*
|
||||
* Save syscall return value.
|
||||
*/
|
||||
if (cpu_local_var(current) && cpu_local_var(current)->uctx &&
|
||||
num != __NR_rt_sigsuspend) {
|
||||
ihk_mc_syscall_arg0(cpu_local_var(current)->uctx) = rc;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
check_signal(unsigned long rc, void *regs0, int num)
|
||||
{
|
||||
@@ -1347,16 +1358,6 @@ __check_signal(unsigned long rc, void *regs0, int num, int irq_disabled)
|
||||
return;
|
||||
thread = cpu_local_var(current);
|
||||
|
||||
/**
|
||||
* If check_signal is called from syscall(),
|
||||
* then save syscall return value.
|
||||
*/
|
||||
if((regs == NULL)&&(num != __NR_rt_sigsuspend)){ /* It's call from syscall! */
|
||||
// Get user context through current thread
|
||||
// and update syscall return.
|
||||
ihk_mc_syscall_arg0(thread->uctx) = rc;
|
||||
}
|
||||
|
||||
if(thread == NULL || thread->proc->pid == 0){
|
||||
struct thread *t;
|
||||
irqstate = ihk_mc_spinlock_lock(&(cpu_local_var(runq_lock)));
|
||||
|
||||
@@ -1008,6 +1008,12 @@ interrupt_from_user(void *regs0)
|
||||
return !(regs->gpr.rsp & 0x8000000000000000);
|
||||
}
|
||||
|
||||
void save_syscall_return_value(int num, unsigned long rc)
|
||||
{
|
||||
/* Empty on x86 */
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
check_signal(unsigned long rc, void *regs0, int num)
|
||||
{
|
||||
|
||||
@@ -113,6 +113,7 @@ static ihk_spinlock_t tod_data_lock = SPIN_LOCK_UNLOCKED;
|
||||
static void calculate_time_from_tsc(struct timespec *ts);
|
||||
|
||||
void check_signal(unsigned long, void *, int);
|
||||
void save_syscall_return_value(int num, unsigned long rc);
|
||||
void do_signal(long rc, void *regs, struct thread *thread, struct sig_pending *pending, int num);
|
||||
extern unsigned long do_kill(struct thread *thread, int pid, int tid, int sig, struct siginfo *info, int ptracecont);
|
||||
extern long alloc_debugreg(struct thread *thread);
|
||||
@@ -9365,6 +9366,7 @@ long syscall(int num, ihk_mc_user_context_t *ctx)
|
||||
|
||||
if(cpu_local_var(current)->proc->status == PS_EXITED &&
|
||||
(num != __NR_exit && num != __NR_exit_group)){
|
||||
save_syscall_return_value(num, -EINVAL);
|
||||
check_signal(-EINVAL, NULL, 0);
|
||||
set_cputime(0);
|
||||
return -EINVAL;
|
||||
@@ -9425,22 +9427,12 @@ long syscall(int num, ihk_mc_user_context_t *ctx)
|
||||
l = ihk_mc_syscall_ret(ctx);
|
||||
}
|
||||
|
||||
#if defined(POSTK_DEBUG_TEMP_FIX_60) && defined(POSTK_DEBUG_TEMP_FIX_56)
|
||||
check_signal(l, NULL, num);
|
||||
#elif defined(POSTK_DEBUG_TEMP_FIX_60) /* sched_yield called check_signal fix. */
|
||||
if (num != __NR_futex) {
|
||||
check_signal(l, NULL, num);
|
||||
}
|
||||
#elif defined(POSTK_DEBUG_TEMP_FIX_56) /* in futex_wait() signal handring fix. */
|
||||
if (num != __NR_sched_yield) {
|
||||
check_signal(l, NULL, num);
|
||||
}
|
||||
#else /* POSTK_DEBUG_TEMP_FIX_60 && POSTK_DEBUG_TEMP_FIX_56 */
|
||||
save_syscall_return_value(num, l);
|
||||
|
||||
if (!list_empty(&thread->sigpending) ||
|
||||
!list_empty(&thread->sigcommon->sigpending)) {
|
||||
check_signal(l, NULL, num);
|
||||
}
|
||||
#endif /* POSTK_DEBUG_TEMP_FIX_60 && POSTK_DEBUG_TEMP_FIX_56 */
|
||||
|
||||
#ifdef PROFILE_ENABLE
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user