#include #include #include #include #include int errno; extern void gilbraltar_serial_write(const char *, size_t); extern void gilbraltar_serial_puts(const char *); static size_t console_write(FILE *f __attribute__((unused)), const char *str, size_t len) { gilbraltar_serial_write(str, len); return (len); } static FILE console = { .write = console_write }; FILE *stderr = &console; FILE *stdout = &console; ssize_t write(int fd, const void *buf, size_t count) { if (fd == 1 || fd == 2) { gilbraltar_serial_write(buf, count); return (count); } errno = ENOSYS; return (-1); } void exit(int status) { while (1) __asm__ __volatile("wfi"); } void abort(void) { gilbraltar_serial_puts("Aborted\r\n"); while (1) __asm__ __volatile("wfi"); } #if defined(__aarch64__) int __getauxval(int unused) { errno = ENOENT; return (0); } #endif