aboutsummaryrefslogtreecommitdiff
path: root/include/semihosting
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-28 01:44:28 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-06-28 04:35:39 +0530
commit5b3f39cb04fda32226e84502f858bab06d83e5c1 (patch)
tree3e5859fb0f4457ad96b21c76ff53503363fe61d1 /include/semihosting
parent3753b00e5747068882c7f0302dcf9b87402993ab (diff)
downloadqemu-5b3f39cb04fda32226e84502f858bab06d83e5c1.zip
qemu-5b3f39cb04fda32226e84502f858bab06d83e5c1.tar.gz
qemu-5b3f39cb04fda32226e84502f858bab06d83e5c1.tar.bz2
semihosting: Split out semihost_sys_open
Split out the non-ARM specific portions of SYS_OPEN to a reusable function. This handles gdb and host file i/o. Add helpers to validate the length of the filename string. Prepare for usage by other semihosting by allowing the filename length parameter to be 0, and calling strlen. Reviewed-by: Luc Michel <lmichel@kalray.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/semihosting')
-rw-r--r--include/semihosting/syscalls.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/semihosting/syscalls.h b/include/semihosting/syscalls.h
new file mode 100644
index 0000000..991658b
--- /dev/null
+++ b/include/semihosting/syscalls.h
@@ -0,0 +1,25 @@
+/*
+ * Syscall implementations for semihosting.
+ *
+ * Copyright (c) 2022 Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef SEMIHOSTING_SYSCALLS_H
+#define SEMIHOSTING_SYSCALLS_H
+
+/*
+ * Argument loading from the guest is performed by the caller;
+ * results are returned via the 'complete' callback.
+ *
+ * String operands are in address/len pairs. The len argument may be 0
+ * (when the semihosting abi does not already provide the length),
+ * or non-zero (where it should include the terminating zero).
+ */
+
+void semihost_sys_open(CPUState *cs, gdb_syscall_complete_cb complete,
+ target_ulong fname, target_ulong fname_len,
+ int gdb_flags, int mode);
+
+#endif /* SEMIHOSTING_SYSCALLS_H */