diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | com32/include/alloca.h | 12 | ||||
-rw-r--r-- | com32/include/endian.h | 15 | ||||
-rw-r--r-- | com32/include/klibc/endian.h | 38 | ||||
-rw-r--r-- | com32/include/setjmp.h | 27 | ||||
-rw-r--r-- | com32/include/sys/time.h | 6 | ||||
-rw-r--r-- | com32/include/time.h | 6 | ||||
-rw-r--r-- | com32/libutil/crypt-md5.c | 2 | ||||
-rw-r--r-- | com32/modules/mboot.c | 1 | ||||
-rw-r--r-- | dos/inttypes.h | 1 | ||||
-rw-r--r-- | dos/stdint.h | 142 | ||||
-rw-r--r-- | memdisk/Makefile | 2 | ||||
-rw-r--r-- | memdump/argv.c | 2 | ||||
-rw-r--r-- | memdump/inttypes.h | 1 | ||||
-rw-r--r-- | memdump/stdint.h | 142 |
15 files changed, 369 insertions, 29 deletions
@@ -26,6 +26,7 @@ Changes in 3.52: randomly corrupted register FS. * Simple menu system: fix memory overwrite bug that caused some systems to lock up or behave weirdly. + * Fix building on 64-bit systems without a 32-bit libc installed. Changes in 3.51: * EXTLINUX: Fix failure to find the configuration file. diff --git a/com32/include/alloca.h b/com32/include/alloca.h new file mode 100644 index 00000000..91ef4c0d --- /dev/null +++ b/com32/include/alloca.h @@ -0,0 +1,12 @@ +/* + * alloca.h + * + * Just call the builtin alloca() function + */ + +#ifndef _ALLOCA_H +#define _ALLOCA_H + +#define alloca(size) __builtin_alloca(size) + +#endif /* _ALLOCA_H */ diff --git a/com32/include/endian.h b/com32/include/endian.h new file mode 100644 index 00000000..a6cd6d9b --- /dev/null +++ b/com32/include/endian.h @@ -0,0 +1,15 @@ +/* + * endian.h + */ + +#ifndef _ENDIAN_H +#define _ENDIAN_H + +#include <klibc/endian.h> + +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#define PDP_ENDIAN __PDP_ENDIAN +#define BYTE_ORDER __BYTE_ORDER + +#endif /* _ENDIAN_H */ diff --git a/com32/include/klibc/endian.h b/com32/include/klibc/endian.h new file mode 100644 index 00000000..7537a47e --- /dev/null +++ b/com32/include/klibc/endian.h @@ -0,0 +1,38 @@ +/* + * klibc/endian.h + * + * Like <endian.h>, but export only double-underscore symbols + */ + +#ifndef _KLIBC_ENDIAN_H +#define _KLIBC_ENDIAN_H + +#define __LITTLE_ENDIAN /* we're on i386, littleendian */ + +/* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or + __BIG_ENDIAN, but the glibc/BSD-ish macros expect both to be + defined with __BYTE_ORDER defining which is actually used... */ + +#if defined(__LITTLE_ENDIAN) +# undef __LITTLE_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __LITTLE_ENDIAN +#elif defined(__BIG_ENDIAN) +# undef __BIG_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __BIG_ENDIAN +#elif defined(__PDP_ENDIAN) +# undef __PDP_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __PDP_ENDIAN +#else +# error "Unknown byte order!" +#endif + +#endif /* _KLIBC_ENDIAN_H */ diff --git a/com32/include/setjmp.h b/com32/include/setjmp.h index b504eb6d..11b18fbd 100644 --- a/com32/include/setjmp.h +++ b/com32/include/setjmp.h @@ -8,36 +8,15 @@ #include <klibc/extern.h> #include <klibc/compiler.h> #include <stddef.h> -#include <signal.h> #include <klibc/archsetjmp.h> __extern int setjmp(jmp_buf); __extern __noreturn longjmp(jmp_buf, int); -/* - Whose bright idea was it to add unrelated functionality to just about - the only function in the standard C library (setjmp) which cannot be - wrapped by an ordinary function wrapper? Anyway, the damage is done, - and therefore, this wrapper *must* be inline. However, gcc will - complain if this is an inline function for unknown reason, and - therefore sigsetjmp() needs to be a macro. -*/ - -struct __sigjmp_buf { - jmp_buf __jmpbuf; - sigset_t __sigs; -}; - -typedef struct __sigjmp_buf sigjmp_buf[1]; - -#define sigsetjmp(__env, __save) \ -({ \ - struct __sigjmp_buf *__e = (__env); \ - sigprocmask(0, NULL, &__e->__sigs); \ - setjmp(__e->__jmpbuf); \ -}) +typedef jmp_buf sigjmp_buf; -__extern __noreturn siglongjmp(sigjmp_buf, int); +#define sigsetjmp(__env, __save) setjmp(__env) +#define siglongjmp(__env, __val) longjmp(__env, __val) #endif /* _SETJMP_H */ diff --git a/com32/include/sys/time.h b/com32/include/sys/time.h new file mode 100644 index 00000000..c5bff0da --- /dev/null +++ b/com32/include/sys/time.h @@ -0,0 +1,6 @@ +#ifndef _SYS_TIME_H +#define _SYS_TIME_H + +/* empty */ + +#endif diff --git a/com32/include/time.h b/com32/include/time.h index e69de29b..259386a6 100644 --- a/com32/include/time.h +++ b/com32/include/time.h @@ -0,0 +1,6 @@ +#ifndef _TIME_H +#define _TIME_H + +/* empty */ + +#endif diff --git a/com32/libutil/crypt-md5.c b/com32/libutil/crypt-md5.c index 7804e4d5..c5034432 100644 --- a/com32/libutil/crypt-md5.c +++ b/com32/libutil/crypt-md5.c @@ -32,8 +32,6 @@ * UNIX password */ -#include "crypt.h" - static char itoa64[] = /* 0 ... 63 => ascii - 64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; diff --git a/com32/modules/mboot.c b/com32/modules/mboot.c index 23638b4f..d1657ea1 100644 --- a/com32/modules/mboot.c +++ b/com32/modules/mboot.c @@ -30,7 +30,6 @@ #include <stdlib.h> #include <stddef.h> #include <string.h> -#include <malloc.h> #include <consoles.h> #include <zlib.h> #include <com32.h> diff --git a/dos/inttypes.h b/dos/inttypes.h new file mode 100644 index 00000000..9a6118bd --- /dev/null +++ b/dos/inttypes.h @@ -0,0 +1 @@ +#include <stdint.h> diff --git a/dos/stdint.h b/dos/stdint.h new file mode 100644 index 00000000..9a5553b9 --- /dev/null +++ b/dos/stdint.h @@ -0,0 +1,142 @@ +/* + * stdint.h + */ + +#ifndef _STDINT_H +#define _STDINT_H + +/* Exact types */ + +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed int int32_t; +typedef signed long long int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; + +/* Small types */ + +typedef signed char int_least8_t; +typedef signed short int_least16_t; +typedef signed int int_least32_t; +typedef signed long long int_least64_t; + +typedef unsigned char uint_least8_t; +typedef unsigned short uint_least16_t; +typedef unsigned int uint_least32_t; +typedef unsigned long long uint_least64_t; + +/* Fast types */ + +typedef signed char int_fast8_t; +typedef signed short int_fast16_t; +typedef signed int int_fast32_t; +typedef signed long long int_fast64_t; + +typedef unsigned char uint_fast8_t; +typedef unsigned short uint_fast16_t; +typedef unsigned int uint_fast32_t; +typedef unsigned long long uint_fast64_t; + +/* Pointer types */ + +typedef int32_t intptr_t; +typedef uint32_t uintptr_t; + +/* Maximal types */ + +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + +/* + * To be strictly correct... + */ +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) + +# define INT8_MIN (-128) +# define INT16_MIN (-32767-1) +# define INT32_MIN (-2147483647-1) +# define INT64_MIN (-9223372036854775807LL-1) + +# define INT8_MAX (127) +# define INT16_MAX (32767) +# define INT32_MAX (2147483647) +# define INT64_MAX (9223372036854775807LL) + +# define UINT8_MAX (255U) +# define UINT16_MAX (65535U) +# define UINT32_MAX (4294967295U) +# define UINT64_MAX (18446744073709551615ULL) + +# define INT_LEAST8_MIN (-128) +# define INT_LEAST16_MIN (-32767-1) +# define INT_LEAST32_MIN (-2147483647-1) +# define INT_LEAST64_MIN (-9223372036854775807LL-1) + +# define INT_LEAST8_MAX (127) +# define INT_LEAST16_MAX (32767) +# define INT_LEAST32_MAX (2147483647) +# define INT_LEAST64_MAX (9223372036854775807LL) + +# define UINT_LEAST8_MAX (255U) +# define UINT_LEAST16_MAX (65535U) +# define UINT_LEAST32_MAX (4294967295U) +# define UINT_LEAST64_MAX (18446744073709551615ULL) + +# define INT_FAST8_MIN (-128) +# define INT_FAST16_MIN (-32767-1) +# define INT_FAST32_MIN (-2147483647-1) +# define INT_FAST64_MIN (-9223372036854775807LL-1) + +# define INT_FAST8_MAX (127) +# define INT_FAST16_MAX (32767) +# define INT_FAST32_MAX (2147483647) +# define INT_FAST64_MAX (9223372036854775807LL) + +# define UINT_FAST8_MAX (255U) +# define UINT_FAST16_MAX (65535U) +# define UINT_FAST32_MAX (4294967295U) +# define UINT_FAST64_MAX (18446744073709551615ULL) + +# define INTPTR_MIN (-2147483647-1) +# define INTPTR_MAX (2147483647) +# define UINTPTR_MAX (4294967295U) + +# define INTMAX_MIN (-9223372036854775807LL-1) +# define INTMAX_MAX (9223372036854775807LL) +# define UINTMAX_MAX (18446744073709551615ULL) + +/* ptrdiff_t limit */ +# define PTRDIFF_MIN (-2147483647-1) +# define PTRDIFF_MAX (2147483647) + +/* sig_atomic_t limit */ +# define SIG_ATOMIC_MIN (-2147483647-1) +# define SIG_ATOMIC_MAX (2147483647) + +/* size_t limit */ +# define SIZE_MAX (4294967295U) + +#endif /* STDC_LIMIT_MACROS */ + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) + +# define INT8_C(n) n +# define INT16_C(n) n +# define INT32_C(n) n +# define INT64_C(n) n ## LL + +# define UINT8_C(n) n ## U +# define UINT16_C(n) n ## U +# define UINT32_C(n) n ## U +# define UINT64_C(n) n ## ULL + +# define INTMAX_C(n) n ## LL +# define UINTMAX_C(n) n ## ULL + +#endif /* STDC_CONSTANT_MACROS */ + +#endif /* _STDINT_H */ diff --git a/memdisk/Makefile b/memdisk/Makefile index 0525b709..2aa29f4f 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -44,7 +44,7 @@ CSRC = setup.c msetup.c e820func.c conio.c unzip.c SSRC = start32.S memcpy.S memset.S NASMSRC = memdisk.asm memdisk16.asm -all: memdisk e820test +all: memdisk # e820test # tidy, clean removes everything except the final binary tidy: diff --git a/memdump/argv.c b/memdump/argv.c index 9aaa4d38..d83b0f6f 100644 --- a/memdump/argv.c +++ b/memdump/argv.c @@ -32,7 +32,7 @@ * memptr points to available memory. */ -#include <inttypes.h> +#include <stdint.h> #include <stddef.h> #include <stdio.h> diff --git a/memdump/inttypes.h b/memdump/inttypes.h new file mode 100644 index 00000000..9a6118bd --- /dev/null +++ b/memdump/inttypes.h @@ -0,0 +1 @@ +#include <stdint.h> diff --git a/memdump/stdint.h b/memdump/stdint.h new file mode 100644 index 00000000..9a5553b9 --- /dev/null +++ b/memdump/stdint.h @@ -0,0 +1,142 @@ +/* + * stdint.h + */ + +#ifndef _STDINT_H +#define _STDINT_H + +/* Exact types */ + +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed int int32_t; +typedef signed long long int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long uint64_t; + +/* Small types */ + +typedef signed char int_least8_t; +typedef signed short int_least16_t; +typedef signed int int_least32_t; +typedef signed long long int_least64_t; + +typedef unsigned char uint_least8_t; +typedef unsigned short uint_least16_t; +typedef unsigned int uint_least32_t; +typedef unsigned long long uint_least64_t; + +/* Fast types */ + +typedef signed char int_fast8_t; +typedef signed short int_fast16_t; +typedef signed int int_fast32_t; +typedef signed long long int_fast64_t; + +typedef unsigned char uint_fast8_t; +typedef unsigned short uint_fast16_t; +typedef unsigned int uint_fast32_t; +typedef unsigned long long uint_fast64_t; + +/* Pointer types */ + +typedef int32_t intptr_t; +typedef uint32_t uintptr_t; + +/* Maximal types */ + +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + +/* + * To be strictly correct... + */ +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) + +# define INT8_MIN (-128) +# define INT16_MIN (-32767-1) +# define INT32_MIN (-2147483647-1) +# define INT64_MIN (-9223372036854775807LL-1) + +# define INT8_MAX (127) +# define INT16_MAX (32767) +# define INT32_MAX (2147483647) +# define INT64_MAX (9223372036854775807LL) + +# define UINT8_MAX (255U) +# define UINT16_MAX (65535U) +# define UINT32_MAX (4294967295U) +# define UINT64_MAX (18446744073709551615ULL) + +# define INT_LEAST8_MIN (-128) +# define INT_LEAST16_MIN (-32767-1) +# define INT_LEAST32_MIN (-2147483647-1) +# define INT_LEAST64_MIN (-9223372036854775807LL-1) + +# define INT_LEAST8_MAX (127) +# define INT_LEAST16_MAX (32767) +# define INT_LEAST32_MAX (2147483647) +# define INT_LEAST64_MAX (9223372036854775807LL) + +# define UINT_LEAST8_MAX (255U) +# define UINT_LEAST16_MAX (65535U) +# define UINT_LEAST32_MAX (4294967295U) +# define UINT_LEAST64_MAX (18446744073709551615ULL) + +# define INT_FAST8_MIN (-128) +# define INT_FAST16_MIN (-32767-1) +# define INT_FAST32_MIN (-2147483647-1) +# define INT_FAST64_MIN (-9223372036854775807LL-1) + +# define INT_FAST8_MAX (127) +# define INT_FAST16_MAX (32767) +# define INT_FAST32_MAX (2147483647) +# define INT_FAST64_MAX (9223372036854775807LL) + +# define UINT_FAST8_MAX (255U) +# define UINT_FAST16_MAX (65535U) +# define UINT_FAST32_MAX (4294967295U) +# define UINT_FAST64_MAX (18446744073709551615ULL) + +# define INTPTR_MIN (-2147483647-1) +# define INTPTR_MAX (2147483647) +# define UINTPTR_MAX (4294967295U) + +# define INTMAX_MIN (-9223372036854775807LL-1) +# define INTMAX_MAX (9223372036854775807LL) +# define UINTMAX_MAX (18446744073709551615ULL) + +/* ptrdiff_t limit */ +# define PTRDIFF_MIN (-2147483647-1) +# define PTRDIFF_MAX (2147483647) + +/* sig_atomic_t limit */ +# define SIG_ATOMIC_MIN (-2147483647-1) +# define SIG_ATOMIC_MAX (2147483647) + +/* size_t limit */ +# define SIZE_MAX (4294967295U) + +#endif /* STDC_LIMIT_MACROS */ + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) + +# define INT8_C(n) n +# define INT16_C(n) n +# define INT32_C(n) n +# define INT64_C(n) n ## LL + +# define UINT8_C(n) n ## U +# define UINT16_C(n) n ## U +# define UINT32_C(n) n ## U +# define UINT64_C(n) n ## ULL + +# define INTMAX_C(n) n ## LL +# define UINTMAX_C(n) n ## ULL + +#endif /* STDC_CONSTANT_MACROS */ + +#endif /* _STDINT_H */ |