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 <eiakov...@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