[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v2 4/6] target/mips: Add native library calls
From: |
Richard Henderson |
Subject: |
Re: [RFC v2 4/6] target/mips: Add native library calls |
Date: |
Wed, 7 Jun 2023 12:15:45 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 |
On 6/7/23 09:47, Yeqi Fu wrote:
+void helper_native_memcpy(CPUMIPSState *env)
+{
+ CPUState *cs = env_cpu(env);
+ NATIVE_FN_W_3W();
+ void *ret;
+ void *dest = g2h(cs, arg0);
+ void *src = g2h(cs, arg1);
+ size_t n = (size_t)arg2;
+ ret = memcpy(dest, src, n);
+ env->active_tc.gpr[2] = (target_ulong)h2g(ret);
+}
I would expect everything except for the guest ABI to be handled by common code, so that
you do not have N copies of every native emulated function. This needs to be something like
abi_ptr do_native_memcpy(CPUArchState *env, abi_ptr dst, abi_ptr src,
abi_ptr len, uintptr_t ra);
void helper_native_memcpy(CPUMIPSState *env)
{
env->active_tc.gpr[2] =
do_native_memcpy(env, env->active_tc.gpr[4],
env->active_tc.gpr[5],
env->active_tc.gpr[6], GETPC());
}
Even better, provide some guest abstraction akin to va_start/va_arg so that all of the
per-native function code becomes shared.
r~
- [RFC v2 3/6] target/i386: Add native library calls, (continued)
- [RFC v2 3/6] target/i386: Add native library calls, Yeqi Fu, 2023/06/07
- [RFC v2 1/6] build: Add configure options for native calls, Yeqi Fu, 2023/06/07
- [RFC v2 5/6] target/arm: Add native library calls, Yeqi Fu, 2023/06/07
- [RFC v2 2/6] Add the libnative library, Yeqi Fu, 2023/06/07
- [RFC v2 6/6] linux-user: Add '-native-bypass' option, Yeqi Fu, 2023/06/07
- [RFC v2 4/6] target/mips: Add native library calls, Yeqi Fu, 2023/06/07
- Re: [RFC v2 4/6] target/mips: Add native library calls,
Richard Henderson <=