mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-6.1-pull-request' into staging
linux-user pull request 20210517 - alpha sigaction fixes/cleanups - s390x sigaction fixes/cleanup - sparc sigaction fixes/cleanup - s390x core dumping support - core dump fix (app name) - arm fpa11 fix and cleanup - strace fixes (unshare(), llseek()) - fix copy_file_range() - use GDateTime - Remove dead code # gpg: Signature made Tue 18 May 2021 06:31:12 BST # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier2/tags/linux-user-for-6.1-pull-request: (59 commits) linux-user/elfload: add s390x core dumping support linux-user/elfload: fix filling psinfo->pr_psargs linux-user: Tidy TARGET_NR_rt_sigaction linux-user/alpha: Share code for TARGET_NR_sigaction linux-user/alpha: Define TARGET_ARCH_HAS_KA_RESTORER linux-user: Honor TARGET_ARCH_HAS_SA_RESTORER in do_syscall linux-user: Pass ka_restorer to do_sigaction linux-user/alpha: Rename the sigaction restorer field linux-user/alpha: Fix rt sigframe return linux-user: use GDateTime for formatting timestamp for core file linux-user: Fix erroneous conversion in copy_file_range linux-user: Add copy_file_range to strace.list linux-user/s390x: Handle vector regs in signal stack linux-user/s390x: Clean up signal.c linux-user/s390x: Add build asserts for sigset sizes linux-user/s390x: Fix frame_addr corruption in setup_frame linux-user/s390x: Add stub sigframe argument for last_break linux-user/s390x: Set psw.mask properly for the signal handler linux-user/s390x: Clean up single-use gotos in signal.c linux-user/s390x: Tidy save_sigregs ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
TARGET_ARCH=sparc64
|
||||
TARGET_BASE_ARCH=sparc
|
||||
TARGET_ABI_DIR=sparc
|
||||
TARGET_SYSTBL_ABI=common,64
|
||||
TARGET_SYSTBL=syscall.tbl
|
||||
TARGET_ALIGNED_ONLY=y
|
||||
|
||||
@@ -561,11 +561,7 @@ long do_rt_sigreturn(CPUARMState *env)
|
||||
goto badframe;
|
||||
}
|
||||
|
||||
if (do_sigaltstack(frame_addr +
|
||||
offsetof(struct target_rt_sigframe, uc.tuc_stack),
|
||||
0, get_sp_from_cpustate(env)) == -EFAULT) {
|
||||
goto badframe;
|
||||
}
|
||||
target_restore_altstack(&frame->uc.tuc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
@@ -138,8 +138,8 @@ void setup_frame(int sig, struct target_sigaction *ka,
|
||||
|
||||
setup_sigcontext(&frame->sc, env, frame_addr, set);
|
||||
|
||||
if (ka->sa_restorer) {
|
||||
r26 = ka->sa_restorer;
|
||||
if (ka->ka_restorer) {
|
||||
r26 = ka->ka_restorer;
|
||||
} else {
|
||||
__put_user(INSN_MOV_R30_R16, &frame->retcode[0]);
|
||||
__put_user(INSN_LDI_R0 + TARGET_NR_sigreturn,
|
||||
@@ -192,15 +192,15 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
|
||||
__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
|
||||
}
|
||||
|
||||
if (ka->sa_restorer) {
|
||||
r26 = ka->sa_restorer;
|
||||
if (ka->ka_restorer) {
|
||||
r26 = ka->ka_restorer;
|
||||
} else {
|
||||
__put_user(INSN_MOV_R30_R16, &frame->retcode[0]);
|
||||
__put_user(INSN_LDI_R0 + TARGET_NR_rt_sigreturn,
|
||||
&frame->retcode[1]);
|
||||
__put_user(INSN_CALLSYS, &frame->retcode[2]);
|
||||
/* imb(); */
|
||||
r26 = frame_addr + offsetof(struct target_sigframe, retcode);
|
||||
r26 = frame_addr + offsetof(struct target_rt_sigframe, retcode);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
@@ -257,11 +257,7 @@ long do_rt_sigreturn(CPUAlphaState *env)
|
||||
set_sigmask(&set);
|
||||
|
||||
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) {
|
||||
goto badframe;
|
||||
}
|
||||
target_restore_altstack(&frame->uc.tuc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
@@ -92,6 +92,7 @@ typedef struct target_sigaltstack {
|
||||
#define TARGET_GEN_SUBRNG7 -25
|
||||
|
||||
#define TARGET_ARCH_HAS_SETUP_FRAME
|
||||
#define TARGET_ARCH_HAS_KA_RESTORER
|
||||
|
||||
/* bit-flags */
|
||||
#define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling */
|
||||
|
||||
+66
-59
@@ -224,6 +224,64 @@ static bool insn_is_linux_bkpt(uint32_t opcode, bool is_thumb)
|
||||
}
|
||||
}
|
||||
|
||||
static bool emulate_arm_fpa11(CPUARMState *env, uint32_t opcode)
|
||||
{
|
||||
TaskState *ts = env_cpu(env)->opaque;
|
||||
int rc = EmulateAll(opcode, &ts->fpa, env);
|
||||
int raise, enabled;
|
||||
|
||||
if (rc == 0) {
|
||||
/* Illegal instruction */
|
||||
return false;
|
||||
}
|
||||
if (rc > 0) {
|
||||
/* Everything ok. */
|
||||
env->regs[15] += 4;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* FP exception */
|
||||
rc = -rc;
|
||||
raise = 0;
|
||||
|
||||
/* Translate softfloat flags to FPSR flags */
|
||||
if (rc & float_flag_invalid) {
|
||||
raise |= BIT_IOC;
|
||||
}
|
||||
if (rc & float_flag_divbyzero) {
|
||||
raise |= BIT_DZC;
|
||||
}
|
||||
if (rc & float_flag_overflow) {
|
||||
raise |= BIT_OFC;
|
||||
}
|
||||
if (rc & float_flag_underflow) {
|
||||
raise |= BIT_UFC;
|
||||
}
|
||||
if (rc & float_flag_inexact) {
|
||||
raise |= BIT_IXC;
|
||||
}
|
||||
|
||||
/* Accumulate unenabled exceptions */
|
||||
enabled = ts->fpa.fpsr >> 16;
|
||||
ts->fpa.fpsr |= raise & ~enabled;
|
||||
|
||||
if (raise & enabled) {
|
||||
target_siginfo_t info = { };
|
||||
|
||||
/*
|
||||
* The kernel's nwfpe emulator does not pass a real si_code.
|
||||
* It merely uses send_sig(SIGFPE, current, 1).
|
||||
*/
|
||||
info.si_signo = TARGET_SIGFPE;
|
||||
info.si_code = TARGET_SI_KERNEL;
|
||||
|
||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
||||
} else {
|
||||
env->regs[15] += 4;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void cpu_loop(CPUARMState *env)
|
||||
{
|
||||
CPUState *cs = env_cpu(env);
|
||||
@@ -244,9 +302,7 @@ void cpu_loop(CPUARMState *env)
|
||||
case EXCP_NOCP:
|
||||
case EXCP_INVSTATE:
|
||||
{
|
||||
TaskState *ts = cs->opaque;
|
||||
uint32_t opcode;
|
||||
int rc;
|
||||
|
||||
/* we handle the FPU emulation here, as Linux */
|
||||
/* we get the opcode */
|
||||
@@ -263,64 +319,15 @@ void cpu_loop(CPUARMState *env)
|
||||
goto excp_debug;
|
||||
}
|
||||
|
||||
rc = EmulateAll(opcode, &ts->fpa, env);
|
||||
if (rc == 0) { /* illegal instruction */
|
||||
info.si_signo = TARGET_SIGILL;
|
||||
info.si_errno = 0;
|
||||
info.si_code = TARGET_ILL_ILLOPN;
|
||||
info._sifields._sigfault._addr = env->regs[15];
|
||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
||||
} else if (rc < 0) { /* FP exception */
|
||||
int arm_fpe=0;
|
||||
|
||||
/* translate softfloat flags to FPSR flags */
|
||||
if (-rc & float_flag_invalid)
|
||||
arm_fpe |= BIT_IOC;
|
||||
if (-rc & float_flag_divbyzero)
|
||||
arm_fpe |= BIT_DZC;
|
||||
if (-rc & float_flag_overflow)
|
||||
arm_fpe |= BIT_OFC;
|
||||
if (-rc & float_flag_underflow)
|
||||
arm_fpe |= BIT_UFC;
|
||||
if (-rc & float_flag_inexact)
|
||||
arm_fpe |= BIT_IXC;
|
||||
|
||||
FPSR fpsr = ts->fpa.fpsr;
|
||||
//printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe);
|
||||
|
||||
if (fpsr & (arm_fpe << 16)) { /* exception enabled? */
|
||||
info.si_signo = TARGET_SIGFPE;
|
||||
info.si_errno = 0;
|
||||
|
||||
/* ordered by priority, least first */
|
||||
if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
|
||||
if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
|
||||
if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
|
||||
if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
|
||||
if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
|
||||
|
||||
info._sifields._sigfault._addr = env->regs[15];
|
||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
||||
} else {
|
||||
env->regs[15] += 4;
|
||||
}
|
||||
|
||||
/* accumulate unenabled exceptions */
|
||||
if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC))
|
||||
fpsr |= BIT_IXC;
|
||||
if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC))
|
||||
fpsr |= BIT_UFC;
|
||||
if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC))
|
||||
fpsr |= BIT_OFC;
|
||||
if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC))
|
||||
fpsr |= BIT_DZC;
|
||||
if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC))
|
||||
fpsr |= BIT_IOC;
|
||||
ts->fpa.fpsr=fpsr;
|
||||
} else { /* everything OK */
|
||||
/* increment PC */
|
||||
env->regs[15] += 4;
|
||||
if (!env->thumb && emulate_arm_fpa11(env, opcode)) {
|
||||
break;
|
||||
}
|
||||
|
||||
info.si_signo = TARGET_SIGILL;
|
||||
info.si_errno = 0;
|
||||
info.si_code = TARGET_ILL_ILLOPN;
|
||||
info._sifields._sigfault._addr = env->regs[15];
|
||||
queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
|
||||
}
|
||||
break;
|
||||
case EXCP_SWI:
|
||||
|
||||
@@ -685,11 +685,7 @@ static int do_sigframe_return_v2(CPUARMState *env,
|
||||
}
|
||||
}
|
||||
|
||||
if (do_sigaltstack(context_addr
|
||||
+ offsetof(struct target_ucontext_v2, tuc_stack),
|
||||
0, get_sp_from_cpustate(env)) == -EFAULT) {
|
||||
return 1;
|
||||
}
|
||||
target_restore_altstack(&uc->tuc_stack, env);
|
||||
|
||||
#if 0
|
||||
/* Send SIGTRAP if we're single-stepping */
|
||||
@@ -773,8 +769,7 @@ static long do_rt_sigreturn_v1(CPUARMState *env)
|
||||
goto badframe;
|
||||
}
|
||||
|
||||
if (do_sigaltstack(frame_addr + offsetof(struct rt_sigframe_v1, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT)
|
||||
goto badframe;
|
||||
target_restore_altstack(&frame->uc.tuc_stack, env);
|
||||
|
||||
#if 0
|
||||
/* Send SIGTRAP if we're single-stepping */
|
||||
|
||||
+50
-57
@@ -676,48 +676,25 @@ static uint32_t get_elf_hwcap2(void)
|
||||
|
||||
#define ELF_CLASS ELFCLASS64
|
||||
#define ELF_ARCH EM_SPARCV9
|
||||
|
||||
#define STACK_BIAS 2047
|
||||
|
||||
static inline void init_thread(struct target_pt_regs *regs,
|
||||
struct image_info *infop)
|
||||
{
|
||||
#ifndef TARGET_ABI32
|
||||
regs->tstate = 0;
|
||||
#endif
|
||||
regs->pc = infop->entry;
|
||||
regs->npc = regs->pc + 4;
|
||||
regs->y = 0;
|
||||
#ifdef TARGET_ABI32
|
||||
regs->u_regs[14] = infop->start_stack - 16 * 4;
|
||||
#else
|
||||
if (personality(infop->personality) == PER_LINUX32)
|
||||
regs->u_regs[14] = infop->start_stack - 16 * 4;
|
||||
else
|
||||
regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS;
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
#define ELF_START_MMAP 0x80000000
|
||||
#define ELF_HWCAP (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | HWCAP_SPARC_SWAP \
|
||||
| HWCAP_SPARC_MULDIV)
|
||||
|
||||
#define ELF_CLASS ELFCLASS32
|
||||
#define ELF_ARCH EM_SPARC
|
||||
#endif /* TARGET_SPARC64 */
|
||||
|
||||
static inline void init_thread(struct target_pt_regs *regs,
|
||||
struct image_info *infop)
|
||||
{
|
||||
regs->psr = 0;
|
||||
/* Note that target_cpu_copy_regs does not read psr/tstate. */
|
||||
regs->pc = infop->entry;
|
||||
regs->npc = regs->pc + 4;
|
||||
regs->y = 0;
|
||||
regs->u_regs[14] = infop->start_stack - 16 * 4;
|
||||
regs->u_regs[14] = (infop->start_stack - 16 * sizeof(abi_ulong)
|
||||
- TARGET_STACK_BIAS);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#endif /* TARGET_SPARC */
|
||||
|
||||
#ifdef TARGET_PPC
|
||||
|
||||
@@ -1398,6 +1375,39 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
|
||||
regs->gprs[15] = infop->start_stack;
|
||||
}
|
||||
|
||||
/* See linux kernel: arch/s390/include/uapi/asm/ptrace.h (s390_regs). */
|
||||
#define ELF_NREG 27
|
||||
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
|
||||
|
||||
enum {
|
||||
TARGET_REG_PSWM = 0,
|
||||
TARGET_REG_PSWA = 1,
|
||||
TARGET_REG_GPRS = 2,
|
||||
TARGET_REG_ARS = 18,
|
||||
TARGET_REG_ORIG_R2 = 26,
|
||||
};
|
||||
|
||||
static void elf_core_copy_regs(target_elf_gregset_t *regs,
|
||||
const CPUS390XState *env)
|
||||
{
|
||||
int i;
|
||||
uint32_t *aregs;
|
||||
|
||||
(*regs)[TARGET_REG_PSWM] = tswapreg(env->psw.mask);
|
||||
(*regs)[TARGET_REG_PSWA] = tswapreg(env->psw.addr);
|
||||
for (i = 0; i < 16; i++) {
|
||||
(*regs)[TARGET_REG_GPRS + i] = tswapreg(env->regs[i]);
|
||||
}
|
||||
aregs = (uint32_t *)&((*regs)[TARGET_REG_ARS]);
|
||||
for (i = 0; i < 16; i++) {
|
||||
aregs[i] = tswap32(env->aregs[i]);
|
||||
}
|
||||
(*regs)[TARGET_REG_ORIG_R2] = 0;
|
||||
}
|
||||
|
||||
#define USE_ELF_CORE_DUMP
|
||||
#define ELF_EXEC_PAGESIZE 4096
|
||||
|
||||
#endif /* TARGET_S390X */
|
||||
|
||||
#ifdef TARGET_RISCV
|
||||
@@ -3399,7 +3409,6 @@ static size_t note_size(const struct memelfnote *);
|
||||
static void free_note_info(struct elf_note_info *);
|
||||
static int fill_note_info(struct elf_note_info *, long, const CPUArchState *);
|
||||
static void fill_thread_info(struct elf_note_info *, const CPUArchState *);
|
||||
static int core_dump_filename(const TaskState *, char *, size_t);
|
||||
|
||||
static int dump_write(int, const void *, size_t);
|
||||
static int write_note(struct memelfnote *, int);
|
||||
@@ -3642,11 +3651,12 @@ static int fill_psinfo(struct target_elf_prpsinfo *psinfo, const TaskState *ts)
|
||||
|
||||
(void) memset(psinfo, 0, sizeof (*psinfo));
|
||||
|
||||
len = ts->info->arg_end - ts->info->arg_start;
|
||||
len = ts->info->env_strings - ts->info->arg_strings;
|
||||
if (len >= ELF_PRARGSZ)
|
||||
len = ELF_PRARGSZ - 1;
|
||||
if (copy_from_user(&psinfo->pr_psargs, ts->info->arg_start, len))
|
||||
if (copy_from_user(&psinfo->pr_psargs, ts->info->arg_strings, len)) {
|
||||
return -EFAULT;
|
||||
}
|
||||
for (i = 0; i < len; i++)
|
||||
if (psinfo->pr_psargs[i] == 0)
|
||||
psinfo->pr_psargs[i] = ' ';
|
||||
@@ -3698,32 +3708,16 @@ static void fill_auxv_note(struct memelfnote *note, const TaskState *ts)
|
||||
* for the name:
|
||||
* qemu_<basename-of-target-binary>_<date>-<time>_<pid>.core
|
||||
*
|
||||
* Returns 0 in case of success, -1 otherwise (errno is set).
|
||||
* Returns the filename
|
||||
*/
|
||||
static int core_dump_filename(const TaskState *ts, char *buf,
|
||||
size_t bufsize)
|
||||
static char *core_dump_filename(const TaskState *ts)
|
||||
{
|
||||
char timestamp[64];
|
||||
char *base_filename = NULL;
|
||||
struct timeval tv;
|
||||
struct tm tm;
|
||||
g_autoptr(GDateTime) now = g_date_time_new_now_local();
|
||||
g_autofree char *nowstr = g_date_time_format(now, "%Y%m%d-%H%M%S");
|
||||
g_autofree char *base_filename = g_path_get_basename(ts->bprm->filename);
|
||||
|
||||
assert(bufsize >= PATH_MAX);
|
||||
|
||||
if (gettimeofday(&tv, NULL) < 0) {
|
||||
(void) fprintf(stderr, "unable to get current timestamp: %s",
|
||||
strerror(errno));
|
||||
return (-1);
|
||||
}
|
||||
|
||||
base_filename = g_path_get_basename(ts->bprm->filename);
|
||||
(void) strftime(timestamp, sizeof (timestamp), "%Y%m%d-%H%M%S",
|
||||
localtime_r(&tv.tv_sec, &tm));
|
||||
(void) snprintf(buf, bufsize, "qemu_%s_%s_%d.core",
|
||||
base_filename, timestamp, (int)getpid());
|
||||
g_free(base_filename);
|
||||
|
||||
return (0);
|
||||
return g_strdup_printf("qemu_%s_%s_%d.core",
|
||||
base_filename, nowstr, (int)getpid());
|
||||
}
|
||||
|
||||
static int dump_write(int fd, const void *ptr, size_t size)
|
||||
@@ -3951,7 +3945,7 @@ static int elf_core_dump(int signr, const CPUArchState *env)
|
||||
const CPUState *cpu = env_cpu((CPUArchState *)env);
|
||||
const TaskState *ts = (const TaskState *)cpu->opaque;
|
||||
struct vm_area_struct *vma = NULL;
|
||||
char corefile[PATH_MAX];
|
||||
g_autofree char *corefile = NULL;
|
||||
struct elf_note_info info;
|
||||
struct elfhdr elf;
|
||||
struct elf_phdr phdr;
|
||||
@@ -3968,8 +3962,7 @@ static int elf_core_dump(int signr, const CPUArchState *env)
|
||||
if (dumpsize.rlim_cur == 0)
|
||||
return 0;
|
||||
|
||||
if (core_dump_filename(ts, corefile, sizeof (corefile)) < 0)
|
||||
return (-errno);
|
||||
corefile = core_dump_filename(ts);
|
||||
|
||||
if ((fd = open(corefile, O_WRONLY | O_CREAT,
|
||||
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0)
|
||||
|
||||
@@ -260,11 +260,7 @@ long do_rt_sigreturn(CPUHexagonState *env)
|
||||
}
|
||||
|
||||
restore_ucontext(env, &frame->uc);
|
||||
|
||||
if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe,
|
||||
uc.uc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) {
|
||||
goto badframe;
|
||||
}
|
||||
target_restore_altstack(&frame->uc.uc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
@@ -187,13 +187,7 @@ long do_rt_sigreturn(CPUArchState *env)
|
||||
set_sigmask(&set);
|
||||
|
||||
restore_sigcontext(env, &frame->uc.tuc_mcontext);
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
|
||||
if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe,
|
||||
uc.tuc_stack),
|
||||
0, env->gr[30]) == -EFAULT) {
|
||||
goto badframe;
|
||||
}
|
||||
target_restore_altstack(&frame->uc.tuc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
@@ -581,10 +581,7 @@ long do_rt_sigreturn(CPUX86State *env)
|
||||
goto badframe;
|
||||
}
|
||||
|
||||
if (do_sigaltstack(frame_addr + offsetof(struct rt_sigframe, uc.tuc_stack), 0,
|
||||
get_sp_from_cpustate(env)) == -EFAULT) {
|
||||
goto badframe;
|
||||
}
|
||||
target_restore_altstack(&frame->uc.tuc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
@@ -400,10 +400,7 @@ long do_rt_sigreturn(CPUM68KState *env)
|
||||
if (target_rt_restore_ucontext(env, &frame->uc))
|
||||
goto badframe;
|
||||
|
||||
if (do_sigaltstack(frame_addr +
|
||||
offsetof(struct target_rt_sigframe, uc.tuc_stack),
|
||||
0, get_sp_from_cpustate(env)) == -EFAULT)
|
||||
goto badframe;
|
||||
target_restore_altstack(&frame->uc.tuc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
@@ -205,7 +205,6 @@ CPUArchState *cpu_copy(CPUArchState *env)
|
||||
CPUState *new_cpu = cpu_create(cpu_type);
|
||||
CPUArchState *new_env = new_cpu->env_ptr;
|
||||
CPUBreakpoint *bp;
|
||||
CPUWatchpoint *wp;
|
||||
|
||||
/* Reset non arch specific state */
|
||||
cpu_reset(new_cpu);
|
||||
@@ -217,13 +216,9 @@ CPUArchState *cpu_copy(CPUArchState *env)
|
||||
Note: Once we support ptrace with hw-debug register access, make sure
|
||||
BP_CPU break/watchpoints are handled correctly on clone. */
|
||||
QTAILQ_INIT(&new_cpu->breakpoints);
|
||||
QTAILQ_INIT(&new_cpu->watchpoints);
|
||||
QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) {
|
||||
cpu_breakpoint_insert(new_cpu, bp->pc, bp->flags, NULL);
|
||||
}
|
||||
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
|
||||
cpu_watchpoint_insert(new_cpu, wp->vaddr, wp->len, wp->flags, NULL);
|
||||
}
|
||||
|
||||
return new_env;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ subdir('mips')
|
||||
subdir('ppc')
|
||||
subdir('s390x')
|
||||
subdir('sh4')
|
||||
subdir('sparc64')
|
||||
subdir('sparc')
|
||||
subdir('x86_64')
|
||||
subdir('xtensa')
|
||||
|
||||
@@ -209,11 +209,7 @@ long do_rt_sigreturn(CPUMBState *env)
|
||||
|
||||
restore_sigcontext(&frame->uc.tuc_mcontext, env);
|
||||
|
||||
if (do_sigaltstack(frame_addr +
|
||||
offsetof(struct target_rt_sigframe, uc.tuc_stack),
|
||||
0, get_sp_from_cpustate(env)) == -EFAULT) {
|
||||
goto badframe;
|
||||
}
|
||||
target_restore_altstack(&frame->uc.tuc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
@@ -368,11 +368,7 @@ long do_rt_sigreturn(CPUMIPSState *env)
|
||||
set_sigmask(&blocked);
|
||||
|
||||
restore_sigcontext(env, &frame->rs_uc.tuc_mcontext);
|
||||
|
||||
if (do_sigaltstack(frame_addr +
|
||||
offsetof(struct target_rt_sigframe, rs_uc.tuc_stack),
|
||||
0, get_sp_from_cpustate(env)) == -EFAULT)
|
||||
goto badframe;
|
||||
target_restore_altstack(&frame->rs_uc.tuc_stack, env);
|
||||
|
||||
env->active_tc.PC = env->CP0_EPC;
|
||||
mips_set_hflags_isa_mode_from_pc(env);
|
||||
|
||||
@@ -82,9 +82,7 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc,
|
||||
int *pr2)
|
||||
{
|
||||
int temp;
|
||||
abi_ulong off, frame_addr = env->regs[R_SP];
|
||||
unsigned long *gregs = uc->tuc_mcontext.gregs;
|
||||
int err;
|
||||
|
||||
/* Always make any pending restarted system calls return -EINTR */
|
||||
/* current->restart_block.fn = do_no_restart_syscall; */
|
||||
@@ -130,11 +128,7 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc,
|
||||
__get_user(env->regs[R_RA], &gregs[23]);
|
||||
__get_user(env->regs[R_SP], &gregs[28]);
|
||||
|
||||
off = offsetof(struct target_rt_sigframe, uc.tuc_stack);
|
||||
err = do_sigaltstack(frame_addr + off, 0, get_sp_from_cpustate(env));
|
||||
if (err == -EFAULT) {
|
||||
return 1;
|
||||
}
|
||||
target_restore_altstack(&uc->tuc_stack, env);
|
||||
|
||||
*pr2 = env->regs[2];
|
||||
return 0;
|
||||
|
||||
@@ -158,10 +158,7 @@ long do_rt_sigreturn(CPUOpenRISCState *env)
|
||||
set_sigmask(&set);
|
||||
|
||||
restore_sigcontext(env, &frame->uc.tuc_mcontext);
|
||||
if (do_sigaltstack(frame_addr + offsetof(target_rt_sigframe, uc.tuc_stack),
|
||||
0, frame_addr) == -EFAULT) {
|
||||
goto badframe;
|
||||
}
|
||||
target_restore_altstack(&frame->uc.tuc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return cpu_get_gpr(env, 11);
|
||||
|
||||
@@ -655,9 +655,7 @@ long do_rt_sigreturn(CPUPPCState *env)
|
||||
if (do_setcontext(&rt_sf->uc, env, 1))
|
||||
goto sigsegv;
|
||||
|
||||
do_sigaltstack(rt_sf_addr
|
||||
+ offsetof(struct target_rt_sigframe, uc.tuc_stack),
|
||||
0, env->gpr[1]);
|
||||
target_restore_altstack(&rt_sf->uc.tuc_stack, env);
|
||||
|
||||
unlock_user_struct(rt_sf, rt_sf_addr, 1);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
+2
-1
@@ -432,7 +432,8 @@ int target_to_host_signal(int sig);
|
||||
int host_to_target_signal(int sig);
|
||||
long do_sigreturn(CPUArchState *env);
|
||||
long do_rt_sigreturn(CPUArchState *env);
|
||||
abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp);
|
||||
abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr,
|
||||
CPUArchState *env);
|
||||
int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset);
|
||||
abi_long do_swapcontext(CPUArchState *env, abi_ulong uold_ctx,
|
||||
abi_ulong unew_ctx, abi_long ctx_size);
|
||||
|
||||
@@ -192,11 +192,7 @@ long do_rt_sigreturn(CPURISCVState *env)
|
||||
}
|
||||
|
||||
restore_ucontext(env, &frame->uc);
|
||||
|
||||
if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe,
|
||||
uc.uc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) {
|
||||
goto badframe;
|
||||
}
|
||||
target_restore_altstack(&frame->uc.uc_stack, env);
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 0);
|
||||
return -TARGET_QEMU_ESIGRETURN;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user