qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Alexander von Gluck IV" <kallisti5@unixzen.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Richard Zak" <richard.j.zak@gmail.com>,
	"Leon Alrae" <leon.alrae@imgtec.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PATCH 4/4] target/mips: Complete UHI errno list and log unexpected errors
Date: Sun,  4 Jul 2021 19:07:36 +0200	[thread overview]
Message-ID: <20210704170736.617895-5-f4bug@amsat.org> (raw)
In-Reply-To: <20210704170736.617895-1-f4bug@amsat.org>

The spec only defines a set of host errno to translate to guest.
Complete the current errno set, and log unexpected errno (they
are currently replaced by EINVAL, which is dubious, but we don't
modify this).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/mips/tcg/sysemu/mips-semi.c | 38 ++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/target/mips/tcg/sysemu/mips-semi.c b/target/mips/tcg/sysemu/mips-semi.c
index 3e91c9eb76c..6e6518dd626 100644
--- a/target/mips/tcg/sysemu/mips-semi.c
+++ b/target/mips/tcg/sysemu/mips-semi.c
@@ -100,10 +100,46 @@ static void uhi_errno_init(void)
      * Unified Hosting Interface (rev 1.1.6)
      * Appendix A. "Error values"
      */
+    uhi_errno_insert(EPERM,         1);
+    uhi_errno_insert(ENOENT,        2);
+    uhi_errno_insert(EINTR,         4);
+    uhi_errno_insert(EIO,           5);
+    uhi_errno_insert(ENXIO,         6);
+    uhi_errno_insert(EBADF,         9);
+    uhi_errno_insert(EAGAIN,        11);
+    uhi_errno_insert(EWOULDBLOCK,   11);
+    uhi_errno_insert(ENOMEM,        12);
+    uhi_errno_insert(EACCES,        13);
+    uhi_errno_insert(EBUSY,         16);
+    uhi_errno_insert(EEXIST,        17);
+    uhi_errno_insert(EXDEV,         18);
+    uhi_errno_insert(ENOTDIR,       20);
+    uhi_errno_insert(EISDIR,        21);
+    uhi_errno_insert(EINVAL,        22);
+    uhi_errno_insert(ENFILE,        23);
+    uhi_errno_insert(EMFILE,        24);
+#ifdef ETXTBSY
+    uhi_errno_insert(ETXTBSY,       26);
+#endif
+    uhi_errno_insert(EFBIG,         27);
+    uhi_errno_insert(ENOSPC,        28);
+    uhi_errno_insert(ESPIPE,        29);
+    uhi_errno_insert(EROFS,         30);
+    uhi_errno_insert(EMLINK,        31);
+    uhi_errno_insert(EPIPE,         32);
+    uhi_errno_insert(ERANGE,        34);
+    uhi_errno_insert(ENOSR,         63);
+    uhi_errno_insert(EBADMSG,       77);
     uhi_errno_insert(ENAMETOOLONG,  91);
 #ifdef ELOOP
     uhi_errno_insert(ELOOP,         92);
 #endif
+    uhi_errno_insert(ECONNRESET,    104);
+    uhi_errno_insert(ENOBUFS,       105);
+    uhi_errno_insert(ENETUNREACH,   114);
+    uhi_errno_insert(ENETDOWN,      115);
+    uhi_errno_insert(ETIMEDOUT,     116);
+    uhi_errno_insert(ENOTCONN,      128);
 #ifdef EOVERFLOW
     uhi_errno_insert(EOVERFLOW,     139);
 #endif
@@ -126,6 +162,8 @@ static int errno_mips(int host_errno)
                                      NULL, &uhi_errno)) {
         return GPOINTER_TO_INT(uhi_errno);
     }
+    qemu_log("semihosting: Illegal UHI errno: %d\n", host_errno);
+
     return EINVAL; /* Not reachable per the specification */
 }
 
-- 
2.31.1



  parent reply	other threads:[~2021-07-04 17:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04 17:07 [PATCH 0/4] target/mips: Rewrite UHI errno_mips() to allow building on Haiku OS Philippe Mathieu-Daudé
2021-07-04 17:07 ` [PATCH 1/4] target/mips: Fix UHI error values Philippe Mathieu-Daudé
2021-07-04 17:07 ` [PATCH 2/4] target/mips: Rename UHI err -> host_errno Philippe Mathieu-Daudé
2021-07-04 17:07 ` [PATCH 3/4] target/mips: Rewrite UHI errno_mips() using GHashTable Philippe Mathieu-Daudé
2021-07-04 17:25   ` Peter Maydell
2021-07-04 18:25     ` Philippe Mathieu-Daudé
2021-07-04 18:38   ` Thomas Huth
2021-07-04 18:44     ` Philippe Mathieu-Daudé
2021-07-04 17:07 ` Philippe Mathieu-Daudé [this message]
2021-07-04 17:23   ` [PATCH 4/4] target/mips: Complete UHI errno list and log unexpected errors Peter Maydell
2021-07-04 18:25     ` Philippe Mathieu-Daudé

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=20210704170736.617895-5-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=alex.bennee@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=kallisti5@unixzen.com \
    --cc=leon.alrae@imgtec.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=richard.j.zak@gmail.com \
    --cc=thuth@redhat.com \
    /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 NNTP newsgroup(s).