[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] linux-user/riscv: fix up struct target_ucontext definition

From: LIU Zhiwei
Subject: Re: [PATCH] linux-user/riscv: fix up struct target_ucontext definition
Date: Thu, 23 Apr 2020 09:55:13 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 2020/4/22 12:10, Richard Henderson wrote:
On 4/21/20 7:34 PM, LIU Zhiwei wrote:

When I port RISU, I find this bug. I can't get the correct registers from the
struct ucontext_t parameter in the signal handler.
The RISC-V Linux ABI will need to be extended to handle RVV state.

There is room in your sigcontext structure:

struct __riscv_q_ext_state {
         __u64 f[64] __attribute__((aligned(16)));
         __u32 fcsr;
          * Reserved for expansion of sigcontext structure.  Currently zeroed
          * upon signal, and must be zero upon sigreturn.
         __u32 reserved[3];
in uc->uc_mcontext.sc_fpregs.q.

That reserved field is going to have to be used in some way.

My suggestion is to use some sort of extendable record list, akin to AArch64:

struct _aarch64_ctx {
         __u32 magic;
         __u32 size;

One of the 3 zeros could be the total size of the extensions, so that it's easy
to validate the size or memcpy the lot without parsing each individual record.
  The other two zeros could be the first header of the next record.  Which in
this case also allows the payload of that first record to be aligned mod 16,
which could come in handy.

Talk to the risc-v kernel engineers and come up with a plan that includes room
for the next architecture extension as well.  They may have already done so,
but I'm not monitoring the correct mailing list to know.
Hi Richard,

As far as I know, Guo Ren and Greentime are supporting RVV on Linux, based on the v0.7.1 QEMU implementation.
The main problem is that VLEN is not a  fixed number.

Thanks for your advice. I will communicate with them.

When the Linux kernel released with RVV, I will push a new sigcontext structure here.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]