[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 2/2] hvmloader: do not include system headers for type declarations
Instead create a private types.h header that contains the set of types that are required by hvmloader. Replace include occurrences of std* headers with type.h. Note that including types.h directly is not required in util.c because it already includes util.h which in turn includes the newly created types.h. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- tools/firmware/hvmloader/32bitbios_support.c | 2 +- tools/firmware/hvmloader/config.h | 3 +- tools/firmware/hvmloader/hypercall.h | 2 +- tools/firmware/hvmloader/mp_tables.c | 2 +- tools/firmware/hvmloader/option_rom.h | 2 +- tools/firmware/hvmloader/pir_types.h | 2 +- tools/firmware/hvmloader/smbios.c | 2 +- tools/firmware/hvmloader/smbios_types.h | 2 +- tools/firmware/hvmloader/types.h | 47 ++++++++++++++++++++ tools/firmware/hvmloader/util.c | 1 - tools/firmware/hvmloader/util.h | 5 +-- 11 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 tools/firmware/hvmloader/types.h diff --git a/tools/firmware/hvmloader/32bitbios_support.c b/tools/firmware/hvmloader/32bitbios_support.c index e726946a7b..32b5c4c4ad 100644 --- a/tools/firmware/hvmloader/32bitbios_support.c +++ b/tools/firmware/hvmloader/32bitbios_support.c @@ -20,7 +20,7 @@ * this program; If not, see <http://www.gnu.org/licenses/>. */ -#include <inttypes.h> +#include "types.h" #include <xen/libelf/elfstructs.h> #ifdef __sun__ #include <sys/machelf.h> diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h index 844120bc87..510d5b5c79 100644 --- a/tools/firmware/hvmloader/config.h +++ b/tools/firmware/hvmloader/config.h @@ -1,8 +1,7 @@ #ifndef __HVMLOADER_CONFIG_H__ #define __HVMLOADER_CONFIG_H__ -#include <stdint.h> -#include <stdbool.h> +#include "types.h" enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt }; extern enum virtual_vga virtual_vga; diff --git a/tools/firmware/hvmloader/hypercall.h b/tools/firmware/hvmloader/hypercall.h index 5368c30720..788f699565 100644 --- a/tools/firmware/hvmloader/hypercall.h +++ b/tools/firmware/hvmloader/hypercall.h @@ -31,7 +31,7 @@ #ifndef __HVMLOADER_HYPERCALL_H__ #define __HVMLOADER_HYPERCALL_H__ -#include <stdint.h> +#include "types.h" #include <xen/xen.h> #include "config.h" diff --git a/tools/firmware/hvmloader/mp_tables.c b/tools/firmware/hvmloader/mp_tables.c index d207ecbf00..76790a9a1e 100644 --- a/tools/firmware/hvmloader/mp_tables.c +++ b/tools/firmware/hvmloader/mp_tables.c @@ -27,7 +27,7 @@ * this program; If not, see <http://www.gnu.org/licenses/>. */ -#include <stdint.h> +#include "types.h" #include "config.h" /* number of non-processor MP table entries */ diff --git a/tools/firmware/hvmloader/option_rom.h b/tools/firmware/hvmloader/option_rom.h index 0fefe0812a..7988aa29ec 100644 --- a/tools/firmware/hvmloader/option_rom.h +++ b/tools/firmware/hvmloader/option_rom.h @@ -1,7 +1,7 @@ #ifndef __HVMLOADER_OPTION_ROM_H__ #define __HVMLOADER_OPTION_ROM_H__ -#include <stdint.h> +#include "types.h" struct option_rom_header { uint8_t signature[2]; /* "\x55\xaa" */ diff --git a/tools/firmware/hvmloader/pir_types.h b/tools/firmware/hvmloader/pir_types.h index 9f9259c2e1..9efcdcf94b 100644 --- a/tools/firmware/hvmloader/pir_types.h +++ b/tools/firmware/hvmloader/pir_types.h @@ -23,7 +23,7 @@ #ifndef PIR_TYPES_H #define PIR_TYPES_H -#include <stdint.h> +#include "types.h" #define NR_PIR_SLOTS 6 diff --git a/tools/firmware/hvmloader/smbios.c b/tools/firmware/hvmloader/smbios.c index 97a054e9e3..5821c85c30 100644 --- a/tools/firmware/hvmloader/smbios.c +++ b/tools/firmware/hvmloader/smbios.c @@ -19,7 +19,7 @@ * Authors: Andrew D. Ball <aball@xxxxxxxxxx> */ -#include <stdint.h> +#include "types.h" #include <xen/xen.h> #include <xen/version.h> #include "smbios_types.h" diff --git a/tools/firmware/hvmloader/smbios_types.h b/tools/firmware/hvmloader/smbios_types.h index 7c648ece71..439c3fb247 100644 --- a/tools/firmware/hvmloader/smbios_types.h +++ b/tools/firmware/hvmloader/smbios_types.h @@ -25,7 +25,7 @@ #ifndef SMBIOS_TYPES_H #define SMBIOS_TYPES_H -#include <stdint.h> +#include "types.h" /* SMBIOS entry point -- must be written to a 16-bit aligned address between 0xf0000 and 0xfffff. diff --git a/tools/firmware/hvmloader/types.h b/tools/firmware/hvmloader/types.h new file mode 100644 index 0000000000..3d765f2c60 --- /dev/null +++ b/tools/firmware/hvmloader/types.h @@ -0,0 +1,47 @@ +#ifndef _HVMLOADER_TYPES_H_ +#define _HVMLOADER_TYPES_H_ + +typedef unsigned char uint8_t; +typedef signed char int8_t; + +typedef unsigned short uint16_t; +typedef signed short int16_t; + +typedef unsigned int uint32_t; +typedef signed int int32_t; + +typedef unsigned long long uint64_t; +typedef signed long long int64_t; + +#define INT8_MIN (-0x7f-1) +#define INT16_MIN (-0x7fff-1) +#define INT32_MIN (-0x7fffffff-1) +#define INT64_MIN (-0x7fffffffffffffffll-1) + +#define INT8_MAX 0x7f +#define INT16_MAX 0x7fff +#define INT32_MAX 0x7fffffff +#define INT64_MAX 0x7fffffffffffffffll + +#define UINT8_MAX 0xff +#define UINT16_MAX 0xffff +#define UINT32_MAX 0xffffffffu +#define UINT64_MAX 0xffffffffffffffffull + +typedef uint32_t size_t; +typedef uint32_t uintptr_t; + +#define UINTPTR_MAX UINT32_MAX + +#define bool _Bool +#define true 1 +#define false 0 +#define __bool_true_false_are_defined 1 + +typedef __builtin_va_list va_list; +#define va_copy(dest, src) __builtin_va_copy((dest), (src)) +#define va_start(ap, last) __builtin_va_start((ap), (last)) +#define va_end(ap) __builtin_va_end(ap) +#define va_arg __builtin_va_arg + +#endif diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c index 7da144b0bb..2df84482ab 100644 --- a/tools/firmware/hvmloader/util.c +++ b/tools/firmware/hvmloader/util.c @@ -24,7 +24,6 @@ #include "vnuma.h" #include <acpi2_0.h> #include <libacpi.h> -#include <stdint.h> #include <xen/xen.h> #include <xen/memory.h> #include <xen/sched.h> diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h index 4f0baade0e..285a1d23c4 100644 --- a/tools/firmware/hvmloader/util.h +++ b/tools/firmware/hvmloader/util.h @@ -1,10 +1,7 @@ #ifndef __HVMLOADER_UTIL_H__ #define __HVMLOADER_UTIL_H__ -#include <stdarg.h> -#include <stdint.h> -#include <stddef.h> -#include <stdbool.h> +#include "types.h" #include <xen/xen.h> #include <xen/hvm/hvm_info_table.h> #include "e820.h" -- 2.30.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |