diff options
author | Ian Moffett <ian@osmora.org> | 2024-03-07 17:28:52 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-03-07 18:24:51 -0500 |
commit | f5e48e94a2f4d4bbd6e5628c7f2afafc6dbcc459 (patch) | |
tree | 93b156621dc0303816b37f60ba88051b702d92f6 /lib/mlibc/sysdeps/hyra/generic | |
parent | bd5969fc876a10b18613302db7087ef3c40f18e1 (diff) |
build: Build mlibc + add distclean target
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/sysdeps/hyra/generic')
-rw-r--r-- | lib/mlibc/sysdeps/hyra/generic/entry.cpp | 35 | ||||
-rw-r--r-- | lib/mlibc/sysdeps/hyra/generic/hyra.cpp | 121 |
2 files changed, 0 insertions, 156 deletions
diff --git a/lib/mlibc/sysdeps/hyra/generic/entry.cpp b/lib/mlibc/sysdeps/hyra/generic/entry.cpp deleted file mode 100644 index d5129af..0000000 --- a/lib/mlibc/sysdeps/hyra/generic/entry.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include <bits/ensure.h> -#include <mlibc/elf/startup.h> -#include <stdint.h> -#include <stdlib.h> - -// defined by the POSIX library -void __mlibc_initLocale(); - -extern "C" uintptr_t *__dlapi_entrystack(); - -extern char **environ; -static mlibc::exec_stack_data __mlibc_stack_data; - -struct LibraryGuard { - LibraryGuard(); -}; - -static LibraryGuard guard; - -LibraryGuard::LibraryGuard() { - __mlibc_initLocale(); - - // Parse the exec() stack. - mlibc::parse_exec_stack(__dlapi_entrystack(), &__mlibc_stack_data); - mlibc::set_startup_data(__mlibc_stack_data.argc, __mlibc_stack_data.argv, - __mlibc_stack_data.envp); -} - -extern "C" void __mlibc_entry(int (*main_fn)(int argc, char *argv[], - char *env[])) { - // TODO: call __dlapi_enter, otherwise static builds will break (see Linux - // sysdeps) - auto result = main_fn(__mlibc_stack_data.argc, __mlibc_stack_data.argv, environ); - exit(result); -} diff --git a/lib/mlibc/sysdeps/hyra/generic/hyra.cpp b/lib/mlibc/sysdeps/hyra/generic/hyra.cpp deleted file mode 100644 index fb555b9..0000000 --- a/lib/mlibc/sysdeps/hyra/generic/hyra.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include <stddef.h> -#include <sys/types.h> -#include <hyra/syscall.h> - -namespace mlibc { -void sys_libc_log(const char *msg) { - __syscall(0, (uintptr_t)msg); -} - -int sys_anon_allocate(size_t size, void **pointer) { - (void)size; - (void)pointer; - while (1); -} - -void sys_libc_panic() { - sys_libc_log("\n** MLIBC PANIC **\n"); - while (1); -} - -int sys_tcb_set(void *pointer) { - (void)pointer; - - while (1); -} - -void sys_exit(int status) { -} - -void sys_seek(int fd, off_t offset, int whence, off_t *new_offset) { - (void)fd; - (void)offset; - (void)whence; - (void)new_offset; - - while (1); -} - -int sys_vm_map(void *hint, size_t size, int prot, int flags, int fd, - off_t offset, void **window) { - (void)hint; - (void)size; - (void)prot; - (void)flags; - (void)fd; - (void)offset; - (void)window; - - while (1); -} - -int sys_vm_unmap(void *address, size_t size) { - (void)address; - (void)size; - - while (1); -} - -int sys_anon_free(void *pointer, size_t size) { - (void)pointer; - (void)size; - - while (1); -} - -int sys_clock_get(int clock, time_t *secs, long *nanos) { - (void)clock; - (void)secs; - (void)nanos; - - while (1); -} - -int sys_futex_wait(int *pointer, int expected, const struct timespec *time) { - (void)pointer; - (void)expected; - (void)time; - - return 0; -} - -int sys_futex_wake(int *pointer) { - (void)pointer; - - return 0; -} - -int sys_open(const char *filename, int flags, mode_t mode, int *fd) { - (void)filename; - (void)flags; - (void)mode; - (void)fd; - - while (1); -} - -int sys_read(int fd, void *buf, size_t count, ssize_t *bytes_read) { - (void)fd; - (void)buf; - (void)count; - (void)bytes_read; - - while (1); -} - -int sys_write(int fd, const void *buffer, size_t count, ssize_t *written) { - (void)fd; - (void)buffer; - (void)count; - (void)written; - - while (1); -} - -int sys_close(int fd) { - (void)fd; - - while (1); -} - -} |