All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/43] semihosting cleanup
@ 2022-04-30 13:28 Richard Henderson
  2022-04-30 13:28 ` [PATCH 01/43] semihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.h Richard Henderson
                   ` (43 more replies)
  0 siblings, 44 replies; 45+ messages in thread
From: Richard Henderson @ 2022-04-30 13:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: crwulff, alex.bennee, f4bug, laurent

I had whipped up an rx-elf cross toolchain to test something
recently, and since I had built it, thought it would be easy
to use libgloss to run the multiarch hello and memory tests.
But we haven't implemented libgloss-style semihosting for rx.

I had forgotten how much boilerplate there is currently for
implementing semihosting for an architecture.  And we have 3
implementations that really could share much more code.

So: split out semihosting syscalls to individual functions,
and allow them to be wired up with a minimum of fuss.  Fix a
few bugs and to-do items on the way.

Still to do:

  * Merge semihosting console.c into GuestFD.
    The ARM semihosting spec has separate syscalls for console output,
    and expects the read/write syscalls to only apply to files.
    But the other semihosting implementations assume stdin/stdout,
    and we should be able to wire those up via the same mechanism.

  * Errno.  The ARM spec punts this entirely.  But we aren't even
    self-consistant, some paths returning host <errno.h> values,
    and anything going through gdbstub using the gdb remote
    file-io errno values.  The arm and nios2 specs explicitly
    call for the gdb values, which we are not doing.

  * tests/tcg/m68k semihosting implementation.

  * target/rx semihosting implementation.


r~


Richard Henderson (43):
  semihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.h
  semihosting: Return failure from softmmu-uaccess.h functions
  semihosting: Improve condition for config.c and console.c
  semihosting: Move softmmu-uaccess functions out of line
  semihosting: Add target_strlen for softmmu-uaccess.h
  semihosting: Simplify softmmu_lock_user_string
  semihosting: Split out guestfd.c
  semihosting: Generalize GuestFDFeatureFile
  semihosting: Return void from do_common_semihosting
  semihosting: Adjust error checking in common_semi_cb
  semihosting: Move common-semi.h to include/semihosting/
  include/exec: Move gdb open flags to gdbstub.h
  include/exec: Move gdb_stat and gdb_timeval to gdbstub.h
  semihosting: Use struct gdb_stat in common_semi_flen_cb
  semihosting: Split is_64bit_semihosting per target
  semihosting: Split common_semi_flen_buf per target
  semihosting: Split out common_semi_has_synccache
  semihosting: Use env more often in do_common_semihosting
  semihosting: Move GET_ARG/SET_ARG earlier in the file
  semihosting: Split out semihost_sys_open
  semihosting: Split out semihost_sys_close
  semihosting: Split out semihost_sys_read
  semihosting: Split out semihost_sys_write
  semihosting: Bound length for semihost_sys_{read,write}
  semihosting: Split out semihost_sys_lseek
  semihosting: Split out semihost_sys_isatty
  semihosting: Split out semihost_sys_flen
  semihosting: Split out semihost_sys_remove
  semihosting: Split out semihost_sys_rename
  semihosting: Split out semihost_sys_system
  semihosting: Create semihost_sys_{stat,fstat}
  semihosting: Create semihost_sys_gettimeofday
  gdbstub: Widen gdb_syscall_complete_cb return value
  target/m68k: Eliminate m68k_semi_is_fseek
  target/m68k: Make semihosting system only
  target/m68k: Use guestfd.h to implement syscalls.
  target/m68k: Do semihosting call as a normal helper
  target/m68k: Enable semihosting for non-coldfire
  target/m68k: Remove EXCP_HALT_INSN
  target/nios2: Eliminate nios2_semi_is_lseek
  target/nios2: Move nios2-semi.c to nios2_softmmu_ss
  target/nios2: Use guestfd.h to implement syscalls.
  target/nios2: Do semihosting call as a normal helper

 configs/targets/aarch64-linux-user.mak        |   1 +
 configs/targets/aarch64_be-linux-user.mak     |   1 +
 configs/targets/arm-linux-user.mak            |   1 +
 configs/targets/armeb-linux-user.mak          |   1 +
 configs/targets/riscv32-linux-user.mak        |   1 +
 configs/targets/riscv64-linux-user.mak        |   1 +
 include/exec/gdbstub.h                        |  43 +-
 include/exec/softmmu-semi.h                   | 101 --
 .../semihosting}/common-semi.h                |   2 +-
 include/semihosting/guestfd.h                 |  95 ++
 include/semihosting/softmmu-uaccess.h         |  59 ++
 target/arm/common-semi-target.h               |  62 ++
 target/m68k/cpu.h                             |   3 -
 target/m68k/helper.h                          |   1 +
 target/nios2/cpu.h                            |   3 -
 target/nios2/helper.h                         |   1 +
 target/riscv/common-semi-target.h             |  50 +
 gdbstub.c                                     |   7 +-
 linux-user/aarch64/cpu_loop.c                 |   2 +-
 linux-user/arm/cpu_loop.c                     |   2 +-
 linux-user/m68k/cpu_loop.c                    |   5 -
 linux-user/riscv/cpu_loop.c                   |   2 +-
 semihosting/arm-compat-semi.c                 | 955 ++++--------------
 semihosting/console.c                         |   7 +-
 semihosting/guestfd.c                         | 935 +++++++++++++++++
 semihosting/uaccess.c                         |  71 ++
 target/arm/helper.c                           |   4 +-
 target/arm/m_helper.c                         |   2 +-
 target/m68k/m68k-semi.c                       | 374 +------
 target/m68k/op_helper.c                       |  15 -
 target/m68k/translate.c                       |  38 +-
 target/mips/tcg/sysemu/mips-semi.c            |   2 +-
 target/nios2/helper.c                         |   7 -
 target/nios2/nios2-semi.c                     | 357 +------
 target/nios2/translate.c                      |   2 +-
 target/riscv/cpu_helper.c                     |   2 +-
 semihosting/meson.build                       |   5 +
 target/m68k/meson.build                       |   6 +-
 target/nios2/meson.build                      |   4 +-
 39 files changed, 1686 insertions(+), 1544 deletions(-)
 delete mode 100644 include/exec/softmmu-semi.h
 rename {semihosting => include/semihosting}/common-semi.h (96%)
 create mode 100644 include/semihosting/guestfd.h
 create mode 100644 include/semihosting/softmmu-uaccess.h
 create mode 100644 target/arm/common-semi-target.h
 create mode 100644 target/riscv/common-semi-target.h
 create mode 100644 semihosting/guestfd.c
 create mode 100644 semihosting/uaccess.c

