[PATCH] RISC-V: Add semihosting support
Kito Cheng
kito.cheng@gmail.com
Wed Dec 9 08:21:38 GMT 2020
Hi Craig:
I verified with GCC testsuite on qemu with Keith's semihosting patch,
And that's LGTM, only two minor review comment, see below:
> +++ b/libgloss/riscv/semihost-sys_exit.c
> @@ -0,0 +1,19 @@
> +#include <machine/syscall.h>
> +#include "semihost_syscall.h"
> +
> +#define ADP_Stopped_ApplicationExit 0x20026
> +
> +/* Exit a program without cleaning up files. */
> +void
> +_exit (int exit_status)
> +{
> +#if __riscv_xlen == 32
> + syscall_errno (SEMIHOST_exit, (long *) ADP_Stopped_ApplicationExit);
Could you use SEMIHOST_exit_extended here, so that we could have
return value on rv32.
> +/* Return the fdentry for file or NULL if not found. */
> +
> +struct fdentry *
> +__get_fdentry (int file)
> +{
> + if (file<0 || file>RISCV_MAX_OPEN_FILES || fdtable[file].handle == -1)
Should be >= RISCV_MAX_OPEN_FILES here?
More information about the Newlib
mailing list