mirror of https://github.com/xqemu/xqemu.git
mips-linux-user: Fix n32 and n64 syscalls
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
parent
084d0497a0
commit
ff4f738281
|
@ -1787,8 +1787,8 @@ void cpu_loop(CPUPPCState *env)
|
||||||
|
|
||||||
#ifdef TARGET_MIPS
|
#ifdef TARGET_MIPS
|
||||||
|
|
||||||
#define MIPS_SYS(name, args) args,
|
# ifdef TARGET_ABI_MIPSO32
|
||||||
|
# define MIPS_SYS(name, args) args,
|
||||||
static const uint8_t mips_syscall_args[] = {
|
static const uint8_t mips_syscall_args[] = {
|
||||||
MIPS_SYS(sys_syscall , 8) /* 4000 */
|
MIPS_SYS(sys_syscall , 8) /* 4000 */
|
||||||
MIPS_SYS(sys_exit , 1)
|
MIPS_SYS(sys_exit , 1)
|
||||||
|
@ -2134,8 +2134,8 @@ static const uint8_t mips_syscall_args[] = {
|
||||||
MIPS_SYS(sys_clock_adjtime, 2)
|
MIPS_SYS(sys_clock_adjtime, 2)
|
||||||
MIPS_SYS(sys_syncfs, 1)
|
MIPS_SYS(sys_syncfs, 1)
|
||||||
};
|
};
|
||||||
|
# undef MIPS_SYS
|
||||||
#undef MIPS_SYS
|
# endif /* O32 */
|
||||||
|
|
||||||
static int do_store_exclusive(CPUMIPSState *env)
|
static int do_store_exclusive(CPUMIPSState *env)
|
||||||
{
|
{
|
||||||
|
@ -2217,8 +2217,11 @@ void cpu_loop(CPUMIPSState *env)
|
||||||
{
|
{
|
||||||
CPUState *cs = CPU(mips_env_get_cpu(env));
|
CPUState *cs = CPU(mips_env_get_cpu(env));
|
||||||
target_siginfo_t info;
|
target_siginfo_t info;
|
||||||
int trapnr, ret;
|
int trapnr;
|
||||||
|
abi_long ret;
|
||||||
|
# ifdef TARGET_ABI_MIPSO32
|
||||||
unsigned int syscall_num;
|
unsigned int syscall_num;
|
||||||
|
# endif
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
cpu_exec_start(cs);
|
cpu_exec_start(cs);
|
||||||
|
@ -2226,8 +2229,9 @@ void cpu_loop(CPUMIPSState *env)
|
||||||
cpu_exec_end(cs);
|
cpu_exec_end(cs);
|
||||||
switch(trapnr) {
|
switch(trapnr) {
|
||||||
case EXCP_SYSCALL:
|
case EXCP_SYSCALL:
|
||||||
syscall_num = env->active_tc.gpr[2] - 4000;
|
|
||||||
env->active_tc.PC += 4;
|
env->active_tc.PC += 4;
|
||||||
|
# ifdef TARGET_ABI_MIPSO32
|
||||||
|
syscall_num = env->active_tc.gpr[2] - 4000;
|
||||||
if (syscall_num >= sizeof(mips_syscall_args)) {
|
if (syscall_num >= sizeof(mips_syscall_args)) {
|
||||||
ret = -TARGET_ENOSYS;
|
ret = -TARGET_ENOSYS;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2266,12 +2270,19 @@ void cpu_loop(CPUMIPSState *env)
|
||||||
arg5, arg6, arg7, arg8);
|
arg5, arg6, arg7, arg8);
|
||||||
}
|
}
|
||||||
done_syscall:
|
done_syscall:
|
||||||
|
# else
|
||||||
|
ret = do_syscall(env, env->active_tc.gpr[2],
|
||||||
|
env->active_tc.gpr[4], env->active_tc.gpr[5],
|
||||||
|
env->active_tc.gpr[6], env->active_tc.gpr[7],
|
||||||
|
env->active_tc.gpr[8], env->active_tc.gpr[9],
|
||||||
|
env->active_tc.gpr[10], env->active_tc.gpr[11]);
|
||||||
|
# endif /* O32 */
|
||||||
if (ret == -TARGET_QEMU_ESIGRETURN) {
|
if (ret == -TARGET_QEMU_ESIGRETURN) {
|
||||||
/* Returning from a successful sigreturn syscall.
|
/* Returning from a successful sigreturn syscall.
|
||||||
Avoid clobbering register state. */
|
Avoid clobbering register state. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((unsigned int)ret >= (unsigned int)(-1133)) {
|
if ((abi_ulong)ret >= (abi_ulong)-1133) {
|
||||||
env->active_tc.gpr[7] = 1; /* error flag */
|
env->active_tc.gpr[7] = 1; /* error flag */
|
||||||
ret = -ret;
|
ret = -ret;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue