From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org
Subject: [PATCH] semihosting: add O_BINARY flag in host_open for NT compatibility
Date: Thu, 5 Jan 2023 22:19:40 +0100 [thread overview]
Message-ID: <20230105211940.14988-1-eiakovlev@linux.microsoft.com> (raw)
Windows open(2) implementations opens files in text mode by default and
needs a Windows-only O_BINARY flag to open files as binary. Qemu already
knows about that flag in osdep.h, so we can just add it to the
host_flags for better compatibility when running qemu on Windows.
Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com>
---
semihosting/syscalls.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/semihosting/syscalls.c b/semihosting/syscalls.c
index 508a0ad88c..00f77507e5 100644
--- a/semihosting/syscalls.c
+++ b/semihosting/syscalls.c
@@ -278,6 +278,8 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb complete,
host_flags |= O_EXCL;
}
+ host_flags |= O_BINARY;
+
ret = open(p, host_flags, mode);
if (ret < 0) {
complete(cs, -1, errno);
--
2.34.1
next reply other threads:[~2023-01-05 22:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 21:19 Evgeny Iakovlev [this message]
2023-01-06 7:29 ` [PATCH] semihosting: add O_BINARY flag in host_open for NT compatibility Philippe Mathieu-Daudé
2023-01-06 9:48 ` Bin Meng
2023-01-06 10:21 ` Evgeny Iakovlev
2023-01-06 10:27 ` Evgeny Iakovlev
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=20230105211940.14988-1-eiakovlev@linux.microsoft.com \
--to=eiakovlev@linux.microsoft.com \
--cc=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).