master
h 78 lines 2.85 KB
Raw
1 /*
2 * Syscall implementations for semihosting.
3 *
4 * Copyright (c) 2022 Linaro
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9 #ifndef SEMIHOSTING_SYSCALLS_H
10 #define SEMIHOSTING_SYSCALLS_H
11
12 #include "exec/vaddr.h"
13 #include "gdbstub/syscalls.h"
14
15 /*
16 * Argument loading from the guest is performed by the caller;
17 * results are returned via the 'complete' callback.
18 *
19 * String operands are in address/len pairs. The len argument may be 0
20 * (when the semihosting abi does not already provide the length),
21 * or non-zero (where it should include the terminating zero).
22 */
23
24 typedef struct GuestFD GuestFD;
25
26 void semihost_sys_open(CPUState *cs, gdb_syscall_complete_cb complete,
27 vaddr fname, uint64_t fname_len,
28 int gdb_flags, int mode);
29
30 void semihost_sys_close(CPUState *cs, gdb_syscall_complete_cb complete,
31 int fd);
32
33 void semihost_sys_read(CPUState *cs, gdb_syscall_complete_cb complete,
34 int fd, vaddr buf, uint64_t len);
35
36 void semihost_sys_read_gf(CPUState *cs, gdb_syscall_complete_cb complete,
37 GuestFD *gf, vaddr buf, uint64_t len);
38
39 void semihost_sys_write(CPUState *cs, gdb_syscall_complete_cb complete,
40 int fd, vaddr buf, uint64_t len);
41
42 void semihost_sys_write_gf(CPUState *cs, gdb_syscall_complete_cb complete,
43 GuestFD *gf, vaddr buf, uint64_t len);
44
45 void semihost_sys_lseek(CPUState *cs, gdb_syscall_complete_cb complete,
46 int fd, int64_t off, int gdb_whence);
47
48 void semihost_sys_isatty(CPUState *cs, gdb_syscall_complete_cb complete,
49 int fd);
50
51 void semihost_sys_flen(CPUState *cs, gdb_syscall_complete_cb fstat_cb,
52 gdb_syscall_complete_cb flen_cb,
53 int fd, vaddr fstat_addr);
54
55 void semihost_sys_fstat(CPUState *cs, gdb_syscall_complete_cb complete,
56 int fd, vaddr addr);
57
58 void semihost_sys_stat(CPUState *cs, gdb_syscall_complete_cb complete,
59 vaddr fname, uint64_t fname_len,
60 vaddr addr);
61
62 void semihost_sys_remove(CPUState *cs, gdb_syscall_complete_cb complete,
63 vaddr fname, uint64_t fname_len);
64
65 void semihost_sys_rename(CPUState *cs, gdb_syscall_complete_cb complete,
66 vaddr oname, uint64_t oname_len,
67 vaddr nname, uint64_t nname_len);
68
69 void semihost_sys_system(CPUState *cs, gdb_syscall_complete_cb complete,
70 vaddr cmd, uint64_t cmd_len);
71
72 void semihost_sys_gettimeofday(CPUState *cs, gdb_syscall_complete_cb complete,
73 vaddr tv_addr, vaddr tz_addr);
74
75 void semihost_sys_poll_one(CPUState *cs, gdb_syscall_complete_cb complete,
76 int fd, GIOCondition cond, int timeout);
77
78 #endif /* SEMIHOSTING_SYSCALLS_H */