From: Richard Henderson <richard.henderson@linaro.org>
To: Yeqi Fu <fufuyqqqqqq@gmail.com>, alex.bennee@linaro.org
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>
Subject: Re: [RFC v2 4/6] target/mips: Add native library calls
Date: Wed, 7 Jun 2023 12:15:45 -0700 [thread overview]
Message-ID: <a7d4ae32-a779-e50a-d484-fdfc07a305c1@linaro.org> (raw)
In-Reply-To: <20230607164750.829586-5-fufuyqqqqqq@gmail.com>
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~
next prev parent reply other threads:[~2023-06-07 19:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 16:47 [RFC v2 0/6] Native Library Calls Yeqi Fu
2023-06-07 16:47 ` [RFC v2 1/6] build: Add configure options for native calls Yeqi Fu
2023-06-09 5:08 ` Manos Pitsidianakis
2023-06-12 11:54 ` Alex Bennée
2023-06-12 13:02 ` Alex Bennée
2023-06-07 16:47 ` [RFC v2 2/6] Add the libnative library Yeqi Fu
2023-06-15 7:59 ` Alex Bennée
2023-06-07 16:47 ` [RFC v2 3/6] target/i386: Add native library calls Yeqi Fu
2023-06-07 19:08 ` Richard Henderson
2023-06-07 19:19 ` Richard Henderson
2023-06-07 16:47 ` [RFC v2 4/6] target/mips: " Yeqi Fu
2023-06-07 19:15 ` Richard Henderson [this message]
2023-06-07 16:47 ` [RFC v2 5/6] target/arm: " Yeqi Fu
2023-06-07 16:47 ` [RFC v2 6/6] linux-user: Add '-native-bypass' option Yeqi Fu
2023-06-09 5:24 ` Manos Pitsidianakis
2023-06-12 13:06 ` Alex Bennée
2023-06-12 13:23 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a7d4ae32-a779-e50a-d484-fdfc07a305c1@linaro.org \
--to=richard.henderson@linaro.org \
--cc=aleksandar.rikalo@syrmia.com \
--cc=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=fufuyqqqqqq@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).