[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 05/11] target/mips: Drop pread and pwrite syscalls from semiho
From: |
Richard Henderson |
Subject: |
[PATCH v4 05/11] target/mips: Drop pread and pwrite syscalls from semihosting |
Date: |
Tue, 7 Jun 2022 22:19:39 -0700 |
We don't implement it with _WIN32 hosts, and the syscalls
are missing from the gdb remote file i/o interface.
Since we can't implement them universally, drop them.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/mips/tcg/sysemu/mips-semi.c | 39 ++++++------------------------
1 file changed, 7 insertions(+), 32 deletions(-)
diff --git a/target/mips/tcg/sysemu/mips-semi.c
b/target/mips/tcg/sysemu/mips-semi.c
index 254c7fad9a..93c9d3d0b3 100644
--- a/target/mips/tcg/sysemu/mips-semi.c
+++ b/target/mips/tcg/sysemu/mips-semi.c
@@ -188,8 +188,8 @@ static int get_open_flags(target_ulong target_flags)
return open_flags;
}
-static int write_to_file(CPUMIPSState *env, target_ulong fd, target_ulong
vaddr,
- target_ulong len, target_ulong offset)
+static int write_to_file(CPUMIPSState *env, target_ulong fd,
+ target_ulong vaddr, target_ulong len)
{
int num_of_bytes;
void *dst = lock_user(VERIFY_READ, vaddr, len, 1);
@@ -197,23 +197,14 @@ static int write_to_file(CPUMIPSState *env, target_ulong
fd, target_ulong vaddr,
report_fault(env);
}
- if (offset) {
-#ifdef _WIN32
- num_of_bytes = 0;
-#else
- num_of_bytes = pwrite(fd, dst, len, offset);
-#endif
- } else {
- num_of_bytes = write(fd, dst, len);
- }
+ num_of_bytes = write(fd, dst, len);
unlock_user(dst, vaddr, 0);
return num_of_bytes;
}
static int read_from_file(CPUMIPSState *env, target_ulong fd,
- target_ulong vaddr, target_ulong len,
- target_ulong offset)
+ target_ulong vaddr, target_ulong len)
{
int num_of_bytes;
void *dst = lock_user(VERIFY_WRITE, vaddr, len, 0);
@@ -221,15 +212,7 @@ static int read_from_file(CPUMIPSState *env, target_ulong
fd,
report_fault(env);
}
- if (offset) {
-#ifdef _WIN32
- num_of_bytes = 0;
-#else
- num_of_bytes = pread(fd, dst, len, offset);
-#endif
- } else {
- num_of_bytes = read(fd, dst, len);
- }
+ num_of_bytes = read(fd, dst, len);
unlock_user(dst, vaddr, len);
return num_of_bytes;
@@ -309,11 +292,11 @@ void mips_semihosting(CPUMIPSState *env)
gpr[3] = errno_mips(errno);
break;
case UHI_read:
- gpr[2] = read_from_file(env, gpr[4], gpr[5], gpr[6], 0);
+ gpr[2] = read_from_file(env, gpr[4], gpr[5], gpr[6]);
gpr[3] = errno_mips(errno);
break;
case UHI_write:
- gpr[2] = write_to_file(env, gpr[4], gpr[5], gpr[6], 0);
+ gpr[2] = write_to_file(env, gpr[4], gpr[5], gpr[6]);
gpr[3] = errno_mips(errno);
break;
case UHI_lseek:
@@ -379,14 +362,6 @@ void mips_semihosting(CPUMIPSState *env)
FREE_TARGET_STRING(p, gpr[4]);
abort();
break;
- case UHI_pread:
- gpr[2] = read_from_file(env, gpr[4], gpr[5], gpr[6], gpr[7]);
- gpr[3] = errno_mips(errno);
- break;
- case UHI_pwrite:
- gpr[2] = write_to_file(env, gpr[4], gpr[5], gpr[6], gpr[7]);
- gpr[3] = errno_mips(errno);
- break;
default:
error_report("Unknown UHI operation %d", op);
abort();
--
2.34.1
- [PATCH v4 01/11] target/mips: Use an exception for semihosting, (continued)
- [PATCH v4 01/11] target/mips: Use an exception for semihosting, Richard Henderson, 2022/06/08
- [PATCH v4 03/11] target/mips: Create report_fault for semihosting, Richard Henderson, 2022/06/08
- [PATCH v4 06/11] target/mips: Use semihosting/syscalls.h, Richard Henderson, 2022/06/08
- [PATCH v4 04/11] target/mips: Drop link syscall from semihosting, Richard Henderson, 2022/06/08
- [PATCH v4 09/11] semihosting: Remove qemu_semihosting_log_out, Richard Henderson, 2022/06/08
- [PATCH v4 07/11] target/mips: Avoid qemu_semihosting_log_out for UHI_plog, Richard Henderson, 2022/06/08
- [PATCH v4 05/11] target/mips: Drop pread and pwrite syscalls from semihosting,
Richard Henderson <=
- [PATCH v4 08/11] target/mips: Use error_report for UHI_assert, Richard Henderson, 2022/06/08
- [PATCH v4 10/11] target/mips: Simplify UHI_argnlen and UHI_argn, Richard Henderson, 2022/06/08
- [PATCH v4 11/11] target/mips: Remove GET_TARGET_STRING and FREE_TARGET_STRING, Richard Henderson, 2022/06/08