diff --git a/tcg/tci.c b/tcg/tci.c index d27db9f720..dd0cca296a 100644 --- a/tcg/tci.c +++ b/tcg/tci.c @@ -557,8 +557,15 @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, case 0: /* void */ break; case 1: /* uint32_t */ - regs[TCG_REG_R0] = *(uint32_t *)stack; - break; + /* + * Note that libffi has an odd special case in that it will + * always widen an integral result to ffi_arg. + */ + if (sizeof(ffi_arg) == 4) { + regs[TCG_REG_R0] = *(uint32_t *)stack; + break; + } + /* fall through */ case 2: /* uint64_t */ if (TCG_TARGET_REG_BITS == 32) { tci_write_reg64(regs, TCG_REG_R1, TCG_REG_R0, stack[0]);