]>
Commit | Line | Data |
---|---|---|
a331c6d7 AB |
1 | /* |
2 | * Semihosting Console | |
3 | * | |
4 | * Copyright (c) 2019 Linaro Ltd | |
5 | * | |
6 | * SPDX-License-Identifier: GPL-2.0-or-later | |
7 | */ | |
8 | ||
37677d7d MA |
9 | #ifndef SEMIHOST_CONSOLE_H |
10 | #define SEMIHOST_CONSOLE_H | |
a331c6d7 | 11 | |
ec150c7e MA |
12 | #include "cpu.h" |
13 | ||
a331c6d7 | 14 | /** |
78e24848 | 15 | * qemu_semihosting_console_outs: |
a331c6d7 | 16 | * @env: CPUArchState |
78e24848 | 17 | * @s: host address of null terminated guest string |
a331c6d7 | 18 | * |
78e24848 AB |
19 | * Send a null terminated guest string to the debug console. This may |
20 | * be the remote gdb session if a softmmu guest is currently being | |
21 | * debugged. | |
a331c6d7 AB |
22 | * |
23 | * Returns: number of bytes written. | |
24 | */ | |
78e24848 AB |
25 | int qemu_semihosting_console_outs(CPUArchState *env, target_ulong s); |
26 | ||
27 | /** | |
28 | * qemu_semihosting_console_outc: | |
29 | * @env: CPUArchState | |
30 | * @s: host address of null terminated guest string | |
31 | * | |
32 | * Send single character from guest memory to the debug console. This | |
33 | * may be the remote gdb session if a softmmu guest is currently being | |
34 | * debugged. | |
35 | * | |
36 | * Returns: nothing | |
37 | */ | |
38 | void qemu_semihosting_console_outc(CPUArchState *env, target_ulong c); | |
a331c6d7 | 39 | |
8de702cb KP |
40 | /** |
41 | * qemu_semihosting_console_inc: | |
42 | * @env: CPUArchState | |
43 | * | |
44 | * Receive single character from debug console. This may be the remote | |
45 | * gdb session if a softmmu guest is currently being debugged. As this | |
46 | * call may block if no data is available we suspend the CPU and will | |
47 | * re-execute the instruction when data is there. Therefore two | |
48 | * conditions must be met: | |
49 | * - CPUState is synchronized before calling this function | |
50 | * - pc is only updated once the character is successfully returned | |
51 | * | |
52 | * Returns: character read OR cpu_loop_exit! | |
53 | */ | |
54 | target_ulong qemu_semihosting_console_inc(CPUArchState *env); | |
55 | ||
a331c6d7 AB |
56 | /** |
57 | * qemu_semihosting_log_out: | |
58 | * @s: pointer to string | |
59 | * @len: length of string | |
60 | * | |
61 | * Send a string to the debug output. Unlike console_out these strings | |
62 | * can't be sent to a remote gdb instance as they don't exist in guest | |
63 | * memory. | |
64 | * | |
65 | * Returns: number of bytes written | |
66 | */ | |
67 | int qemu_semihosting_log_out(const char *s, int len); | |
68 | ||
37677d7d | 69 | #endif /* SEMIHOST_CONSOLE_H */ |