From 48f0f588f60e735375f4122122b55def1846d8df Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Sun, 5 Aug 2007 13:14:02 -0500 Subject: [PATCH] Move stdio defs to stdio.h, and fix an x86 makefile bug. --- include/c/std/stdio.h | 25 +++++++++++++++++++++++++ kernel/arch/x86/Makefile | 2 ++ kernel/arch/x86/Makefile.final | 1 - kernel/include/kern/libc.h | 18 ++---------------- 4 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 include/c/std/stdio.h diff --git a/include/c/std/stdio.h b/include/c/std/stdio.h new file mode 100644 index 0000000..97e3d75 --- /dev/null +++ b/include/c/std/stdio.h @@ -0,0 +1,25 @@ +#ifndef _C_STDIO_H +#define _C_STDIO_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + size_t vsnprintf(char *buf, size_t size, const char *str, va_list args); + + size_t snprintf(char *buf, size_t size, const char *str, ...) + __attribute__((format(printf, 3, 4))); + + size_t sprintf(char *buf, const char *str, ...) + __attribute__((format(printf, 2, 3))); + + size_t printf(const char *str, ...) + __attribute__((format(printf, 1, 2))); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/kernel/arch/x86/Makefile b/kernel/arch/x86/Makefile index 02c5e8e..357720c 100644 --- a/kernel/arch/x86/Makefile +++ b/kernel/arch/x86/Makefile @@ -1,6 +1,8 @@ DIR := arch/x86/ DIRS += $(DIR) +CXXFLAGS += -fno-omit-frame-pointer -march=i686 + RAW_ASFILES := entry RAW_CXXFILES := descriptors misc multiboot mem thread diff --git a/kernel/arch/x86/Makefile.final b/kernel/arch/x86/Makefile.final index 34e87b8..090c11d 100644 --- a/kernel/arch/x86/Makefile.final +++ b/kernel/arch/x86/Makefile.final @@ -1,5 +1,4 @@ DIR := arch/x86/ -CXXFLAGS += -fno-omit-frame-pointer -march=i686 $(BUILDDIR)/kernel: $(OBJS) $(LIBS) $(DIR)linker-script @echo $(COMP): Linking kernel: $@ diff --git a/kernel/include/kern/libc.h b/kernel/include/kern/libc.h index 1867a6d..89a166b 100644 --- a/kernel/include/kern/libc.h +++ b/kernel/include/kern/libc.h @@ -3,30 +3,16 @@ #include #include +#include +#include extern "C" { - size_t vsnprintf(char *buf, size_t size, const char *str, va_list args); - size_t snprintf(char *buf, size_t size, const char *str, ...) - __attribute__((format(printf, 3, 4))); - size_t sprintf(char *buf, const char *str, ...) - __attribute__((format(printf, 2, 3))); - size_t printf(const char *str, ...) - __attribute__((format(printf, 1, 2))); - // FIXME: template/alignof versions void *memcpy(void *dest, const void *src, size_t len); void *memmove(void *dest, const void *src, size_t len); int memcmp(const void *b1, const void *b2, size_t len); void *memset(void *b, int ch, size_t len); - size_t strnlen(const char *s, size_t n); - size_t strlen(const char *s); - - char *strcpy(char *dest, const char *src); - char *strncpy(char *dest, const char *src, size_t len); - char *strcat(char *dest, const char *src); - char *strncat(char *dest, const char *src, size_t len); - void bzero(void *b, size_t len); void *malloc(size_t size); -- 2.39.2