From 7bbfa39f59dcbc55b21d31abb9e2febef6a51ebb Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Wed, 30 Mar 2016 02:26:28 +0200 Subject: Use uint32_t instead of unsigned32_t. Implement stdint.h and use it in gnumach. Remove old type definitions such as signed* and unsigned*. * Makefile.am: Add -ffreestanding. * i386/i386/xen.h: Use uint64_t. * i386/include/mach/i386/machine_types.defs: Use uint32_t and int32_t. * i386/include/mach/i386/vm_types.h: Remove definitions of int*, uint*, unsigned* and signed* types. * i386/xen/xen.c: Use uint64_t. * include/device/device_types.defs: Use uint32_t. * include/mach/std_types.defs: Use POSIX types. * include/mach/std_types.h: Include stdint.h. * include/stdint.h: New file with POSIX types. * include/sys/types.h: Include stdint.h. * ipc/ipc_kmsg.c: Use uint64_t. * kern/exception.c: Use uint32_t. * linux/dev/include/linux/types.h: Remove POSIX types. * xen/block.c: Use uint64_t. * xen/net.c: Do not use removed unsigned*_t types. * xen/ring.h: Use uint32_t instead. * xen/store.c: Use uint32_t. * xen/store.h: Use uint32_t. * xen/time.c: Use POSIX types only. * xen/time.h: Use uint64_t. --- include/device/device_types.defs | 6 ++--- include/mach/std_types.defs | 8 +++--- include/mach/std_types.h | 1 + include/stdint.h | 55 ++++++++++++++++++++++++++++++++++++++++ include/sys/types.h | 15 +---------- 5 files changed, 64 insertions(+), 21 deletions(-) create mode 100644 include/stdint.h (limited to 'include') diff --git a/include/device/device_types.defs b/include/device/device_types.defs index 49cc2717..e97d89ca 100644 --- a/include/device/device_types.defs +++ b/include/device/device_types.defs @@ -43,9 +43,9 @@ DEVICE_IMPORTS #endif -type recnum_t = unsigned32; -type dev_mode_t = unsigned32; -type dev_flavor_t = unsigned32; +type recnum_t = uint32_t; +type dev_mode_t = uint32_t; +type dev_flavor_t = uint32_t; type dev_name_t = (MACH_MSG_TYPE_STRING_C, 8*128); type dev_status_t = array[*:1024] of int; type io_buf_ptr_t = ^array[] of MACH_MSG_TYPE_INTEGER_8; diff --git a/include/mach/std_types.defs b/include/mach/std_types.defs index a1f156d9..5d95ab42 100644 --- a/include/mach/std_types.defs +++ b/include/mach/std_types.defs @@ -33,12 +33,12 @@ type char = MACH_MSG_TYPE_CHAR; type short = MACH_MSG_TYPE_INTEGER_16; type int = MACH_MSG_TYPE_INTEGER_32; -type int32 = MACH_MSG_TYPE_INTEGER_32; -type int64 = MACH_MSG_TYPE_INTEGER_64; +type int32_t = MACH_MSG_TYPE_INTEGER_32; +type int64_t = MACH_MSG_TYPE_INTEGER_64; type boolean_t = MACH_MSG_TYPE_BOOLEAN; type unsigned = MACH_MSG_TYPE_INTEGER_32; -type unsigned32 = MACH_MSG_TYPE_INTEGER_32; -type unsigned64 = MACH_MSG_TYPE_INTEGER_64; +type uint32_t = MACH_MSG_TYPE_INTEGER_32; +type uint64_t = MACH_MSG_TYPE_INTEGER_64; /* Get the definitions for natural_t and integer_t */ #include diff --git a/include/mach/std_types.h b/include/mach/std_types.h index f78e236a..553bd618 100644 --- a/include/mach/std_types.h +++ b/include/mach/std_types.h @@ -37,6 +37,7 @@ #include #include #include +#include typedef vm_offset_t pointer_t; typedef vm_offset_t vm_address_t; diff --git a/include/stdint.h b/include/stdint.h new file mode 100644 index 00000000..bea277ec --- /dev/null +++ b/include/stdint.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2016 Free Software Foundation, Inc. + * + * This file is part of GNU Mach. + * + * GNU Mach is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any later + * version. + * + * This program 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 General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _STDINT_H_ +#define _STDINT_H_ + +/* + * These types are _exactly_ as wide as indicated in their names. + */ + +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +#if __x86_64__ +typedef long int int64_t; +#else +typedef long long int int64_t; +#endif /* __x86_64__ */ + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#if __x86_64__ +typedef unsigned long int uint64_t; +#else +typedef unsigned long long int uint64_t; +#endif /* __x86_64__ */ + +/* Types for `void *' pointers. */ +#if __x86_64__ +typedef long int intptr_t; +typedef unsigned long int uintptr_t; +#else +typedef int intptr_t; +typedef unsigned int uintptr_t; +#endif /* __x86_64__ */ + +#endif /* _STDINT_H_ */ diff --git a/include/sys/types.h b/include/sys/types.h index 19e7b242..d576cc2a 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -27,6 +27,7 @@ #define _MACH_SA_SYS_TYPES_H_ #include +#include #ifndef _SIZE_T #define _SIZE_T @@ -58,20 +59,6 @@ typedef unsigned int time_t; #define RAND_MAX 0x7fffffff -/* Posix types */ -typedef signed8_t int8_t; -typedef unsigned8_t uint8_t; -typedef unsigned8_t u_int8_t; -typedef signed16_t int16_t; -typedef unsigned16_t uint16_t; -typedef unsigned16_t u_int16_t; -typedef signed32_t int32_t; -typedef unsigned32_t uint32_t; -typedef unsigned32_t u_int32_t; -typedef signed64_t int64_t; -typedef unsigned64_t uint64_t; -typedef unsigned64_t u_int64_t; - /* Symbols not allowed by POSIX */ #ifndef _POSIX_SOURCE -- cgit v1.2.3