public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: Craig Blackmore <craig.blackmore@embecosm.com>
Cc: Newlib <newlib@sourceware.org>
Subject: Re: [PATCH] RISC-V: Add semihosting support
Date: Wed, 9 Dec 2020 16:21:38 +0800	[thread overview]
Message-ID: <CA+yXCZD0ZNUNob0srvDQvefwO7C+AvqOfwSrLgZ0c76-ZDBg3A@mail.gmail.com> (raw)
In-Reply-To: <694d497b-bc07-a3ba-2643-a7336927e9a7@embecosm.com>

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?

  parent reply	other threads:[~2020-12-09  8:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 11:36 Craig Blackmore
2020-11-30 14:05 ` Kito Cheng
2020-11-30 19:53 ` Jeff Johnston
2020-12-09  8:21 ` Kito Cheng [this message]
2020-12-15 12:00   ` Craig Blackmore
2020-12-15 22:51     ` Jeff Johnston
2020-12-16  8:33       ` Craig Blackmore
2020-12-16  8:43         ` Kito Cheng
2020-12-16 23:31         ` Jeff Johnston

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+yXCZD0ZNUNob0srvDQvefwO7C+AvqOfwSrLgZ0c76-ZDBg3A@mail.gmail.com \
    --to=kito.cheng@gmail.com \
    --cc=craig.blackmore@embecosm.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).