Commit ff74c5a9 authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

parents 8494a397 9e0e2f96
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -618,8 +618,8 @@ static inline void init_thread(struct target_pt_regs *_regs, struct image_info *
{
    _regs->gpr[1] = infop->start_stack;
#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
    _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_addr;
    infop->entry = ldq_raw(infop->entry) + infop->load_addr;
    _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_bias;
    infop->entry = ldq_raw(infop->entry) + infop->load_bias;
#endif
    _regs->nip = infop->entry;
}
@@ -1884,11 +1884,11 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
    info->start_stack = bprm->p;

    /* If we have an interpreter, set that as the program's entry point.
       Copy the load_addr as well, to help PPC64 interpret the entry
       Copy the load_bias as well, to help PPC64 interpret the entry
       point as a function descriptor.  Do this after creating elf tables
       so that we copy the original program entry point into the AUXV.  */
    if (elf_interpreter) {
        info->load_addr = interp_info.load_addr;
        info->load_bias = interp_info.load_bias;
        info->entry = interp_info.entry;
        free(elf_interpreter);
    }
+14 −12
Original line number Diff line number Diff line
@@ -1148,7 +1148,7 @@ void cpu_loop (CPUSPARCState *env)
        case TT_TFAULT:
        case TT_DFAULT:
            {
                info.si_signo = SIGSEGV;
                info.si_signo = TARGET_SIGSEGV;
                info.si_errno = 0;
                /* XXX: check env->error_code */
                info.si_code = TARGET_SEGV_MAPERR;
@@ -1166,7 +1166,7 @@ void cpu_loop (CPUSPARCState *env)
        case TT_TFAULT:
        case TT_DFAULT:
            {
                info.si_signo = SIGSEGV;
                info.si_signo = TARGET_SIGSEGV;
                info.si_errno = 0;
                /* XXX: check env->error_code */
                info.si_code = TARGET_SEGV_MAPERR;
@@ -1191,6 +1191,15 @@ void cpu_loop (CPUSPARCState *env)
        case EXCP_INTERRUPT:
            /* just indicate that signals should be handled asap */
            break;
        case TT_ILL_INSN:
            {
                info.si_signo = TARGET_SIGILL;
                info.si_errno = 0;
                info.si_code = TARGET_ILL_ILLOPC;
                info._sifields._sigfault._addr = env->pc;
                queue_signal(env, info.si_signo, &info);
            }
            break;
        case EXCP_DEBUG:
            {
                int sig;
@@ -1332,7 +1341,7 @@ void cpu_loop(CPUPPCState *env)
{
    target_siginfo_t info;
    int trapnr;
    uint32_t ret;
    target_ulong ret;

    for(;;) {
        cpu_exec_start(env);
@@ -1695,27 +1704,20 @@ void cpu_loop(CPUPPCState *env)
             * PPC ABI uses overflow flag in cr0 to signal an error
             * in syscalls.
             */
#if 0
            printf("syscall %d 0x%08x 0x%08x 0x%08x 0x%08x\n", env->gpr[0],
                   env->gpr[3], env->gpr[4], env->gpr[5], env->gpr[6]);
#endif
            env->crf[0] &= ~0x1;
            ret = do_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4],
                             env->gpr[5], env->gpr[6], env->gpr[7],
                             env->gpr[8], 0, 0);
            if (ret == (uint32_t)(-TARGET_QEMU_ESIGRETURN)) {
            if (ret == (target_ulong)(-TARGET_QEMU_ESIGRETURN)) {
                /* Returning from a successful sigreturn syscall.
                   Avoid corrupting register state.  */
                break;
            }
            if (ret > (uint32_t)(-515)) {
            if (ret > (target_ulong)(-515)) {
                env->crf[0] |= 0x1;
                ret = -ret;
            }
            env->gpr[3] = ret;
#if 0
            printf("syscall returned 0x%08x (%d)\n", ret, ret);
#endif
            break;
        case POWERPC_EXCP_STCX:
            if (do_store_exclusive(env)) {
+12 −0
Original line number Diff line number Diff line
@@ -9,6 +9,12 @@ typedef int32_t abi_long;
#define TARGET_ABI_FMT_ld "%d"
#define TARGET_ABI_FMT_lu "%u"
#define TARGET_ABI_BITS 32

static inline abi_ulong tswapal(abi_ulong v)
{
    return tswap32(v);
}

#else
typedef target_ulong abi_ulong;
typedef target_long abi_long;
@@ -20,5 +26,11 @@ typedef target_long abi_long;
#if TARGET_ABI_BITS == 32
#define TARGET_ABI32 1
#endif

static inline abi_ulong tswapal(abi_ulong v)
{
    return tswapl(v);
}

#endif
#endif
+11 −11
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ void host_to_target_sigset(target_sigset_t *d, const sigset_t *s)

    host_to_target_sigset_internal(&d1, s);
    for(i = 0;i < TARGET_NSIG_WORDS; i++)
        d->sig[i] = tswapl(d1.sig[i]);
        d->sig[i] = tswapal(d1.sig[i]);
}

static void target_to_host_sigset_internal(sigset_t *d,
@@ -173,7 +173,7 @@ void target_to_host_sigset(sigset_t *d, const target_sigset_t *s)
    int i;

    for(i = 0;i < TARGET_NSIG_WORDS; i++)
        s1.sig[i] = tswapl(s->sig[i]);
        s1.sig[i] = tswapal(s->sig[i]);
    target_to_host_sigset_internal(d, &s1);
}

@@ -234,14 +234,14 @@ static void tswap_siginfo(target_siginfo_t *tinfo,
    if (sig == SIGILL || sig == SIGFPE || sig == SIGSEGV ||
        sig == SIGBUS || sig == SIGTRAP) {
        tinfo->_sifields._sigfault._addr =
            tswapl(info->_sifields._sigfault._addr);
            tswapal(info->_sifields._sigfault._addr);
    } else if (sig == SIGIO) {
	tinfo->_sifields._sigpoll._fd = tswap32(info->_sifields._sigpoll._fd);
    } else if (sig >= TARGET_SIGRTMIN) {
        tinfo->_sifields._rt._pid = tswap32(info->_sifields._rt._pid);
        tinfo->_sifields._rt._uid = tswap32(info->_sifields._rt._uid);
        tinfo->_sifields._rt._sigval.sival_ptr =
            tswapl(info->_sifields._rt._sigval.sival_ptr);
            tswapal(info->_sifields._rt._sigval.sival_ptr);
    }
}

@@ -262,7 +262,7 @@ void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo)
    info->si_pid = tswap32(tinfo->_sifields._rt._pid);
    info->si_uid = tswap32(tinfo->_sifields._rt._uid);
    info->si_value.sival_ptr =
            (void *)(long)tswapl(tinfo->_sifields._rt._sigval.sival_ptr);
            (void *)(long)tswapal(tinfo->_sifields._rt._sigval.sival_ptr);
}

static int fatal_signal (int sig)
@@ -586,19 +586,19 @@ int do_sigaction(int sig, const struct target_sigaction *act,
            sig, act, oact);
#endif
    if (oact) {
        oact->_sa_handler = tswapl(k->_sa_handler);
        oact->sa_flags = tswapl(k->sa_flags);
        oact->_sa_handler = tswapal(k->_sa_handler);
        oact->sa_flags = tswapal(k->sa_flags);
#if !defined(TARGET_MIPS)
        oact->sa_restorer = tswapl(k->sa_restorer);
        oact->sa_restorer = tswapal(k->sa_restorer);
#endif
        oact->sa_mask = k->sa_mask;
    }
    if (act) {
        /* FIXME: This is not threadsafe.  */
        k->_sa_handler = tswapl(act->_sa_handler);
        k->sa_flags = tswapl(act->sa_flags);
        k->_sa_handler = tswapal(act->_sa_handler);
        k->sa_flags = tswapal(act->sa_flags);
#if !defined(TARGET_MIPS)
        k->sa_restorer = tswapl(act->sa_restorer);
        k->sa_restorer = tswapal(act->sa_restorer);
#endif
        k->sa_mask = act->sa_mask;

+3 −0
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@
#define TARGET_NR_utimes             138 /* SunOS Specific                              */
#define TARGET_NR_stat64		139 /* Linux sparc32 Specific			   */
#define TARGET_NR_getpeername        141 /* Common                                      */
#define TARGET_NR_futex              142 /* gethostid under SunOS                       */
#define TARGET_NR_gettid             143 /* ENOSYS under SunOS                          */
#define TARGET_NR_getrlimit          144 /* Common                                      */
#define TARGET_NR_setrlimit          145 /* Common                                      */
@@ -153,6 +154,7 @@
#define TARGET_NR_getdomainname      162 /* SunOS Specific                              */
#define TARGET_NR_setdomainname      163 /* Common                                      */
#define TARGET_NR_quotactl           165 /* Common                                      */
#define TARGET_NR_set_tid_address    166 /* Linux specific, exportfs under SunOS        */
#define TARGET_NR_mount              167 /* Common                                      */
#define TARGET_NR_ustat              168 /* Common                                      */
#define TARGET_NR_getdents           174 /* Common                                      */
@@ -177,6 +179,7 @@
#define TARGET_NR_readahead          205 /* Linux Specific                              */
#define TARGET_NR_socketcall         206 /* Linux Specific                              */
#define TARGET_NR_syslog             207 /* Linux Specific                              */
#define TARGET_NR_tgkill             211 /* Linux Specific                              */
#define TARGET_NR_waitpid            212 /* Linux Specific                              */
#define TARGET_NR_swapoff            213 /* Linux Specific                              */
#define TARGET_NR_sysinfo            214 /* Linux Specific                              */
Loading