Skip to content

Commit

Permalink
land/newlib: Add _serial_printf debug function
Browse files Browse the repository at this point in the history
  • Loading branch information
lutoma committed Nov 18, 2023
1 parent 8d8209a commit 8d41268
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions land/newlib/xelix/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions land/newlib/xelix/crt0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions land/newlib/xelix/sys/xelix.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define _SYS_XELIX_H

#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <limits.h>

Expand All @@ -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) {
Expand Down

0 comments on commit 8d41268

Please sign in to comment.