qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v9 28/31] common-user: Add safe syscall handling for loongarc


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v9 28/31] common-user: Add safe syscall handling for loongarch64 hosts
Date: Tue, 14 Dec 2021 16:38:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0

On 12/14/21 16:16, WANG Xuerui wrote:
> Hi Philippe,
> 
> On 12/14/21 21:29, Philippe Mathieu-Daudé wrote:
>> On 12/14/21 09:01, WANG Xuerui wrote:
>>> Signed-off-by: WANG Xuerui <git@xen0n.name>
>>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>>> ---
>>>   .../host/loongarch64/safe-syscall.inc.S       | 81 +++++++++++++++++++
>>>   1 file changed, 81 insertions(+)
>>>   create mode 100644 common-user/host/loongarch64/safe-syscall.inc.S

>>> +safe_syscall_start:
>>> +        /* If signal_pending is non-zero, don't do the call */
>>> +        ld.w    $t1, $t0, 0
>>> +        bnez    $t1, 2f
>>> +        syscall 0
>>> +safe_syscall_end:
>>> +        /* code path for having successfully executed the syscall */
>>> +        li.w    $t2, -4096
>>> +        bgtu    $a0, $t2, 0f
>>> +        jr      $ra
>>> +
>>> +        /* code path setting errno */
>>> +0:      sub.d   $a0, $zero, $a0
>>> +        b       safe_syscall_set_errno_tail
>>> +
>>> +        /* code path when we didn't execute the syscall */
>>> +2:      li.w    $a0, QEMU_ERESTARTSYS
>>> +        b       safe_syscall_set_errno_tail
>>> +        .cfi_endproc
>>> +        .size   safe_syscall_base, .-safe_syscall_base
>>>
>> Why not rename 0 -> set_errno and 2 -> syscall_not_executed
>> for readability? (and eventually drop the comments).
> This is directly taken from the RISC-V version; aside from that, this is
> similar to all other architectures' adaptation, so maybe a future
> refactor should touch all these other files as well, if we do? I
> personally find the readability to be good, because when you look up 0
> or 2 below you can't miss the comments placed close to the labels.

I just noticed that in Richard's "linux-user: simplify safe signal
handling​" series and was going to update here, so we are good :)

>>
>> Otherwise:
>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 



reply via email to

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