diff --git a/Makefile b/Makefile index 32aea90..8fbe137 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ AR := $(CROSS)ar # Do NOT depend on system-installed headers! If you need to make a header change, # test it in your source first! -INCLUDE_DIRS += $(WORKING_DIR)/include $(WORKING_DIR)/include/PR $(WORKING_DIR)/include/compiler/modern_gcc $(BUILD_DIR) $(BUILD_DIR)/include $(WORKING_DIR)/src $(WORKING_DIR) +INCLUDE_DIRS += $(WORKING_DIR)/include $(WORKING_DIR)/include/PR $(WORKING_DIR)/include/libc $(BUILD_DIR) $(BUILD_DIR)/include $(WORKING_DIR)/src $(WORKING_DIR) GBIDEFINE := -DF3DEX_GBI_2 diff --git a/include/compiler/gcc/stdarg.h b/include/compiler/gcc/stdarg.h deleted file mode 100644 index ebadc39..0000000 --- a/include/compiler/gcc/stdarg.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef _STDARG_H -#define _STDARG_H -/* ---------------------------------------- */ -/* VARARGS for MIPS/GNU CC */ -/* */ -/* */ -/* */ -/* */ -/* ---------------------------------------- */ - -/* These macros implement varargs for GNU C--either traditional or ANSU. */ - -/* Define __gnuc_va_list. */ - -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST -typedef char* __gnuc_va_list; -#endif /* not __GNUC_VA_LIST */ - -/* If this is for internal libc use, don't define anything but - __gnuc_va_list. */ -#if defined(_STDARG_H) || defined(_VARARGS_H) - -/* In GCC version 2, we want an ellipsis at the end of the declaration - of the argument list. GCC version 1 can't parse it. */ - -#if __GNUC__ > 1 -#define __va_ellipsis ... -#else -#define __va_ellipsis -#endif - -#if __mips >= 3 -#define __va_rounded_size(__TYPE) (((sizeof(__TYPE) + 8 - 1) / 8) * 8) -#else -#define __va_rounded_size(__TYPE) (((sizeof(__TYPE) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) -#endif - -/* Get definitions for _MIPS_SIM_ABI64 etc. */ -#ifdef _MIPS_SIM -#include -#endif - -#ifdef _STDARG_H -#if defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64) -#define va_start(__AP, __LASTARG) \ - (__AP = __builtin_next_arg(__LASTARG) - 64 + (__builtin_args_info(2) > 8 ? 64 : __builtin_args_info(2) * 8)) -#else -#define va_start(__AP, __LASTARG) (__AP = (__gnuc_va_list)__builtin_next_arg(__LASTARG)) -#endif - -#else -#define va_alist __builtin_va_alist -#if __mips >= 3 -/* This assumes that `long long int' is always a 64 bit type. */ -#define va_dcl \ - long long int __builtin_va_alist; \ - __va_ellipsis -#else -#define va_dcl \ - int __builtin_va_alist; \ - __va_ellipsis -#endif -/* Need alternate code for _MIPS_SIM_ABI64, but don't use that symbol - because it may not be defined. */ -#if defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64) -#define va_start(__AP) \ - (__AP = __builtin_next_arg() - 64 + (__builtin_args_info(2) > 8 ? 64 : __builtin_args_info(2) * 8)) -#else -#define va_start(__AP) __AP = (char*)&__builtin_va_alist -#endif -#endif - -#ifndef va_end -void va_end(__gnuc_va_list); /* Defined in libgcc.a */ -#endif -#define va_end(__AP) ((void)0) - -/* We cast to void * and then to TYPE * because this avoids - a warning about increasing the alignment requirement. */ -/* The __mips>=3 cases are reversed from the 32 bit cases, because the standard - 32 bit calling convention left-aligns all parameters smaller than a word, - whereas the __mips>=3 calling convention does not (and hence they are - right aligned). */ -#if __mips >= 3 -#ifdef __MIPSEB__ -#define va_arg(__AP, __type) \ - ((__type*)(void*)(__AP = (char*)((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) + __va_rounded_size(__type))))[-1] -#else -#define va_arg(__AP, __type) \ - ((__AP = (char*)((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) + __va_rounded_size(__type))), \ - *(__type*)(void*)(__AP - __va_rounded_size(__type))) -#endif - -#else /* not __mips>=3 */ - -#ifdef __MIPSEB__ -/* For big-endian machines. */ -#define va_arg(__AP, __type) \ - ((__AP = (char*)((__alignof__(__type) > 4 ? ((int)__AP + 8 - 1) & -8 : ((int)__AP + 4 - 1) & -4) \ - + __va_rounded_size(__type))), \ - *(__type*)(void*)(__AP - __va_rounded_size(__type))) -#else -/* For little-endian machines. */ -#define va_arg(__AP, __type) \ - ((__type*)(void*)(__AP = (char*)((__alignof__(__type) > 4 ? ((int)__AP + 8 - 1) & -8 : ((int)__AP + 4 - 1) & -4) \ - + __va_rounded_size(__type))))[-1] -#endif -#endif - -typedef __gnuc_va_list va_list; - -#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ -#endif diff --git a/include/compiler/ido/math.h b/include/compiler/ido/math.h deleted file mode 100644 index 3e93ceb..0000000 --- a/include/compiler/ido/math.h +++ /dev/null @@ -1 +0,0 @@ -// Nothing needed here diff --git a/include/compiler/ido/memory.h b/include/compiler/ido/memory.h deleted file mode 100644 index c2e4ef9..0000000 --- a/include/compiler/ido/memory.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _MEMORY_H -#define _MEMORY_H -/* - memory.h -*/ - -#ifndef _SIZE_T_DEF -#define _SIZE_T_DEF -typedef unsigned size_t; -#endif - -void* memccpy(void*, void*, int, size_t); -void* memchr(void*, int, size_t); -int memcmp(const void*, const void*, size_t); -void* memcpy(void*, const void*, size_t); -int memicmp(void*, void*, size_t); -void* memmove(void*, void*, size_t); -void* memset(void*, int, size_t); - -void movmem(void*, void*, unsigned); -void setmem(void*, unsigned, int); - -#endif diff --git a/include/compiler/ido/stdarg.h b/include/compiler/ido/stdarg.h deleted file mode 100644 index d44996a..0000000 --- a/include/compiler/ido/stdarg.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _STDARG_H -#define _STDARG_H - -typedef char* va_list; -#define _FP 1 -#define _INT 0 -#define _STRUCT 2 - -#define _VA_FP_SAVE_AREA 0x10 -#define _VA_ALIGN(p, a) (((unsigned int)(((char*)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4)) -#define va_start(vp, parmN) (vp = ((va_list) & parmN + sizeof(parmN))) - -#define __va_stack_arg(list, mode) \ - (((list) = (char*)_VA_ALIGN(list, __builtin_alignof(mode)) + _VA_ALIGN(sizeof(mode), 4)), \ - (((char*)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode)))) - -#define __va_double_arg(list, mode) \ - ((((long)list & 0x1) /* 1 byte aligned? */ \ - ? (list = (char*)((long)list + 7), (char*)((long)list - 6 - _VA_FP_SAVE_AREA)) \ - : (((long)list & 0x2) /* 2 byte aligned? */ \ - ? (list = (char*)((long)list + 10), (char*)((long)list - 24 - _VA_FP_SAVE_AREA)) \ - : __va_stack_arg(list, mode)))) - -#define va_arg(list, mode) \ - ((mode*)(((__builtin_classof(mode) == _FP && __builtin_alignof(mode) == sizeof(double)) \ - ? __va_double_arg(list, mode) \ - : __va_stack_arg(list, mode))))[-1] -#define va_end(__list) - -#endif /* STDARG_H */ diff --git a/include/compiler/ido/stdio.h b/include/compiler/ido/stdio.h deleted file mode 100644 index 3e93ceb..0000000 --- a/include/compiler/ido/stdio.h +++ /dev/null @@ -1 +0,0 @@ -// Nothing needed here diff --git a/include/compiler/ido/stdlib.h b/include/compiler/ido/stdlib.h deleted file mode 100644 index 669efd6..0000000 --- a/include/compiler/ido/stdlib.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef _STDLIB_H -#define _STDLIB_H -/* - stdlib.h -*/ - -#ifndef _SIZE_T_DEF -#define _SIZE_T_DEF -typedef unsigned size_t; -#endif - -#ifndef _DIV_T_DEF -#define _DIV_T_DEF -typedef struct DIV_T { - int quot; - int rem; -} div_t; -#endif - -#ifndef _LDIV_T_DEF -#define _LDIV_T_DEF -typedef struct LDIV_T { - long quot; - long rem; -} ldiv_t; -#endif - -#ifndef _LLDIV_T_DEF -#define _LLDIV_T_DEF -typedef struct lldiv_t { - long long quot; - long long rem; -} lldiv_t; -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#define _max(a, b) (((a) > (b)) ? (a) : (b)) -#define _min(a, b) (((a) < (b)) ? (a) : (b)) - -#define RAND_MAX 32767 - -int rand(void); -void srand(unsigned); - -int abs(int); -long labs(long); - -div_t div(int, int); -ldiv_t ldiv(long, long); -lldiv_t lldiv(long long, long long); - -int atoi(const char*); -long atol(const char*); - -long strtol(const char*, char**, int); -unsigned long strtoul(const char*, char**, int); - -char* itoa(int, char*, int); -char* ltoa(long, char*, int); -char* ultoa(unsigned long, char*, int); - -double atof(const char*); -double strtod(const char*, char**); - -void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); -void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); - -void* malloc(size_t); -void* calloc(size_t, size_t); -void* realloc(void*, size_t); -void free(void*); - -void exit(int); - -void abort(void); - -#endif diff --git a/include/compiler/ido/string.h b/include/compiler/ido/string.h deleted file mode 100644 index e2ddc92..0000000 --- a/include/compiler/ido/string.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _STRING_H -#define _STRING_H -/* - string.h -*/ - -#ifndef _SIZE_T_DEF -#define _SIZE_T_DEF -typedef unsigned size_t; -#endif - -#include "memory.h" - -char* stpcpy(char*, const char*); -char* strcat(char*, const char*); -char* strchr(const char*, int); -int strcmp(const char*, const char*); -char* strcpy(char*, const char*); -size_t strcspn(const char*, const char*); -char* strdup(const char*); -char* strerror(int); -int stricmp(const char*, const char*); -size_t strlen(const char*); -char* strlwr(char*); -char* strncat(char*, const char*, size_t); -int strncmp(const char*, const char*, size_t); -char* strncpy(char*, const char*, size_t); -int strnicmp(const char*, const char*, size_t); -char* strnset(char*, int, size_t); -char* strpbrk(const char*, const char*); -char* strrchr(const char*, int); -char* strrev(char*); -char* strset(char*, int); -size_t strspn(const char*, const char*); -char* strstr(const char*, const char*); -char* strtok(char*, const char*); -char* strupr(char*); - -#define strcmpi(s1, s2) stricmp(s1, s2) -#define strncmpi(s1, s2, n) strnicmp(s1, s2, n) - -#endif diff --git a/include/compiler/modern_gcc/math.h b/include/compiler/modern_gcc/math.h deleted file mode 100644 index 3e93ceb..0000000 --- a/include/compiler/modern_gcc/math.h +++ /dev/null @@ -1 +0,0 @@ -// Nothing needed here diff --git a/include/compiler/modern_gcc/memory.h b/include/compiler/modern_gcc/memory.h deleted file mode 100644 index c2e4ef9..0000000 --- a/include/compiler/modern_gcc/memory.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _MEMORY_H -#define _MEMORY_H -/* - memory.h -*/ - -#ifndef _SIZE_T_DEF -#define _SIZE_T_DEF -typedef unsigned size_t; -#endif - -void* memccpy(void*, void*, int, size_t); -void* memchr(void*, int, size_t); -int memcmp(const void*, const void*, size_t); -void* memcpy(void*, const void*, size_t); -int memicmp(void*, void*, size_t); -void* memmove(void*, void*, size_t); -void* memset(void*, int, size_t); - -void movmem(void*, void*, unsigned); -void setmem(void*, unsigned, int); - -#endif diff --git a/include/compiler/modern_gcc/sgidefs.h b/include/compiler/modern_gcc/sgidefs.h deleted file mode 100644 index a56d837..0000000 --- a/include/compiler/modern_gcc/sgidefs.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ralf Baechle . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _SGIDEFS_H -#define _SGIDEFS_H 1 - -/* - * Definitions for the ISA level - */ -#define _MIPS_ISA_MIPS1 1 -#define _MIPS_ISA_MIPS2 2 -#define _MIPS_ISA_MIPS3 3 -#define _MIPS_ISA_MIPS4 4 -#define _MIPS_ISA_MIPS5 5 - -/* - * Subprogram calling convention - * - * At the moment only _MIPS_SIM_ABI32 is in use. This will change rsn. - * Until GCC 2.8.0 is released don't rely on this definitions because the - * 64bit code is essentially using the 32bit interface model just with - * 64bit registers. - */ -#define _MIPS_SIM_ABI32 1 -#define _MIPS_SIM_NABI32 2 -#define _MIPS_SIM_ABI64 3 - -#endif /* sgidefs.h */ diff --git a/include/compiler/modern_gcc/stdio.h b/include/compiler/modern_gcc/stdio.h deleted file mode 100644 index 3e93ceb..0000000 --- a/include/compiler/modern_gcc/stdio.h +++ /dev/null @@ -1 +0,0 @@ -// Nothing needed here diff --git a/include/compiler/modern_gcc/stdlib.h b/include/compiler/modern_gcc/stdlib.h deleted file mode 100644 index 669efd6..0000000 --- a/include/compiler/modern_gcc/stdlib.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef _STDLIB_H -#define _STDLIB_H -/* - stdlib.h -*/ - -#ifndef _SIZE_T_DEF -#define _SIZE_T_DEF -typedef unsigned size_t; -#endif - -#ifndef _DIV_T_DEF -#define _DIV_T_DEF -typedef struct DIV_T { - int quot; - int rem; -} div_t; -#endif - -#ifndef _LDIV_T_DEF -#define _LDIV_T_DEF -typedef struct LDIV_T { - long quot; - long rem; -} ldiv_t; -#endif - -#ifndef _LLDIV_T_DEF -#define _LLDIV_T_DEF -typedef struct lldiv_t { - long long quot; - long long rem; -} lldiv_t; -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#define _max(a, b) (((a) > (b)) ? (a) : (b)) -#define _min(a, b) (((a) < (b)) ? (a) : (b)) - -#define RAND_MAX 32767 - -int rand(void); -void srand(unsigned); - -int abs(int); -long labs(long); - -div_t div(int, int); -ldiv_t ldiv(long, long); -lldiv_t lldiv(long long, long long); - -int atoi(const char*); -long atol(const char*); - -long strtol(const char*, char**, int); -unsigned long strtoul(const char*, char**, int); - -char* itoa(int, char*, int); -char* ltoa(long, char*, int); -char* ultoa(unsigned long, char*, int); - -double atof(const char*); -double strtod(const char*, char**); - -void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); -void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); - -void* malloc(size_t); -void* calloc(size_t, size_t); -void* realloc(void*, size_t); -void free(void*); - -void exit(int); - -void abort(void); - -#endif diff --git a/include/compiler/modern_gcc/string.h b/include/compiler/modern_gcc/string.h deleted file mode 100644 index e2ddc92..0000000 --- a/include/compiler/modern_gcc/string.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _STRING_H -#define _STRING_H -/* - string.h -*/ - -#ifndef _SIZE_T_DEF -#define _SIZE_T_DEF -typedef unsigned size_t; -#endif - -#include "memory.h" - -char* stpcpy(char*, const char*); -char* strcat(char*, const char*); -char* strchr(const char*, int); -int strcmp(const char*, const char*); -char* strcpy(char*, const char*); -size_t strcspn(const char*, const char*); -char* strdup(const char*); -char* strerror(int); -int stricmp(const char*, const char*); -size_t strlen(const char*); -char* strlwr(char*); -char* strncat(char*, const char*, size_t); -int strncmp(const char*, const char*, size_t); -char* strncpy(char*, const char*, size_t); -int strnicmp(const char*, const char*, size_t); -char* strnset(char*, int, size_t); -char* strpbrk(const char*, const char*); -char* strrchr(const char*, int); -char* strrev(char*); -char* strset(char*, int); -size_t strspn(const char*, const char*); -char* strstr(const char*, const char*); -char* strtok(char*, const char*); -char* strupr(char*); - -#define strcmpi(s1, s2) stricmp(s1, s2) -#define strncmpi(s1, s2, n) strnicmp(s1, s2, n) - -#endif diff --git a/include/compiler/gcc/math.h b/include/libc/math.h similarity index 100% rename from include/compiler/gcc/math.h rename to include/libc/math.h diff --git a/include/compiler/gcc/memory.h b/include/libc/memory.h similarity index 100% rename from include/compiler/gcc/memory.h rename to include/libc/memory.h diff --git a/include/compiler/gcc/sgidefs.h b/include/libc/sgidefs.h similarity index 100% rename from include/compiler/gcc/sgidefs.h rename to include/libc/sgidefs.h diff --git a/include/compiler/modern_gcc/stdarg.h b/include/libc/stdarg.h similarity index 100% rename from include/compiler/modern_gcc/stdarg.h rename to include/libc/stdarg.h diff --git a/include/compiler/gcc/stdio.h b/include/libc/stdio.h similarity index 100% rename from include/compiler/gcc/stdio.h rename to include/libc/stdio.h diff --git a/include/compiler/gcc/stdlib.h b/include/libc/stdlib.h similarity index 100% rename from include/compiler/gcc/stdlib.h rename to include/libc/stdlib.h diff --git a/include/compiler/gcc/string.h b/include/libc/string.h similarity index 100% rename from include/compiler/gcc/string.h rename to include/libc/string.h diff --git a/include/sgidefs.h b/include/sgidefs.h index 45b834d..571715a 100644 --- a/include/sgidefs.h +++ b/include/sgidefs.h @@ -1,3 +1,3 @@ #ifdef __GNUC__ -#include "compiler/modern_gcc/sgidefs.h" +#include "libc/sgidefs.h" #endif