From: "Alex Bennée" <alex.bennee@linaro.org>
To: Yeqi Fu <fufuyqqqqqq@gmail.com>
Cc: richard.henderson@linaro.org, qemu-devel@nongnu.org,
Peter Maydell <peter.maydell@linaro.org>,
"open list:ARM TCG CPUs" <qemu-arm@nongnu.org>
Subject: Re: [RFC v3 09/10] target/arm: Add support for native library calls
Date: Mon, 03 Jul 2023 13:13:17 +0100 [thread overview]
Message-ID: <87cz19i457.fsf@linaro.org> (raw)
In-Reply-To: <20230625212707.1078951-10-fufuyqqqqqq@gmail.com>
Yeqi Fu <fufuyqqqqqq@gmail.com> writes:
> Upon encountering specialized instructions reserved for native calls,
> store the function id and argument types, then invoke helper.
>
> Signed-off-by: Yeqi Fu <fufuyqqqqqq@gmail.com>
> ---
> target/arm/tcg/translate-a64.c | 27 ++++++++++++++++++++++++++-
> target/arm/tcg/translate.c | 25 +++++++++++++++++++++++--
> target/arm/tcg/translate.h | 6 ++++++
> 3 files changed, 55 insertions(+), 3 deletions(-)
>
> diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
> index 741a608739..24a664b928 100644
> --- a/target/arm/tcg/translate-a64.c
> +++ b/target/arm/tcg/translate-a64.c
<snip>
> --- a/target/arm/tcg/translate.c
> +++ b/target/arm/tcg/translate.c
> @@ -34,7 +34,7 @@
> #include "exec/helper-gen.h"
> #include "exec/log.h"
> #include "cpregs.h"
> -
> +#include "native/native-defs.h"
>
> #define ENABLE_ARCH_4T arm_dc_feature(s, ARM_FEATURE_V4T)
> #define ENABLE_ARCH_5 arm_dc_feature(s, ARM_FEATURE_V5)
> @@ -58,6 +58,7 @@ TCGv_i32 cpu_CF, cpu_NF, cpu_VF, cpu_ZF;
> TCGv_i64 cpu_exclusive_addr;
> TCGv_i64 cpu_exclusive_val;
>
> +
stray whitespace which will often make re-basing patches a pain.
> #include "exec/gen-icount.h"
>
> static const char * const regnames[] =
> @@ -1147,12 +1148,32 @@ static inline void gen_hlt(DisasContext *s, int imm)
> * semihosting, to provide some semblance of security
> * (and for consistency with our 32-bit semihosting).
> */
> + if (native_call_enabled() && (!s->native_call_status)) {
> + s->native_call_status = true;
> + s->native_call_id = imm;
> + return;
> + } else if (native_call_enabled() && (s->native_call_status)) {
> + TCGv_i32 arg1 = load_reg(s, 0);
> + TCGv_i32 arg2 = load_reg(s, 1);
> + TCGv_i32 arg3 = load_reg(s, 2);
> +
> + TCGv_i32 abi_map = tcg_constant_i32(imm);
> + TCGv_i32 func_id = tcg_constant_i32(s->native_call_id);
> + TCGv_i32 res = tcg_temp_new_i32();
> + TCGv_i32 mmu_idx = tcg_constant_i32(MMU_USER_IDX);
> + gen_helper_native_call_i32(res, cpu_env, arg1, arg2, arg3,
> + abi_map, func_id, mmu_idx);
> +
> + store_reg(s, 0, res);
> + s->native_call_status = false;
> + s->native_call_id = 0;
> + return;
> + }
> if (semihosting_enabled(s->current_el == 0) &&
> (imm == (s->thumb ? 0x3c : 0xf000))) {
> gen_exception_internal_insn(s, EXCP_SEMIHOST);
> return;
> }
> -
also here.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2023-07-03 12:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-25 21:26 [RFC v3 00/10] Native Library Calls Yeqi Fu
2023-06-25 21:26 ` [RFC v3 01/10] docs: Add specification for native library calls Yeqi Fu
2023-07-03 15:04 ` Alex Bennée
2023-06-25 21:26 ` [RFC v3 02/10] build: Add configure options for native calls Yeqi Fu
2023-07-03 15:22 ` Alex Bennée
2023-06-25 21:27 ` [RFC v3 03/10] build: Implement libnative library and configure options Yeqi Fu
2023-06-25 21:47 ` Philippe Mathieu-Daudé
2023-07-03 15:30 ` Alex Bennée
2023-06-25 21:27 ` [RFC v3 04/10] linux-user: Implement envlist_appendenv Yeqi Fu
2023-07-03 16:38 ` Alex Bennée
2023-07-03 16:55 ` Warner Losh
2023-06-25 21:27 ` [RFC v3 05/10] linux-user: Implement native-bypass option support Yeqi Fu
2023-07-03 18:21 ` Alex Bennée
2023-06-25 21:27 ` [RFC v3 06/10] accel/tcg: Add support for native library calls Yeqi Fu
2023-06-25 21:27 ` [RFC v3 07/10] target/i386: " Yeqi Fu
2023-06-25 21:27 ` [RFC v3 08/10] target/mips: " Yeqi Fu
2023-06-25 21:53 ` Philippe Mathieu-Daudé
2023-06-25 21:27 ` [RFC v3 09/10] target/arm: " Yeqi Fu
2023-07-03 12:13 ` Alex Bennée [this message]
2023-06-25 21:27 ` [RFC v3 10/10] tests/tcg/multiarch: Add nativecalls.c test Yeqi Fu
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=87cz19i457.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=fufuyqqqqqq@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.