static void xtensa_overflow4(CPUXtensaState *env) { put_user_ual(env->regs[0], env->regs[5] - 16); put_user_ual(env->regs[1], env->regs[5] - 12); put_user_ual(env->regs[2], env->regs[5] - 8); put_user_ual(env->regs[3], env->regs[5] - 4); xtensa_rfwo(env); }
/* XXX this needs to be emulated on non-FreeBSD hosts... */ static abi_long do_freebsd_sysctl(abi_ulong namep, int32_t namelen, abi_ulong oldp, abi_ulong oldlenp, abi_ulong newp, abi_ulong newlen) { abi_long ret; void *hnamep, *holdp, *hnewp = NULL; size_t holdlen; abi_ulong oldlen = 0; int32_t *snamep = g_malloc(sizeof(int32_t) * namelen), *p, *q, i; uint32_t kind = 0; if (oldlenp) get_user_ual(oldlen, oldlenp); if (!(hnamep = lock_user(VERIFY_READ, namep, namelen, 1))) return -TARGET_EFAULT; if (newp && !(hnewp = lock_user(VERIFY_READ, newp, newlen, 1))) return -TARGET_EFAULT; if (!(holdp = lock_user(VERIFY_WRITE, oldp, oldlen, 0))) return -TARGET_EFAULT; holdlen = oldlen; for (p = hnamep, q = snamep, i = 0; i < namelen; p++, i++) *q++ = tswap32(*p); oidfmt(snamep, namelen, NULL, &kind); /* XXX swap hnewp */ ret = get_errno(sysctl(snamep, namelen, holdp, &holdlen, hnewp, newlen)); if (!ret) sysctl_oldcvt(holdp, holdlen, kind); put_user_ual(holdlen, oldlenp); unlock_user(hnamep, namep, 0); unlock_user(holdp, oldp, holdlen); if (hnewp) unlock_user(hnewp, newp, 0); g_free(snamep); return ret; }
static void xtensa_overflow8(CPUXtensaState *env) { put_user_ual(env->regs[0], env->regs[9] - 16); get_user_ual(env->regs[0], env->regs[1] - 12); put_user_ual(env->regs[1], env->regs[9] - 12); put_user_ual(env->regs[2], env->regs[9] - 8); put_user_ual(env->regs[3], env->regs[9] - 4); put_user_ual(env->regs[4], env->regs[0] - 32); put_user_ual(env->regs[5], env->regs[0] - 28); put_user_ual(env->regs[6], env->regs[0] - 24); put_user_ual(env->regs[7], env->regs[0] - 20); xtensa_rfwo(env); }
/* Construct the envp and argv tables on the target stack. */ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, abi_ulong stringp, int push_ptr) { CPUArchState *env = thread_cpu->env_ptr; TaskState *ts = (TaskState *)env->opaque; int n = sizeof(abi_ulong); abi_ulong envp; abi_ulong argv; sp -= (envc + 1) * n; envp = sp; sp -= (argc + 1) * n; argv = sp; if (push_ptr) { /* FIXME - handle put_user() failures */ sp -= n; put_user_ual(envp, sp); sp -= n; put_user_ual(argv, sp); } sp -= n; /* FIXME - handle put_user() failures */ put_user_ual(argc, sp); #ifdef CONFIG_QTRACE_TAINT qtrace_taint_memory(env, sp, sizeof(target_ulong), QTRACE_TAINT_LABEL_ARG); #endif ts->info->arg_start = stringp; while (argc-- > 0) { /* FIXME - handle put_user() failures */ put_user_ual(stringp, argv); #ifdef CONFIG_QTRACE_TAINT qtrace_taint_memory(env, argv, target_strlen(stringp), QTRACE_TAINT_LABEL_ARG); #endif argv += n; stringp += target_strlen(stringp) + 1; } ts->info->arg_end = stringp; /* FIXME - handle put_user() failures */ put_user_ual(0, argv); while (envc-- > 0) { /* FIXME - handle put_user() failures */ put_user_ual(stringp, envp); #ifdef CONFIG_QTRACE_TAINT qtrace_taint_memory(env, envp, target_strlen(stringp), QTRACE_TAINT_LABEL_ENV); #endif envp += n; stringp += target_strlen(stringp) + 1; } /* FIXME - handle put_user() failures */ put_user_ual(0, envp); return sp; }
/* Construct the envp and argv tables on the target stack. */ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, abi_ulong stringp, int push_ptr) { TaskState *ts = (TaskState *)thread_cpu->opaque; int n = sizeof(abi_ulong); abi_ulong envp; abi_ulong argv; sp -= (envc + 1) * n; envp = sp; sp -= (argc + 1) * n; argv = sp; if (push_ptr) { /* FIXME - handle put_user() failures */ sp -= n; put_user_ual(envp, sp); sp -= n; put_user_ual(argv, sp); } sp -= n; /* FIXME - handle put_user() failures */ put_user_ual(argc, sp); ts->info->arg_start = stringp; while (argc-- > 0) { /* FIXME - handle put_user() failures */ put_user_ual(stringp, argv); argv += n; stringp += target_strlen(stringp) + 1; } ts->info->arg_end = stringp; /* FIXME - handle put_user() failures */ put_user_ual(0, argv); while (envc-- > 0) { /* FIXME - handle put_user() failures */ put_user_ual(stringp, envp); envp += n; stringp += target_strlen(stringp) + 1; } /* FIXME - handle put_user() failures */ put_user_ual(0, envp); return sp; }
/* Construct the envp and argv tables on the target stack. */ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, abi_ulong stringp, int push_ptr) { int n = sizeof(abi_ulong); abi_ulong envp; abi_ulong argv; sp -= (envc + 1) * n; envp = sp; sp -= (argc + 1) * n; argv = sp; if (push_ptr) { /* FIXME - handle put_user() failures */ sp -= n; put_user_ual(envp, sp); sp -= n; put_user_ual(argv, sp); } sp -= n; /* FIXME - handle put_user() failures */ put_user_ual(argc, sp); while (argc-- > 0) { /* FIXME - handle put_user() failures */ put_user_ual(stringp, argv); argv += n; stringp += target_strlen(stringp) + 1; } /* FIXME - handle put_user() failures */ put_user_ual(0, argv); while (envc-- > 0) { /* FIXME - handle put_user() failures */ put_user_ual(stringp, envp); envp += n; stringp += target_strlen(stringp) + 1; } /* FIXME - handle put_user() failures */ put_user_ual(0, envp); return sp; }