qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: gaosong <gaosong@loongson.cn>, qemu-devel@nongnu.org
Cc: laurent@vivier.eu, Xiaojuan Yang <yangxiaojuan@loongson.cn>
Subject: Re: [PATCH v18 02/13] linux-user: Add LoongArch signal support
Date: Tue, 21 Jun 2022 07:12:16 -0700	[thread overview]
Message-ID: <ddfbcffc-dabd-d7e7-03fc-924e8048de42@linaro.org> (raw)
In-Reply-To: <978a16a0-8d4b-411d-5235-475aa2804857@loongson.cn>

On 6/20/22 20:56, gaosong wrote:
>> This is missing lock_user/unlock_user somewhere.
>> You can't use the double-underscore __get/__put_user without having done that.
>>
> My understanding is that the struct exctx need lock_user_struct/unlock_user_struct,  then 
> we can use __get/__put the struct extctx.

No, extctx does not exist in target memory.  It is purely local to the signal 
implementation as a way of tracking the layout.

>> This is why I suggested statically allocating the extra
>> pieces of the signal frame *on write*.  You obviously
>> cannot rely on the signal frame being identical on
>> signal return -- the guest is allowed to create any valid
>> context to give to rt_sigreturn.
>>
> I don’t know if my understanding is correct,
> 
> we can put the exctx or target_fpu_context into target_rt_sigframe, like this:
> struct target_rt_sigframe {
>      struct target_siginfo rs_info;
>      struct target_ucontext rs_uc;
>      struct extctx_layout rs_ext;
> };

No.

You need to look at what the code in setup_extcontext does.
It allocates two sctx_info and one fpu_context on the stack.
Thus the structure would look like

struct target_rt_sigframe {
     struct target_siginfo rs_info;
     struct target_ucontext rs_uc;
     struct sctx_info rs_fpu_info QEMU_ALIGNED(16);
     struct target_fp_context rs_fpu;
     struct sctx_info rs_end_info QEMU_ALIGNED(16);
};


r~


  reply	other threads:[~2022-06-21 14:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  9:33 [PATCH v18 00/13] Add LoongArch linux-user emulation support Song Gao
2022-06-20  9:33 ` [PATCH v18 01/13] linux-user: Add LoongArch generic header files Song Gao
2022-06-20  9:33 ` [PATCH v18 02/13] linux-user: Add LoongArch signal support Song Gao
2022-06-20 16:23   ` Richard Henderson
2022-06-21  3:56     ` gaosong
2022-06-21 14:12       ` Richard Henderson [this message]
2022-06-20  9:33 ` [PATCH v18 03/13] linux-user: Add LoongArch elf support Song Gao
2022-06-20  9:33 ` [PATCH v18 04/13] linux-user: Add LoongArch syscall support Song Gao
2022-06-20  9:33 ` [PATCH v18 05/13] linux-user: Add LoongArch cpu_loop support Song Gao
2022-06-20  9:33 ` [PATCH v18 06/13] scripts: add loongarch64 binfmt config Song Gao
2022-06-20  9:33 ` [PATCH v18 07/13] target/loongarch: remove badaddr from CPULoongArch Song Gao
2022-06-20  9:33 ` [PATCH v18 08/13] target/loongarch: Fix missing update CSR_BADV Song Gao
2022-06-20  9:33 ` [PATCH v18 09/13] target/loongarch: Fix helper_asrtle_d/asrtgt_d raise wrong exception Song Gao
2022-06-20  9:33 ` [PATCH v18 10/13] target/loongarch: remove unused include hw/loader.h Song Gao
2022-06-20  9:33 ` [PATCH v18 11/13] target/loongarch: Adjust functions and structure to support user-mode Song Gao
2022-06-20  9:34 ` [PATCH v18 12/13] default-configs: Add loongarch linux-user support Song Gao
2022-06-20  9:34 ` [PATCH v18 13/13] target/loongarch: Update README Song Gao

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=ddfbcffc-dabd-d7e7-03fc-924e8048de42@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=gaosong@loongson.cn \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=yangxiaojuan@loongson.cn \
    /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).