diff options
author | H. Peter Anvin <hpa@zytor.com> | 2011-06-27 09:41:10 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2011-06-27 09:41:10 -0700 |
commit | 4d491ba7db579f8429d80d8645336b49b091fecd (patch) | |
tree | c1b7cac1e8e584610ffbcdb9f46849911420fe48 /com32 | |
parent | 855c51a1abaa96559e8c9dffdb922f4dad623e20 (diff) | |
parent | b61f33c5b80f3a957095717775da4908a1e5ada6 (diff) | |
download | syslinux-4d491ba7db579f8429d80d8645336b49b091fecd.tar.gz |
Merge commit 'syslinux-4.05-pre2' into lwip
Diffstat (limited to 'com32')
-rw-r--r-- | com32/include/bitsize/stddef.h | 6 | ||||
-rw-r--r-- | com32/include/bitsize/stdint.h | 30 | ||||
-rw-r--r-- | com32/include/bitsize/stdintconst.h | 2 | ||||
-rw-r--r-- | com32/include/bitsize/stdintlimits.h | 2 | ||||
-rw-r--r-- | com32/include/dprintf.h | 20 | ||||
-rw-r--r-- | com32/include/stdint.h | 184 | ||||
-rw-r--r-- | com32/lib/dprintf.c | 2 | ||||
-rw-r--r-- | com32/lib/syslinux/shuffle.c | 18 | ||||
-rw-r--r-- | com32/lib/vdprintf.c | 4 | ||||
-rw-r--r-- | com32/libupload/cpio.c | 2 | ||||
-rw-r--r-- | com32/modules/chain.c | 9 |
11 files changed, 127 insertions, 152 deletions
diff --git a/com32/include/bitsize/stddef.h b/com32/include/bitsize/stddef.h index caa5e726..213e8ab7 100644 --- a/com32/include/bitsize/stddef.h +++ b/com32/include/bitsize/stddef.h @@ -6,13 +6,9 @@ #define _BITSIZE_STDDEF_H #define _SIZE_T -#if defined(__s390__) || defined(__hppa__) || defined(__cris__) -typedef unsigned long size_t; -#else typedef unsigned int size_t; -#endif #define _PTRDIFF_T -typedef signed int ptrdiff_t; +typedef signed long ptrdiff_t; #endif /* _BITSIZE_STDDEF_H */ diff --git a/com32/include/bitsize/stdint.h b/com32/include/bitsize/stdint.h index 8cbfc5dd..8e444b6d 100644 --- a/com32/include/bitsize/stdint.h +++ b/com32/include/bitsize/stdint.h @@ -5,24 +5,24 @@ #ifndef _BITSIZE_STDINT_H #define _BITSIZE_STDINT_H -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long long int int64_t; +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int int64_t; -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; -typedef int int_fast16_t; -typedef int int_fast32_t; +typedef int int_fast16_t; +typedef int int_fast32_t; -typedef unsigned int uint_fast16_t; -typedef unsigned int uint_fast32_t; +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; -typedef int intptr_t; -typedef unsigned int uintptr_t; +typedef int intptr_t; +typedef unsigned int uintptr_t; #define __INT64_C(c) c ## LL #define __UINT64_C(c) c ## ULL @@ -31,4 +31,4 @@ typedef unsigned int uintptr_t; #define __PRIFAST_RANK "" #define __PRIPTR_RANK "" -#endif /* _BITSIZE_STDINT_H */ +#endif /* _BITSIZE_STDINT_H */ diff --git a/com32/include/bitsize/stdintconst.h b/com32/include/bitsize/stdintconst.h index 8157dd06..7db63bdf 100644 --- a/com32/include/bitsize/stdintconst.h +++ b/com32/include/bitsize/stdintconst.h @@ -15,4 +15,4 @@ #define UINTPTR_C(c) UINT32_C(c) #define PTRDIFF_C(c) INT32_C(c) -#endif /* _BITSIZE_STDINTCONST_H */ +#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/com32/include/bitsize/stdintlimits.h b/com32/include/bitsize/stdintlimits.h index b44fe011..d85094d9 100644 --- a/com32/include/bitsize/stdintlimits.h +++ b/com32/include/bitsize/stdintlimits.h @@ -19,4 +19,4 @@ #define PTRDIFF_MIN INT32_MIN #define PTRDIFF_MAX INT32_MAX -#endif /* _BITSIZE_STDINTLIMITS_H */ +#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/com32/include/dprintf.h b/com32/include/dprintf.h index 30a21ada..b8a3b84c 100644 --- a/com32/include/dprintf.h +++ b/com32/include/dprintf.h @@ -7,16 +7,30 @@ #ifdef DEBUG -#include <stdio.h> +# include <stdio.h> +# ifdef DEBUG_STDIO +# define dprintf printf +# define vdprintf vprintf +# else void dprintf(const char *, ...); void vdprintf(const char *, va_list); +# endif #else -#define dprintf(fmt, ...) ((void)(0)) -#define vdprintf(fmt, ap) ((void)(0)) +# define dprintf(fmt, ...) ((void)(0)) +# define vdprintf(fmt, ap) ((void)(0)) #endif /* DEBUG */ +# if DEBUG >= 2 +/* Really verbose debugging... */ +# define dprintf2 dprintf +# define vdprintf2 vdprintf +# else +# define dprintf2(fmt, ...) ((void)(0)) +# define vdprintf2(fmt, ap) ((void)(0)) +# endif + #endif /* _DPRINTF_H */ diff --git a/com32/include/stdint.h b/com32/include/stdint.h index a8391bf9..f64f0278 100644 --- a/com32/include/stdint.h +++ b/com32/include/stdint.h @@ -5,138 +5,112 @@ #ifndef _STDINT_H #define _STDINT_H -/* Exact types */ +#include <bitsize/stdint.h> -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed int int32_t; -typedef signed long long int64_t; +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; -/* Small types */ +typedef int8_t int_fast8_t; +typedef int64_t int_fast64_t; -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 uint8_t uint_fast8_t; +typedef uint64_t uint_fast64_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; +typedef int64_t intmax_t; +typedef uint64_t uintmax_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; +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) -/* Maximal types */ +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647-1) +#define INT64_MIN (__INT64_C(-9223372036854775807)-1) -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (__INT64_C(9223372036854775807)) -/* - * To be strictly correct... - */ -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#define UINT32_MAX (4294967295U) +#define UINT64_MAX (__UINT64_C(18446744073709551615)) -# define INT8_MIN (-128) -# define INT16_MIN (-32767-1) -# define INT32_MIN (-2147483647-1) -# define INT64_MIN (-9223372036854775807LL-1) +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN -# define INT8_MAX (127) -# define INT16_MAX (32767) -# define INT32_MAX (2147483647) -# define INT64_MAX (9223372036854775807LL) +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX -# define UINT8_MAX (255U) -# define UINT16_MAX (65535U) -# define UINT32_MAX (4294967295U) -# define UINT64_MAX (18446744073709551615ULL) +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX -# 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_FAST8_MIN INT8_MIN +#define INT_FAST64_MIN INT64_MIN -# define INT_LEAST8_MAX (127) -# define INT_LEAST16_MAX (32767) -# define INT_LEAST32_MAX (2147483647) -# define INT_LEAST64_MAX (9223372036854775807LL) +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST64_MAX INT64_MAX -# define UINT_LEAST8_MAX (255U) -# define UINT_LEAST16_MAX (65535U) -# define UINT_LEAST32_MAX (4294967295U) -# define UINT_LEAST64_MAX (18446744073709551615ULL) +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST64_MAX UINT64_MAX -# define INT_FAST8_MIN (-128) -# define INT_FAST16_MIN (-32767-1) -# define INT_FAST32_MIN (-2147483647-1) -# define INT_FAST64_MIN (-9223372036854775807LL-1) +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX -# define INT_FAST8_MAX (127) -# define INT_FAST16_MAX (32767) -# define INT_FAST32_MAX (2147483647) -# define INT_FAST64_MAX (9223372036854775807LL) +#include <bitsize/stdintlimits.h> -# define UINT_FAST8_MAX (255U) -# define UINT_FAST16_MAX (65535U) -# define UINT_FAST32_MAX (4294967295U) -# define UINT_FAST64_MAX (18446744073709551615ULL) +#endif -# define INTPTR_MIN (-2147483647-1) -# define INTPTR_MAX (2147483647) -# define UINTPTR_MAX (4294967295U) +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) -# define INTMAX_MIN (-9223372036854775807LL-1) -# define INTMAX_MAX (9223372036854775807LL) -# define UINTMAX_MAX (18446744073709551615ULL) +#define INT8_C(c) c +#define INT16_C(c) c +#define INT32_C(c) c +#define INT64_C(c) __INT64_C(c) -/* ptrdiff_t limit */ -# define PTRDIFF_MIN (-2147483647-1) -# define PTRDIFF_MAX (2147483647) +#define UINT8_C(c) c ## U +#define UINT16_C(c) c ## U +#define UINT32_C(c) c ## U +#define UINT64_C(c) __UINT64_C(c) -/* sig_atomic_t limit */ -# define SIG_ATOMIC_MIN (-2147483647-1) -# define SIG_ATOMIC_MAX (2147483647) +#define INT_LEAST8_C(c) INT8_C(c) +#define INT_LEAST16_C(c) INT16_C(c) +#define INT_LEAST32_C(c) INT32_C(c) +#define INT_LEAST64_C(c) INT64_C(c) -/* size_t limit */ -# define SIZE_MAX (4294967295U) +#define UINT_LEAST8_C(c) UINT8_C(c) +#define UINT_LEAST16_C(c) UINT16_C(c) +#define UINT_LEAST32_C(c) UINT32_C(c) +#define UINT_LEAST64_C(c) UINT64_C(c) -#endif /* STDC_LIMIT_MACROS */ +#define INT_FAST8_C(c) INT8_C(c) +#define INT_FAST64_C(c) INT64_C(c) -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) +#define UINT_FAST8_C(c) UINT8_C(c) +#define UINT_FAST64_C(c) UINT64_C(c) -# define INT8_C(n) n -# define INT16_C(n) n -# define INT32_C(n) n -# define INT64_C(n) n ## LL +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) -# define UINT8_C(n) n ## U -# define UINT16_C(n) n ## U -# define UINT32_C(n) n ## U -# define UINT64_C(n) n ## ULL +#include <bitsize/stdintconst.h> -# define INTMAX_C(n) n ## LL -# define UINTMAX_C(n) n ## ULL +#endif -#endif /* STDC_CONSTANT_MACROS */ +/* Keep the kernel from trying to define these types... */ +#define __BIT_TYPES_DEFINED__ -#endif /* _STDINT_H */ +#endif /* _STDINT_H */ diff --git a/com32/lib/dprintf.c b/com32/lib/dprintf.c index 900c0a47..aad11746 100644 --- a/com32/lib/dprintf.c +++ b/com32/lib/dprintf.c @@ -9,6 +9,7 @@ #define DEBUG 1 #include <dprintf.h> +#ifndef dprintf void dprintf(const char *format, ...) { va_list ap; @@ -17,3 +18,4 @@ void dprintf(const char *format, ...) vdprintf(format, ap); va_end(ap); } +#endif diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c index 54a7e651..e9ee6aad 100644 --- a/com32/lib/syslinux/shuffle.c +++ b/com32/lib/syslinux/shuffle.c @@ -39,26 +39,10 @@ #include <inttypes.h> #include <com32.h> #include <minmax.h> +#include <dprintf.h> #include <syslinux/movebits.h> #include <klibc/compiler.h> -#ifndef DEBUG -# define DEBUG 0 -#endif - -#define dprintf(f, ...) ((void)0) -#define dprintf2(f, ...) ((void)0) - -#if DEBUG -# include <stdio.h> -# undef dprintf -# define dprintf printf -# if DEBUG > 1 -# undef dprintf2 -# define dprintf2 printf -# endif -#endif - struct shuffle_descriptor { uint32_t dst, src, len; }; diff --git a/com32/lib/vdprintf.c b/com32/lib/vdprintf.c index d74f2782..c1f90a63 100644 --- a/com32/lib/vdprintf.c +++ b/com32/lib/vdprintf.c @@ -14,6 +14,8 @@ #define DEBUG 1 #include <dprintf.h> +#ifndef vdprintf + #define BUFFER_SIZE 4096 enum serial_port_regs { @@ -114,3 +116,5 @@ void vdprintf(const char *format, va_list ap) while (rv--) debug_putc(*p++); } + +#endif /* vdprintf */ diff --git a/com32/libupload/cpio.c b/com32/libupload/cpio.c index b3e1eb78..25b464d4 100644 --- a/com32/libupload/cpio.c +++ b/com32/libupload/cpio.c @@ -31,7 +31,7 @@ int cpio_hdr(struct upload_backend *be, uint32_t mode, size_t datalen, cpio_pad(be); - sprintf(hdr, "%06o%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x%08x", + sprintf(hdr, "%06o%08x%08x%08x%08x%08x%08x%08zx%08x%08x%08x%08x%08x%08x", 070701, /* c_magic */ inode++, /* c_ino */ mode, /* c_mode */ diff --git a/com32/modules/chain.c b/com32/modules/chain.c index ced105ae..2ed0f14c 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -569,7 +569,8 @@ static struct disk_part_iter *next_ebr_part(struct disk_part_iter *part) } /* Success */ part->lba_data = ebr_table[0].start_lba + ebr_lba; - dprintf("Partition %d logical lba %u\n", part->index, part->lba_data); + dprintf("Partition %d logical lba %"PRIu64"\n", + part->index, part->lba_data); part->index++; part->record = ebr_table; return part; @@ -630,8 +631,8 @@ static struct disk_part_iter *next_mbr_part(struct disk_part_iter *part) /* Update parameters to reflect this new partition. Re-use iterator */ part->lba_data = table[part->private.mbr_index].start_lba; - dprintf("Partition %d primary lba %u\n", part->private.mbr_index, - part->lba_data); + dprintf("Partition %d primary lba %"PRIu64"\n", + part->private.mbr_index, part->lba_data); part->index = part->private.mbr_index + 1; part->record = table + part->private.mbr_index; return part; @@ -1783,7 +1784,7 @@ int main(int argc, char *argv[]) * fs_lba should be verified against the disk as some DRMK * variants will check and fail if it does not match */ - dprintf(" fs_lba offset is %d\n", fs_lba); + dprintf(" fs_lba offset is %"PRIu64"\n", fs_lba); /* DRMK only uses a DWORD */ if (fs_lba > 0xffffffff) { error |