diff options
Diffstat (limited to 'klibc/klibc')
-rw-r--r-- | klibc/klibc/Makefile | 12 | ||||
-rw-r--r-- | klibc/klibc/arch/ppc/include/klibc/archsys.h | 24 | ||||
-rw-r--r-- | klibc/klibc/getpagesize.c | 26 | ||||
-rw-r--r-- | klibc/klibc/include/stdio.h | 14 | ||||
-rw-r--r-- | klibc/klibc/include/unistd.h | 2 | ||||
-rw-r--r-- | klibc/klibc/mmap.c | 2 | ||||
-rw-r--r-- | klibc/klibc/syscommon.h | 2 |
7 files changed, 57 insertions, 25 deletions
diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 5fc481aa8a..def201524a 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -24,7 +24,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \ __signal.o signal.o bsd_signal.o siglist.o siglongjmp.o \ sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ - brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ + brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o getpagesize.o \ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ memmove.o \ strcasecmp.o strncasecmp.o strndup.o strerror.o \ @@ -118,12 +118,12 @@ socketcalls.dir: SOCKETCALLS socketcalls.pl socketcommon.h touch $@ %/static.obj: %.dir - $(MAKE) objects-$(basename $(notdir $@)) DIR=$* + $(MAKE) objects-$(basename $(notdir $@)) DIR=$*/ -STATIC = $(addsuffix .o,$(basename $(wildcard $(DIR)/*.[cS]))) +STATIC = $(addsuffix .o,$(basename $(wildcard $(DIR)*.[cS]))) objects-static: $(STATIC) - touch $(DIR)/static.obj + touch $(DIR)static.obj clean: archclean find . -type f -a \( -name \*.[isoa] -o -name \*.l[iso] \) -print0 | xargs -0rt rm -f @@ -140,6 +140,6 @@ spotless: clean bitsize: @echo $(BITSIZE) -ifneq ($(wildcard $(DIR)/.*.d),) -include $(wildcard $(DIR)/.*.d) +ifneq ($(wildcard $(DIR).*.d),) +include $(wildcard $(DIR).*.d) endif diff --git a/klibc/klibc/arch/ppc/include/klibc/archsys.h b/klibc/klibc/arch/ppc/include/klibc/archsys.h index 33a5ff3236..17a28859e5 100644 --- a/klibc/klibc/arch/ppc/include/klibc/archsys.h +++ b/klibc/klibc/arch/ppc/include/klibc/archsys.h @@ -36,18 +36,24 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ __asm__ __volatile__ \ ("sc \n\t" \ "mfcr %1 " \ - : "=&r" (__sc_3), "=&r" (__sc_0) \ - : "0" (__sc_3), "1" (__sc_0), \ - "r" (__sc_4), \ - "r" (__sc_5), \ - "r" (__sc_6), \ - "r" (__sc_7), \ - "r" (__sc_8) \ - : __syscall_clobbers); \ + : "+r" (__sc_3), \ + "+r" (__sc_0), \ + "+r" (__sc_4), \ + "+r" (__sc_5), \ + "+r" (__sc_6), \ + "+r" (__sc_7), \ + "+r" (__sc_8) \ + : : "cr0", "ctr", "memory", \ + "r9", "r10", "r11", "r12"); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ - __syscall_return (type); \ + if (__sc_err & 0x10000000) \ + { \ + errno = (int)__sc_ret; \ + __sc_ret = -1; \ + } \ + return (type)__sc_ret; \ } #endif /* _syscall6() missing */ diff --git a/klibc/klibc/getpagesize.c b/klibc/klibc/getpagesize.c new file mode 100644 index 0000000000..2d975b1586 --- /dev/null +++ b/klibc/klibc/getpagesize.c @@ -0,0 +1,26 @@ +/* + * getpagesize.c + */ + +#include <sys/syscall.h> +#include <asm/page.h> + +/* Presumably there is a better way to do this... */ +#ifdef __ia64__ +# define __NR_getpagesize 1171 +#endif + +#ifdef __NR_getpagesize + +_syscall0(int,getpagesize); + +#else + +int getpagesize(void) +{ + return PAGE_SIZE; +} + +#endif + + diff --git a/klibc/klibc/include/stdio.h b/klibc/klibc/include/stdio.h index 31a1fe40af..fba1e30746 100644 --- a/klibc/klibc/include/stdio.h +++ b/klibc/klibc/include/stdio.h @@ -15,10 +15,6 @@ struct _IO_file; typedef struct _IO_file FILE; -#define stdin ((FILE *)0) -#define stdout ((FILE *)1) -#define stderr ((FILE *)2) - #ifndef EOF # define EOF (-1) #endif @@ -44,10 +40,12 @@ static __inline__ int fileno(FILE *__f) return (int)(size_t)__f - 1; } -static __inline__ FILE * __create_file(int __fd) -{ - return (FILE *)(size_t)(__fd + 1); -} +/* This is a macro so it can be used as initializer */ +#define __create_file(__fd) ((FILE *)(size_t)((__fd) + 1)) + +#define stdin __create_file(0) +#define stdout __create_file(1) +#define stderr __create_file(2) __extern FILE *fopen(const char *, const char *); diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h index ad12913834..3d5c6881d3 100644 --- a/klibc/klibc/include/unistd.h +++ b/klibc/klibc/include/unistd.h @@ -105,6 +105,8 @@ __extern int optind, opterr, optopt; __extern int isatty(int); +__extern int getpagesize(void); + /* Standard file descriptor numbers. */ #define STDIN_FILENO 0 #define STDOUT_FILENO 1 diff --git a/klibc/klibc/mmap.c b/klibc/klibc/mmap.c index aedf4dceb5..89cf3a6a8f 100644 --- a/klibc/klibc/mmap.c +++ b/klibc/klibc/mmap.c @@ -19,7 +19,7 @@ * Prefer mmap2() over mmap(), except on the architectures listed */ -#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc64__) +#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc__) && !defined(__powerpc64__) /* This architecture uses mmap2() */ diff --git a/klibc/klibc/syscommon.h b/klibc/klibc/syscommon.h index 3093920739..429025279e 100644 --- a/klibc/klibc/syscommon.h +++ b/klibc/klibc/syscommon.h @@ -28,5 +28,5 @@ #include <unistd.h> #ifdef __i386__ -#include <sys/vm86.h> +# include <sys/vm86.h> #endif |