diff options
author | Richard Henderson | 2022-06-28 06:54:30 +0200 |
---|---|---|
committer | Richard Henderson | 2022-06-28 06:54:31 +0200 |
commit | ad4c7f529a279685da84297773b4ec8080153c2d (patch) | |
tree | b5cc9c2dab4334b6ccd544a71a372424e3bd0f74 /include/semihosting/console.h | |
parent | Merge tag 'pull-target-arm-20220627' of https://git.linaro.org/people/pmaydel... (diff) | |
parent | target/nios2: Move nios2-semi.c to nios2_softmmu_ss (diff) | |
download | qemu-ad4c7f529a279685da84297773b4ec8080153c2d.tar.gz qemu-ad4c7f529a279685da84297773b4ec8080153c2d.tar.xz qemu-ad4c7f529a279685da84297773b4ec8080153c2d.zip |
Merge tag 'pull-semi-20220628' of https://gitlab.com/rth7680/qemu into staging
Semihosting syscall reorg:
* Split out semihosting/syscalls.c with common implementations.
* Reorg arm-compat-semi.c to use syscalls.c.
* Minor prep cleanups to m68k, mips, nios2.
# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmK6iSodHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV8SEwgAmmowW2oeFA9uCrwz
# gUJo17AJ+RmRF/zXHyu5CPswylvfwH0zJXAm5BV7P/pVdyaL36b8YcgSEf+EWLsf
# rLFHxCshTYEnZSk6yFtWk5bn5azfevHm9/ObPeS9XGL4seQqGy7C/FReoTQ7/zI0
# W3zUDd3bWah3fXw8XYgSzh/RCrC5E2gFFc1G1g+6SIVZ7pbgkre2rRk5WMmylCLd
# jf9pmyswrheaKumCoBxU/S4XDgxVpaf3khiIqdbo8A20MDGnK/SZUWsBwJLK3QB8
# SKKv8o1ovbnl/HykABaszCIkO/LIu6SX3LoK7pF2CujkgSuwEN3WW0DOml6+b3fU
# J7YeZg==
# =sTbM
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 28 Jun 2022 10:22:58 AM +0530
# gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg: issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]
* tag 'pull-semi-20220628' of https://gitlab.com/rth7680/qemu: (60 commits)
target/nios2: Move nios2-semi.c to nios2_softmmu_ss
target/nios2: Eliminate nios2_semi_is_lseek
target/mips: Drop pread and pwrite syscalls from semihosting
target/mips: Add UHI errno values
target/mips: Use an exception for semihosting
target/m68k: Make semihosting system only
target/m68k: Eliminate m68k_semi_is_fseek
semihosting: Create semihost_sys_poll_one
semihosting: Remove qemu_semihosting_console_outs
semihosting: Use console_out_gf for SYS_WRITE0
semihosting: Remove qemu_semihosting_console_outc
semihosting: Use console_out_gf for SYS_WRITEC
semihosting: Use console_in_gf for SYS_READC
semihosting: Create qemu_semihosting_guestfd_init
semihosting: Add GuestFDConsole
semihosting: Create qemu_semihosting_console_write
semihosting: Cleanup chardev init
semihosting: Expand qemu_semihosting_console_inc to read
semihosting: Pass CPUState to qemu_semihosting_console_inc
semihosting: Fix docs comment for qemu_semihosting_console_inc
...
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/semihosting/console.h')
-rw-r--r-- | include/semihosting/console.h | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/include/semihosting/console.h b/include/semihosting/console.h index 0238f540f4..61b0cb3a94 100644 --- a/include/semihosting/console.h +++ b/include/semihosting/console.h @@ -12,46 +12,33 @@ #include "cpu.h" /** - * qemu_semihosting_console_outs: - * @env: CPUArchState - * @s: host address of null terminated guest string + * qemu_semihosting_console_read: + * @cs: CPUState + * @buf: host buffer + * @len: buffer size * - * Send a null terminated guest string to the debug console. This may - * be the remote gdb session if a softmmu guest is currently being - * debugged. + * Receive at least one character from debug console. As this call may + * block if no data is available we suspend the CPU and will re-execute the + * instruction when data is there. Therefore two conditions must be met: * - * Returns: number of bytes written. - */ -int qemu_semihosting_console_outs(CPUArchState *env, target_ulong s); - -/** - * qemu_semihosting_console_outc: - * @env: CPUArchState - * @s: host address of null terminated guest string - * - * Send single character from guest memory to the debug console. This - * may be the remote gdb session if a softmmu guest is currently being - * debugged. + * - CPUState is synchronized before calling this function + * - pc is only updated once the character is successfully returned * - * Returns: nothing + * Returns: number of characters read, OR cpu_loop_exit! */ -void qemu_semihosting_console_outc(CPUArchState *env, target_ulong c); +int qemu_semihosting_console_read(CPUState *cs, void *buf, int len); /** - * qemu_semihosting_console_inc: - * @env: CPUArchState + * qemu_semihosting_console_write: + * @buf: host buffer + * @len: buffer size * - * Receive single character from debug console. This may be the remote - * gdb session if a softmmu guest is currently being debugged. As this - * call may block if no data is available we suspend the CPU and will - * re-execute the instruction when data is there. Therefore two - * conditions must be met: - * - CPUState is synchronized before calling this function - * - pc is only updated once the character is successfully returned + * Write len bytes from buf to the debug console. * - * Returns: character read OR cpu_loop_exit! + * Returns: number of bytes written -- this should only ever be short + * on some sort of i/o error. */ -target_ulong qemu_semihosting_console_inc(CPUArchState *env); +int qemu_semihosting_console_write(void *buf, int len); /** * qemu_semihosting_log_out: @@ -66,4 +53,20 @@ target_ulong qemu_semihosting_console_inc(CPUArchState *env); */ int qemu_semihosting_log_out(const char *s, int len); +/* + * qemu_semihosting_console_block_until_ready: + * @cs: CPUState + * + * If no data is available we suspend the CPU and will re-execute the + * instruction when data is available. + */ +void qemu_semihosting_console_block_until_ready(CPUState *cs); + +/** + * qemu_semihosting_console_ready: + * + * Return true if characters are available for read; does not block. + */ +bool qemu_semihosting_console_ready(void); + #endif /* SEMIHOST_CONSOLE_H */ |