summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/efi/error.h4
-rw-r--r--api/kjarna/interface.h29
-rw-r--r--api/lib/kstring.h5
-rw-r--r--api/libc/stdlib.h6
-rw-r--r--api/libc/string.h11
-rw-r--r--api/libc/wchar.h6
-rw-r--r--api/posix/fcntl.h4
-rw-r--r--api/posix/sys/types.h7
-rw-r--r--api/posix/unistd.h11
9 files changed, 77 insertions, 6 deletions
diff --git a/api/efi/error.h b/api/efi/error.h
index b02f7ff..5fbcba8 100644
--- a/api/efi/error.h
+++ b/api/efi/error.h
@@ -6,8 +6,8 @@
#define EFI_SUCCESS 0
#define EFI_INVALID_PARAMETER EFI_ERROR_CODE(2)
+#define EFI_BUFFER_TOO_SMALL EFI_ERROR_CODE(5)
#define EFI_NOT_READY EFI_ERROR_CODE(6)
-#define EFI_ABORTED EFI_ERROR_CODE(21)
#define EFI_NOT_FOUND EFI_ERROR_CODE(14)
-#define EFI_BUFFER_TOO_SMALL EFI_ERROR_CODE(5)
+#define EFI_ABORTED EFI_ERROR_CODE(21)
diff --git a/api/kjarna/interface.h b/api/kjarna/interface.h
new file mode 100644
index 0000000..e0c491a
--- /dev/null
+++ b/api/kjarna/interface.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <stddef.h>
+#include <posix/sys/types.h>
+
+#define SYSV_ABI __attribute__((sysv_abi))
+
+struct kjarna_interface
+{
+ int (SYSV_ABI *open)(const char *, int, int);
+ int (SYSV_ABI *close)(int);
+ off_t (SYSV_ABI *lseek)(int, off_t, int);
+ ssize_t (SYSV_ABI *read)(int, void *, size_t);
+ ssize_t (SYSV_ABI *write)(int, const void *, size_t);
+
+ void *(SYSV_ABI *mmap)(void *, size_t, int, int, int, off_t);
+ int (SYSV_ABI *munmap)(void *, size_t);
+};
+
+struct kjarna_entry_params
+{
+ struct kjarna_interface *interface;
+ int argc;
+ char **argv;
+ char **envp;
+};
+
+typedef int (SYSV_ABI kjarna_runtime_entry_func)(struct kjarna_entry_params *);
+
diff --git a/api/lib/kstring.h b/api/lib/kstring.h
index c28e17c..d1d45d5 100644
--- a/api/lib/kstring.h
+++ b/api/lib/kstring.h
@@ -7,8 +7,5 @@ void *memmove(void *dest, const void *src, size_t size);
void *memset(void *dest, int val, size_t size);
int memcmp(const void *str1, const void *str2, size_t count);
size_t strlen(const char *s);
-unsigned long long strtoull(
- const char *restrict begin,
- char **restrict end,
- int base);
+unsigned long long strtoull(const char *restrict begin, char **restrict end, int base);
diff --git a/api/libc/stdlib.h b/api/libc/stdlib.h
new file mode 100644
index 0000000..76a78eb
--- /dev/null
+++ b/api/libc/stdlib.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <stddef.h>
+
+size_t mbstowcs(wchar_t *dst, const char *src, size_t length);
+
diff --git a/api/libc/string.h b/api/libc/string.h
new file mode 100644
index 0000000..d1d45d5
--- /dev/null
+++ b/api/libc/string.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include <stddef.h>
+
+void *memcpy(void *dest, const void *src, size_t size);
+void *memmove(void *dest, const void *src, size_t size);
+void *memset(void *dest, int val, size_t size);
+int memcmp(const void *str1, const void *str2, size_t count);
+size_t strlen(const char *s);
+unsigned long long strtoull(const char *restrict begin, char **restrict end, int base);
+
diff --git a/api/libc/wchar.h b/api/libc/wchar.h
new file mode 100644
index 0000000..4dd339d
--- /dev/null
+++ b/api/libc/wchar.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <stddef.h>
+
+size_t wcslen(const wchar_t *s);
+
diff --git a/api/posix/fcntl.h b/api/posix/fcntl.h
new file mode 100644
index 0000000..7e55e02
--- /dev/null
+++ b/api/posix/fcntl.h
@@ -0,0 +1,4 @@
+#pragma once
+
+#define O_RDONLY 0
+
diff --git a/api/posix/sys/types.h b/api/posix/sys/types.h
new file mode 100644
index 0000000..2be0ef8
--- /dev/null
+++ b/api/posix/sys/types.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#include <stdint.h>
+
+typedef int64_t ssize_t;
+typedef int64_t off_t;
+
diff --git a/api/posix/unistd.h b/api/posix/unistd.h
new file mode 100644
index 0000000..6bd69f5
--- /dev/null
+++ b/api/posix/unistd.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+enum seek_whence
+{
+ SEEK_SET
+};
+