-- 
2.34.1



^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2022-05-01  7:23 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-30 13:28 [PATCH 00/43] semihosting cleanup Richard Henderson
2022-04-30 13:28 ` [PATCH 01/43] semihosting: Move exec/softmmu-semi.h to semihosting/softmmu-uaccess.h Richard Henderson
2022-04-30 13:28 ` [PATCH 02/43] semihosting: Return failure from softmmu-uaccess.h functions Richard Henderson
2022-04-30 13:28 ` [PATCH 03/43] semihosting: Improve condition for config.c and console.c Richard Henderson
2022-04-30 13:28 ` [PATCH 04/43] semihosting: Move softmmu-uaccess functions out of line Richard Henderson
2022-04-30 13:28 ` [PATCH 05/43] semihosting: Add target_strlen for softmmu-uaccess.h Richard Henderson
2022-04-30 13:28 ` [PATCH 06/43] semihosting: Simplify softmmu_lock_user_string Richard Henderson
2022-04-30 13:28 ` [PATCH 07/43] semihosting: Split out guestfd.c Richard Henderson
2022-04-30 13:28 ` [PATCH 08/43] semihosting: Generalize GuestFDFeatureFile Richard Henderson
2022-04-30 13:28 ` [PATCH 09/43] semihosting: Return void from do_common_semihosting Richard Henderson
2022-04-30 13:28 ` [PATCH 10/43] semihosting: Adjust error checking in common_semi_cb Richard Henderson
2022-04-30 13:29 ` [PATCH 11/43] semihosting: Move common-semi.h to include/semihosting/ Richard Henderson
2022-04-30 13:29 ` [PATCH 12/43] include/exec: Move gdb open flags to gdbstub.h Richard Henderson
2022-04-30 13:29 ` [PATCH 13/43] include/exec: Move gdb_stat and gdb_timeval " Richard Henderson
2022-04-30 13:29 ` [PATCH 14/43] semihosting: Use struct gdb_stat in common_semi_flen_cb Richard Henderson
2022-04-30 13:29 ` [PATCH 15/43] semihosting: Split is_64bit_semihosting per target Richard Henderson
2022-04-30 13:29 ` [PATCH 16/43] semihosting: Split common_semi_flen_buf " Richard Henderson
2022-04-30 13:29 ` [PATCH 17/43] semihosting: Split out common_semi_has_synccache Richard Henderson
2022-04-30 13:29 ` [PATCH 18/43] semihosting: Use env more often in do_common_semihosting Richard Henderson
2022-04-30 13:29 ` [PATCH 19/43] semihosting: Move GET_ARG/SET_ARG earlier in the file Richard Henderson
2022-04-30 13:29 ` [PATCH 20/43] semihosting: Split out semihost_sys_open Richard Henderson
2022-04-30 13:29 ` [PATCH 21/43] semihosting: Split out semihost_sys_close Richard Henderson
2022-04-30 13:29 ` [PATCH 22/43] semihosting: Split out semihost_sys_read Richard Henderson
2022-04-30 13:29 ` [PATCH 23/43] semihosting: Split out semihost_sys_write Richard Henderson
2022-04-30 13:29 ` [PATCH 24/43] semihosting: Bound length for semihost_sys_{read, write} Richard Henderson
2022-04-30 13:29 ` [PATCH 25/43] semihosting: Split out semihost_sys_lseek Richard Henderson
2022-04-30 13:29 ` [PATCH 26/43] semihosting: Split out semihost_sys_isatty Richard Henderson
2022-04-30 13:29 ` [PATCH 27/43] semihosting: Split out semihost_sys_flen Richard Henderson
2022-04-30 13:29 ` [PATCH 28/43] semihosting: Split out semihost_sys_remove Richard Henderson
2022-04-30 13:29 ` [PATCH 29/43] semihosting: Split out semihost_sys_rename Richard Henderson
2022-04-30 13:29 ` [PATCH 30/43] semihosting: Split out semihost_sys_system Richard Henderson
2022-04-30 13:29 ` [PATCH 31/43] semihosting: Create semihost_sys_{stat,fstat} Richard Henderson
2022-04-30 13:29 ` [PATCH 32/43] semihosting: Create semihost_sys_gettimeofday Richard Henderson
2022-04-30 13:29 ` [PATCH 33/43] gdbstub: Widen gdb_syscall_complete_cb return value Richard Henderson
2022-04-30 13:29 ` [PATCH 34/43] target/m68k: Eliminate m68k_semi_is_fseek Richard Henderson
2022-04-30 13:29 ` [PATCH 35/43] target/m68k: Make semihosting system only Richard Henderson
2022-04-30 13:29 ` [PATCH 36/43] target/m68k: Use guestfd.h to implement syscalls Richard Henderson
2022-04-30 13:29 ` [PATCH 37/43] target/m68k: Do semihosting call as a normal helper Richard Henderson
2022-04-30 13:29 ` [PATCH 38/43] target/m68k: Enable semihosting for non-coldfire Richard Henderson
2022-04-30 13:29 ` [PATCH 39/43] target/m68k: Remove EXCP_HALT_INSN Richard Henderson
2022-04-30 13:29 ` [PATCH 40/43] target/nios2: Eliminate nios2_semi_is_lseek Richard Henderson
2022-04-30 13:29 ` [PATCH 41/43] target/nios2: Move nios2-semi.c to nios2_softmmu_ss Richard Henderson
2022-04-30 13:29 ` [PATCH 42/43] target/nios2: Use guestfd.h to implement syscalls Richard Henderson
2022-04-30 13:29 ` [PATCH 43/43] target/nios2: Do semihosting call as a normal helper Richard Henderson
2022-05-01  7:02 ` [PATCH 00/43] semihosting cleanup Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.