diff options
| author | Bradley Morgan <brads@mainlining.org> | 2026-10-03 18:57:38 +0000 |
|---|---|---|
| committer | Bradley Morgan <brads@mainlining.org> | 2026-10-03 18:57:38 +0000 |
| commit | 00fc82f17cff9295387d516384ecdc443acb1b22 (patch) | |
| tree | 798bef0185878286028fe0eaf7594616a66903e4 /include/semihosting.h | |
| parent | 7e8514efb64774b6a635b87ae945e519a7c38551 (diff) | |
tashaboot: arm64 bringup, semihosting payload loader
consoles on the pl011 the dtb points at, walks the memory node and
chosen, loads an arm64 kernel Image over semihosting and jumps to it
with the documented register state. string functions, printf and
libfdt are vendored from lk (lk2nd) and u-boot so the libc surface is
the one those projects already proved. built and booted on qemu virt,
payload exits clean through semihosting.
Diffstat (limited to 'include/semihosting.h')
| -rw-r--r-- | include/semihosting.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/semihosting.h b/include/semihosting.h new file mode 100644 index 0000000..2f8c8f2 --- /dev/null +++ b/include/semihosting.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __SEMIHOSTING_H +#define __SEMIHOSTING_H + +#include <sys/types.h> + +/* + * semihosting file io, backed by the host when qemu runs with + * -semihosting. all calls return negative errno style errors so the + * boot flow can fall back to whatever the board has without semihosting. + */ + +enum smh_open_mode { + MODE_READ = 0x0, + MODE_BINARY = 0x1, + MODE_PLUS = 0x2, + MODE_WRITE = 0x4, + MODE_APPEND = 0x8, +}; + +long smh_open(const char *fname, enum smh_open_mode mode); +long smh_read(long fd, void *memp, size_t len); +long smh_write(long fd, const void *memp, size_t len, size_t *written); +long smh_close(long fd); +long smh_flen(long fd); +long smh_seek(long fd, long pos); + +/* probe once, a boot without a debugger attached must not trap */ +bool smh_probe(void); + +#endif |
