diff options
Diffstat (limited to 'api/lib')
| -rw-r--r-- | api/lib/elf.h | 15 | ||||
| -rw-r--r-- | api/lib/kstdio.h | 18 | ||||
| -rw-r--r-- | api/lib/kstring.h | 14 | ||||
| -rw-r--r-- | api/lib/sophialib.h | 14 |
4 files changed, 61 insertions, 0 deletions
diff --git a/api/lib/elf.h b/api/lib/elf.h new file mode 100644 index 0000000..05d25bc --- /dev/null +++ b/api/lib/elf.h @@ -0,0 +1,15 @@ +#pragma once + +#include <elf/elf64.h> + +#include <stdbool.h> +#include <stddef.h> + +#ifdef __x86_64__ +# define elf_validate elf64_validate +# define elf_size elf64_size +#endif + +bool elf64_validate(Elf64_Ehdr *ehdr, unsigned type, unsigned machine); +size_t elf64_size(Elf64_Ehdr *ehdr, Elf64_Phdr *phdr); + diff --git a/api/lib/kstdio.h b/api/lib/kstdio.h new file mode 100644 index 0000000..80e47cc --- /dev/null +++ b/api/lib/kstdio.h @@ -0,0 +1,18 @@ +#pragma once + +#include <lib/kstring.h> + +#include <stdarg.h> + +typedef struct FILE FILE; + +extern FILE *kstdout; +extern FILE *kstderr; + +extern int kfputc(int c, FILE *f); + +int kvfprintf(FILE *f, const char *restrict format, va_list arguments); +int kfprintf(FILE *f, const char *restrict format, ...); +int kvprintf(const char *restrict format, va_list arguments); +int kprintf(const char *restrict format, ...); + diff --git a/api/lib/kstring.h b/api/lib/kstring.h new file mode 100644 index 0000000..c28e17c --- /dev/null +++ b/api/lib/kstring.h @@ -0,0 +1,14 @@ +#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/lib/sophialib.h b/api/lib/sophialib.h new file mode 100644 index 0000000..c28e17c --- /dev/null +++ b/api/lib/sophialib.h @@ -0,0 +1,14 @@ +#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); + |
