linux-user/e2k: do nothing if wsz is zero in syscall

This commit is contained in:
Denis Drakhnia 2023-12-26 15:00:57 +02:00
parent 7885b8558a
commit 39039c5554

View File

@ -73,11 +73,12 @@ void cpu_loop(CPUE2KState *env)
switch (trapnr) {
case E2K_EXCP_SYSCALL: {
abi_ullong args[E2K_SYSCALL_MAX_ARGS] = { 0 };
int i, psize = MIN(E2K_SYSCALL_MAX_ARGS, env->wd.size);
abi_ulong ret;
int psize = MIN(E2K_SYSCALL_MAX_ARGS, env->wd.size);
if (psize) {
abi_ullong ret, args[E2K_SYSCALL_MAX_ARGS] = { 0 };
int i;
// TODO: check what happens if env->wd.size is zero
for (i = 0; i < psize; i++) {
args[i] = env->regs[i].lo;
}
@ -95,6 +96,9 @@ void cpu_loop(CPUE2KState *env)
env->tags[0] = E2K_TAG_NUMBER64;
env->ip = E2K_SYSRET_ADDR;
}
} else {
env->ip = E2K_SYSRET_ADDR;
}
break;
}
case E2K_EXCP_ILLEGAL_OPCODE: