Re: [PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb

2022-06-07 Thread Richard Henderson
On 5/23/22 08:35, Richard Henderson wrote: That implies that our current code is right, in that the way to check for "did the call fail" is to look at the retcode, not the errno (in the same way that if you make a native syscall or library call you look first at its return value, not at errno). T

Re: [PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb

2022-05-23 Thread Peter Maydell
On Mon, 23 May 2022 at 16:35, Richard Henderson wrote: > On 5/23/22 05:13, Peter Maydell wrote: > > The gdb implementation of the isatty call returns 0 or 1 on > > success, and -1 on failure (though the only failure mode it has > > is "you messed up the protocol packet format"): > > https://source

Re: [PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb

2022-05-23 Thread Richard Henderson
On 5/23/22 05:13, Peter Maydell wrote: On Sat, 21 May 2022 at 01:04, Richard Henderson wrote: The err parameter is non-zero if and only if an error occured. Use this instead of ret == -1 for determining if we need to update the saved errno. The gdb protocol isn't 100% clear on this, but what

Re: [PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb

2022-05-23 Thread Peter Maydell
On Sat, 21 May 2022 at 01:04, Richard Henderson wrote: > > The err parameter is non-zero if and only if an error occured. > Use this instead of ret == -1 for determining if we need to > update the saved errno. The gdb protocol isn't 100% clear on this, but what it says is: https://sourceware.org/

[PATCH v3 09/49] semihosting: Adjust error checking in common_semi_cb

2022-05-20 Thread Richard Henderson
The err parameter is non-zero if and only if an error occured. Use this instead of ret == -1 for determining if we need to update the saved errno. This fixes the errno setting of SYS_ISTTY, which returns 0 on error, not -1. Signed-off-by: Richard Henderson --- semihosting/arm-compat-semi.c | 2