[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 58/60] target/mips: Drop pread and pwrite syscalls from semihostin
From: |
Richard Henderson |
Subject: |
[PULL 58/60] target/mips: Drop pread and pwrite syscalls from semihosting |
Date: |
Tue, 28 Jun 2022 10:24:01 +0530 |
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.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
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 2a039baf4c..67c35fe7f9 100644
--- a/target/mips/tcg/sysemu/mips-semi.c
+++ b/target/mips/tcg/sysemu/mips-semi.c
@@ -182,8 +182,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);
@@ -192,23 +192,14 @@ static int write_to_file(CPUMIPSState *env, target_ulong
fd, target_ulong vaddr,
return -1;
}
- 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);
@@ -217,15 +208,7 @@ static int read_from_file(CPUMIPSState *env, target_ulong
fd,
return -1;
}
- 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;
@@ -312,11 +295,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:
@@ -382,14 +365,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;
#ifndef _WIN32
case UHI_link:
GET_TARGET_STRINGS_2(p, gpr[4], p2, gpr[5]);
--
2.34.1
- [PULL 49/60] semihosting: Use console_out_gf for SYS_WRITEC, (continued)
- [PULL 49/60] semihosting: Use console_out_gf for SYS_WRITEC, Richard Henderson, 2022/06/28
- [PULL 50/60] semihosting: Remove qemu_semihosting_console_outc, Richard Henderson, 2022/06/28
- [PULL 51/60] semihosting: Use console_out_gf for SYS_WRITE0, Richard Henderson, 2022/06/28
- [PULL 43/60] semihosting: Expand qemu_semihosting_console_inc to read, Richard Henderson, 2022/06/28
- [PULL 54/60] target/m68k: Eliminate m68k_semi_is_fseek, Richard Henderson, 2022/06/28
- [PULL 55/60] target/m68k: Make semihosting system only, Richard Henderson, 2022/06/28
- [PULL 56/60] target/mips: Use an exception for semihosting, Richard Henderson, 2022/06/28
- [PULL 59/60] target/nios2: Eliminate nios2_semi_is_lseek, Richard Henderson, 2022/06/28
- [PULL 60/60] target/nios2: Move nios2-semi.c to nios2_softmmu_ss, Richard Henderson, 2022/06/28
- [PULL 57/60] target/mips: Add UHI errno values, Richard Henderson, 2022/06/28
- [PULL 58/60] target/mips: Drop pread and pwrite syscalls from semihosting,
Richard Henderson <=
- Re: [PULL 00/60] semihosting patch queue, Richard Henderson, 2022/06/28