qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Yeqi Fu <fufuyqqqqqq@gmail.com>, alex.bennee@linaro.org
Cc: richard.henderson@linaro.org, qemu-devel@nongnu.org,
	Aurelien Jarno <aurelien@aurel32.net>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>
Subject: Re: [RFC v3 08/10] target/mips: Add support for native library calls
Date: Sun, 25 Jun 2023 23:53:52 +0200	[thread overview]
Message-ID: <4ee66b35-5cf5-97d8-eca9-0e882e255c7c@linaro.org> (raw)
In-Reply-To: <20230625212707.1078951-9-fufuyqqqqqq@gmail.com>

On 25/6/23 23:27, Yeqi Fu wrote:
> 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/mips/tcg/translate.c | 26 ++++++++++++++++++++++++++
>   target/mips/tcg/translate.h |  2 ++
>   2 files changed, 28 insertions(+)
> 
> diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
> index a6ca2e5a3b..15ab889dca 100644
> --- a/target/mips/tcg/translate.c
> +++ b/target/mips/tcg/translate.c
> @@ -36,6 +36,7 @@
>   #include "qemu/qemu-print.h"
>   #include "fpu_helper.h"
>   #include "translate.h"
> +#include "native/native-defs.h"
>   
>   /*
>    * Many sysemu-only helpers are not reachable for user-only.
> @@ -13592,6 +13593,31 @@ static void decode_opc_special(CPUMIPSState *env, DisasContext *ctx)
>   #endif
>           break;
>       case OPC_SYSCALL:
> +        uint32_t sig = (ctx->opcode) >> 6;

            if (native_call_enabled() && sig) {
                if (ctx->native_call_status) {
                    ...
                } else {
                    ...
                }
                break;
            }

> +        if (native_call_enabled() && (!ctx->native_call_status) && sig) {
> +            ctx->native_call_status = true;
> +            ctx->native_call_id = sig;
> +            break;
> +        } else if (native_call_enabled() && (ctx->native_call_status) && sig) {
> +            TCGv arg1 = tcg_temp_new();
> +            TCGv arg2 = tcg_temp_new();
> +            TCGv arg3 = tcg_temp_new();
> +
> +            tcg_gen_mov_tl(arg1, cpu_gpr[4]);
> +            tcg_gen_mov_tl(arg2, cpu_gpr[5]);
> +            tcg_gen_mov_tl(arg3, cpu_gpr[6]);
> +
> +            TCGv_i32 abi_map = tcg_constant_i32(sig);
> +            TCGv_i32 func_id = tcg_constant_i32(ctx->native_call_id);
> +            TCGv res = tcg_temp_new();
> +            TCGv_i32 mmu_idx = tcg_constant_i32(MMU_USER_IDX);
> +            gen_helper_native_call(res, cpu_env, arg1, arg2, arg3,
> +                                    abi_map, func_id, mmu_idx);
> +            tcg_gen_mov_tl(cpu_gpr[2], res);
> +            ctx->native_call_status = false;
> +            ctx->native_call_id = 0;
> +            break;
> +        }
>           generate_exception_end(ctx, EXCP_SYSCALL);
>           break;
>       case OPC_BREAK:



  reply	other threads:[~2023-06-25 21:54 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é [this message]
2023-06-25 21:27 ` [RFC v3 09/10] target/arm: " Yeqi Fu
2023-07-03 12:13   ` Alex Bennée
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=4ee66b35-5cf5-97d8-eca9-0e882e255c7c@linaro.org \
    --to=philmd@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=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 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).