Printf in userspace

This commit is contained in:
2025-09-06 12:14:54 +02:00
parent cd0e262e56
commit 97bfa178d1
13 changed files with 1756 additions and 1728 deletions

View File

@ -9,9 +9,11 @@ SRCFILES := $(call GRABSRC, \
syscall \
string \
system \
printf \
)
CFLAGS += -isystem $(ROOT)/share -isystem $(ROOT)/ulib -isystem $(ROOT)/std/include
CFLAGS += -isystem $(ROOT)/share -isystem $(ROOT)/ulib -isystem $(ROOT)/std/include \
-DPRINTF_INCLUDE_CONFIG_H=1
ASFILES := $(call GET_ASFILES, $(SRCFILES))
CFILES := $(call GET_CFILES, $(SRCFILES))

1
ulib/printf/printf.c Symbolic link
View File

@ -0,0 +1 @@
../../share/printf/printf.c

1
ulib/printf/printf.h Symbolic link
View File

@ -0,0 +1 @@
../../share/printf/printf.h

1
ulib/printf/printf_config.h Symbolic link
View File

@ -0,0 +1 @@
../../share/printf/printf_config.h

9
ulib/putchar.c Normal file
View File

@ -0,0 +1,9 @@
#include <stdint.h>
#include <sysdefs/ipcpipe.h>
#include <system/ipcpipe.h>
#include <printf/printf.h>
void putchar_(char c) {
char buf = c;
ipcpipe(IPCPIPE_SELFPID, IPCPIPE_OUT, IPCPIPE_WRITE, (uint8_t *)&buf, sizeof(buf));
}

13
ulib/uprintf.h Normal file
View File

@ -0,0 +1,13 @@
#ifndef ULIB_UPRINTF_H_
#define ULIB_UPRINTF_H_
#include <printf/printf.h>
#define uprintf printf_
#define usprintf sprintf_
#define uvsprintf vsprintf_
#define usnprintf snprintf_
#define uvsnprintf vsnprintf_
#define uvprintf vprintf_
#endif // ULIB_UPRINTF_H_