From 8d412689a97da681d87d60c8e43ac7e667c539cf Mon Sep 17 00:00:00 2001 From: Lukas Martini Date: Sat, 18 Nov 2023 23:47:39 +0100 Subject: [PATCH] land/newlib: Add _serial_printf debug function --- land/newlib/xelix/Makefile.am | 4 ++-- land/newlib/xelix/crt0.c | 1 + land/newlib/xelix/sys/xelix.h | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/land/newlib/xelix/Makefile.am b/land/newlib/xelix/Makefile.am index 38656df2..21475edd 100644 --- a/land/newlib/xelix/Makefile.am +++ b/land/newlib/xelix/Makefile.am @@ -9,14 +9,14 @@ AM_CCASFLAGS = $(INCLUDES) noinst_LIBRARIES = lib.a if MAY_SUPPLY_SYSCALLS -extra_objs = $(lpfx)syscalls.o stubs.o inet_addr.o inet_ntoa.o getgrent.o mntent.o mntent_r.o getaddrinfo.o openpty.o pututline.o select.o +extra_objs = $(lpfx)syscalls.o stubs.o inet_addr.o inet_ntoa.o getgrent.o mntent.o mntent_r.o getaddrinfo.o openpty.o pututline.o select.o xelix.o else extra_objs = endif lib_a_SOURCES = lib_a_LIBADD = $(extra_objs) -EXTRA_lib_a_SOURCES = crt0.c crti.s crtn.s syscalls.c stubs.c inet_addr.c inet_ntoa.c getgrent.c mntent.c mntent_r.c getaddrinfo.c openpty.c pututline.c select.c +EXTRA_lib_a_SOURCES = crt0.c crti.s crtn.s syscalls.c stubs.c inet_addr.c inet_ntoa.c getgrent.c mntent.c mntent_r.c getaddrinfo.c openpty.c pututline.c select.c xelix.c lib_a_DEPENDENCIES = $(extra_objs) lib_a_CCASFLAGS = $(AM_CCASFLAGS) lib_a_CFLAGS = $(AM_CFLAGS) diff --git a/land/newlib/xelix/crt0.c b/land/newlib/xelix/crt0.c index 0e8ab418..2722d346 100644 --- a/land/newlib/xelix/crt0.c +++ b/land/newlib/xelix/crt0.c @@ -32,6 +32,7 @@ extern void __libc_fini_array(); // These are defined as extern in sys/xelix.h struct _xelix_execdata* _xelix_execdata; char* _progname; +FILE* _xelix_serial = NULL; void __attribute__((fastcall, noreturn)) _start(void) { __libc_init_array(); diff --git a/land/newlib/xelix/sys/xelix.h b/land/newlib/xelix/sys/xelix.h index 291d302b..01a599d9 100644 --- a/land/newlib/xelix/sys/xelix.h +++ b/land/newlib/xelix/sys/xelix.h @@ -20,6 +20,7 @@ #define _SYS_XELIX_H #include +#include #include #include @@ -45,8 +46,10 @@ struct _xelix_execdata { extern struct _xelix_execdata* _xelix_execdata; extern char* _progname; +extern FILE* _xelix_serial; int _strace(void); +void _serial_printf(const char* format, ...); #define syscall(call, a1, a2, a3) __syscall(__errno(), call, (uint32_t)a1, (uint32_t)a2, (uint32_t)a3) static inline uint32_t __syscall(int* errp, uint32_t call, uint32_t arg1, uint32_t arg2, uint32_t arg3) {