summaryrefslogtreecommitdiffstats
path: root/target/m68k
diff options
context:
space:
mode:
authorRichard Henderson2022-04-29 23:41:37 +0200
committerRichard Henderson2022-06-28 01:05:07 +0200
commit7c56c2d3da2d25cb202e6b47ad7348a42b950b76 (patch)
treeb67a7f04e2463176c32bcbda05e92136e10d1aea /target/m68k
parentinclude/exec: Move gdb open flags to gdbstub.h (diff)
downloadqemu-7c56c2d3da2d25cb202e6b47ad7348a42b950b76.tar.gz
qemu-7c56c2d3da2d25cb202e6b47ad7348a42b950b76.tar.xz
qemu-7c56c2d3da2d25cb202e6b47ad7348a42b950b76.zip
include/exec: Move gdb_stat and gdb_timeval to gdbstub.h
We have two copies of these structures, and require them in semihosting/ going forward. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/m68k')
-rw-r--r--target/m68k/m68k-semi.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c
index 475a6b13b7..b886ebf714 100644
--- a/target/m68k/m68k-semi.c
+++ b/target/m68k/m68k-semi.c
@@ -45,30 +45,6 @@
#define HOSTED_ISATTY 12
#define HOSTED_SYSTEM 13
-typedef uint32_t gdb_mode_t;
-typedef uint32_t gdb_time_t;
-
-struct m68k_gdb_stat {
- uint32_t gdb_st_dev; /* device */
- uint32_t gdb_st_ino; /* inode */
- gdb_mode_t gdb_st_mode; /* protection */
- uint32_t gdb_st_nlink; /* number of hard links */
- uint32_t gdb_st_uid; /* user ID of owner */
- uint32_t gdb_st_gid; /* group ID of owner */
- uint32_t gdb_st_rdev; /* device type (if inode device) */
- uint64_t gdb_st_size; /* total size, in bytes */
- uint64_t gdb_st_blksize; /* blocksize for filesystem I/O */
- uint64_t gdb_st_blocks; /* number of blocks allocated */
- gdb_time_t gdb_st_atime; /* time of last access */
- gdb_time_t gdb_st_mtime; /* time of last modification */
- gdb_time_t gdb_st_ctime; /* time of last change */
-} QEMU_PACKED;
-
-struct gdb_timeval {
- gdb_time_t tv_sec; /* second */
- uint64_t tv_usec; /* microsecond */
-} QEMU_PACKED;
-
static int translate_openflags(int flags)
{
int hf;
@@ -90,11 +66,13 @@ static int translate_openflags(int flags)
static void translate_stat(CPUM68KState *env, target_ulong addr, struct stat *s)
{
- struct m68k_gdb_stat *p;
+ struct gdb_stat *p;
- if (!(p = lock_user(VERIFY_WRITE, addr, sizeof(struct m68k_gdb_stat), 0)))
+ p = lock_user(VERIFY_WRITE, addr, sizeof(struct gdb_stat), 0);
+ if (!p) {
/* FIXME - should this return an error code? */
return;
+ }
p->gdb_st_dev = cpu_to_be32(s->st_dev);
p->gdb_st_ino = cpu_to_be32(s->st_ino);
p->gdb_st_mode = cpu_to_be32(s->st_mode);
@@ -114,7 +92,7 @@ static void translate_stat(CPUM68KState *env, target_ulong addr, struct stat *s)
p->gdb_st_atime = cpu_to_be32(s->st_atime);
p->gdb_st_mtime = cpu_to_be32(s->st_mtime);
p->gdb_st_ctime = cpu_to_be32(s->st_ctime);
- unlock_user(p, addr, sizeof(struct m68k_gdb_stat));
+ unlock_user(p, addr, sizeof(struct gdb_stat));
}
static void m68k_semi_return_u32(CPUM68KState *env, uint32_t ret, uint32_t err)