[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/26] semihosting: add O_BINARY flag in host_open for NT compati
From: |
Alex Bennée |
Subject: |
[PATCH 14/26] semihosting: add O_BINARY flag in host_open for NT compatibility |
Date: |
Tue, 10 Jan 2023 17:39:10 +0000 |
From: Evgeny Iakovlev <eiakovlev@linux.microsoft.com>
Windows open(2) implementation 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 and it is defined to 0 on non-Windows,
so we can just add it to the host_flags for better compatibility.
Signed-off-by: Evgeny Iakovlev <eiakovlev@linux.microsoft.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Message-Id: <20230106102018.20520-1-eiakovlev@linux.microsoft.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
semihosting/syscalls.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/semihosting/syscalls.c b/semihosting/syscalls.c
index ba28194b59..e89992cf90 100644
--- a/semihosting/syscalls.c
+++ b/semihosting/syscalls.c
@@ -253,7 +253,7 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb
complete,
{
CPUArchState *env G_GNUC_UNUSED = cs->env_ptr;
char *p;
- int ret, host_flags;
+ int ret, host_flags = O_BINARY;
ret = validate_lock_user_string(&p, cs, fname, fname_len);
if (ret < 0) {
@@ -262,11 +262,11 @@ static void host_open(CPUState *cs,
gdb_syscall_complete_cb complete,
}
if (gdb_flags & GDB_O_WRONLY) {
- host_flags = O_WRONLY;
+ host_flags |= O_WRONLY;
} else if (gdb_flags & GDB_O_RDWR) {
- host_flags = O_RDWR;
+ host_flags |= O_RDWR;
} else {
- host_flags = O_RDONLY;
+ host_flags |= O_RDONLY;
}
if (gdb_flags & GDB_O_CREAT) {
host_flags |= O_CREAT;
--
2.34.1
- [PATCH 05/26] build-sys: fix crlf-ending C code, (continued)
- [PATCH 05/26] build-sys: fix crlf-ending C code, Alex Bennée, 2023/01/10
- [PATCH 01/26] scripts/ci: update gitlab-runner playbook to use latest runner, Alex Bennée, 2023/01/10
- [PATCH 08/26] meson: replace Perl usage with Python, Alex Bennée, 2023/01/10
- [PATCH 06/26] .gitlab-ci.d/windows: do not disable opengl, Alex Bennée, 2023/01/10
- [PATCH 10/26] Update lcitool and fedora to 37, Alex Bennée, 2023/01/10
- [PATCH 07/26] configure: replace Perl usage with sed, Alex Bennée, 2023/01/10
- [PATCH 17/26] tests/tcg: add memory-sve test for aarch64, Alex Bennée, 2023/01/10
- [PATCH 13/26] semihosting: Write back semihosting data before completion callback, Alex Bennée, 2023/01/10
- [PATCH 18/26] cpu: free cpu->tb_jmp_cache with RCU, Alex Bennée, 2023/01/10
- [PATCH 14/26] semihosting: add O_BINARY flag in host_open for NT compatibility,
Alex Bennée <=
- [PATCH 15/26] docs: add a proper feature overview in "About QEMU", Alex Bennée, 2023/01/10
- [PATCH 09/26] docs: drop texinfo options, Alex Bennée, 2023/01/10
- [PATCH 23/26] plugins: fix optimization in plugin_gen_disable_mem_helpers, Alex Bennée, 2023/01/10
- [PATCH 19/26] util/qht: add missing atomic_set(hashes[i]), Alex Bennée, 2023/01/10
- [PATCH 12/26] lcitool: drop texinfo from QEMU project/dependencies, Alex Bennée, 2023/01/10
- [PATCH 24/26] translator: always pair plugin_gen_insn_{start, end} calls, Alex Bennée, 2023/01/10
- [PATCH 21/26] util/qht: use striped locks under TSAN, Alex Bennée, 2023/01/10
- [PATCH 25/26] tcg: exclude lookup_tb_ptr from helper instrumentation, Alex Bennée, 2023/01/10
- [PATCH 11/26] lcitool: drop perl from QEMU project/dependencies, Alex Bennée, 2023/01/10
- [PATCH 16/26] semihosting: add semihosting section to the docs, Alex Bennée, 2023/01/10