[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>
>
- Re: [PATCH v9 31/31] tests/docker: Add gentoo-loongarch64-cross image and run cross builds in GitLab, (continued)
- [PATCH v9 22/31] tcg/loongarch64: Implement simple load/store ops, WANG Xuerui, 2021/12/14
- [PATCH v9 26/31] tcg/loongarch64: Implement tcg_target_init, WANG Xuerui, 2021/12/14
- [PATCH v9 27/31] tcg/loongarch64: Register the JIT, WANG Xuerui, 2021/12/14
- [PATCH v9 23/31] tcg/loongarch64: Add softmmu load/store helpers, implement qemu_ld/qemu_st ops, WANG Xuerui, 2021/12/14
- [PATCH v9 30/31] configure, meson.build: Mark support for loongarch64 hosts, WANG Xuerui, 2021/12/14
- [PATCH v9 29/31] linux-user: Implement CPU-specific signal handler for loongarch64 hosts, WANG Xuerui, 2021/12/14
- [PATCH v9 28/31] common-user: Add safe syscall handling for loongarch64 hosts, WANG Xuerui, 2021/12/14
- Re: [PATCH v9 28/31] common-user: Add safe syscall handling for loongarch64 hosts, Richard Henderson, 2021/12/14