From c566ad85a2d6728ebc8ec0f461a3b35df300e96e Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 28 Aug 2022 00:10:45 +0200 Subject: Fix inclusability of Now that mach/machine/vm_types.h uses stdint types, we have to ship a header that defines them. --- i386/Makefrag.am | 1 + i386/include/mach/i386/stdint.h | 55 +++++++++++++++++++++++++++++++++++++++ i386/include/mach/i386/vm_types.h | 16 ++++++------ include/stdint.h | 39 ++++++++++----------------- x86_64/Makefrag.am | 1 + 5 files changed, 79 insertions(+), 33 deletions(-) create mode 100644 i386/include/mach/i386/stdint.h diff --git a/i386/Makefrag.am b/i386/Makefrag.am index c1043c4f..8d6ef8cd 100644 --- a/i386/Makefrag.am +++ b/i386/Makefrag.am @@ -257,6 +257,7 @@ include_mach_i386_HEADERS = \ i386/include/mach/i386/machine_types.defs \ i386/include/mach/i386/multiboot.h \ i386/include/mach/i386/syscall_sw.h \ + i386/include/mach/i386/stdint.h \ i386/include/mach/i386/thread_status.h \ i386/include/mach/i386/trap.h \ i386/include/mach/i386/vm_param.h \ diff --git a/i386/include/mach/i386/stdint.h b/i386/include/mach/i386/stdint.h new file mode 100644 index 00000000..5336400d --- /dev/null +++ b/i386/include/mach/i386/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 _MACH_MACHINE_STDINT_H_ +#define _MACH_MACHINE_STDINT_H_ + +/* + * These types are _exactly_ as wide as indicated in their names. + */ + +typedef char __mach_int8_t; +typedef short __mach_int16_t; +typedef int __mach_int32_t; +#if __x86_64__ +typedef long int __mach_int64_t; +#else +typedef long long int __mach_int64_t; +#endif /* __x86_64__ */ + +typedef unsigned char __mach_uint8_t; +typedef unsigned short __mach_uint16_t; +typedef unsigned int __mach_uint32_t; +#if __x86_64__ +typedef unsigned long int __mach_uint64_t; +#else +typedef unsigned long long int __mach_uint64_t; +#endif /* __x86_64__ */ + +/* Types for `void *' pointers. */ +#if __x86_64__ +typedef long int __mach_intptr_t; +typedef unsigned long int __mach_uintptr_t; +#else +typedef int __mach_intptr_t; +typedef unsigned int __mach_uintptr_t; +#endif /* __x86_64__ */ + +#endif /* _MACH_MACHINE_STDINT_H_ */ diff --git a/i386/include/mach/i386/vm_types.h b/i386/include/mach/i386/vm_types.h index 16aedc44..7a43d75d 100644 --- a/i386/include/mach/i386/vm_types.h +++ b/i386/include/mach/i386/vm_types.h @@ -37,7 +37,7 @@ #ifdef __ASSEMBLER__ #else /* __ASSEMBLER__ */ -#include +#include #ifdef MACH_KERNEL #include @@ -104,17 +104,17 @@ typedef vm_size_t * vm_size_array_t; * functions. */ #if defined(MACH_KERNEL) && defined(USER32) -typedef uint32_t rpc_vm_address_t; -typedef uint32_t rpc_vm_offset_t; -typedef uint32_t rpc_vm_size_t; -static inline uint64_t convert_vm_from_user(uint32_t uaddr) +typedef __mach_uint32_t rpc_vm_address_t; +typedef __mach_uint32_t rpc_vm_offset_t; +typedef __mach_uint32_t rpc_vm_size_t; +static inline __mach_uint64_t convert_vm_from_user(__mach_uint32_t uaddr) { - return (uint64_t)uaddr; + return (__mach_uint64_t)uaddr; } -static inline uint32_t convert_vm_to_user(uint64_t kaddr) +static inline __mach_uint32_t convert_vm_to_user(__mach_uint64_t kaddr) { assert(kaddr <= 0xFFFFFFFF); - return (uint32_t)kaddr; + return (__mach_uint32_t)kaddr; } #else /* MACH_KERNEL */ typedef vm_offset_t rpc_vm_address_t; diff --git a/include/stdint.h b/include/stdint.h index bea277ec..55c7ab22 100644 --- a/include/stdint.h +++ b/include/stdint.h @@ -7,12 +7,12 @@ * 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. @@ -25,31 +25,20 @@ * 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__ */ +#include + +typedef __mach_int8_t int8_t; +typedef __mach_int16_t int16_t; +typedef __mach_int32_t int32_t; +typedef __mach_int64_t int64_t; -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__ */ +typedef __mach_uint8_t uint8_t; +typedef __mach_uint16_t uint16_t; +typedef __mach_uint32_t uint32_t; +typedef __mach_uint64_t uint64_t; /* 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__ */ +typedef __mach_intptr_t intptr_t; +typedef __mach_uintptr_t uintptr_t; #endif /* _STDINT_H_ */ diff --git a/x86_64/Makefrag.am b/x86_64/Makefrag.am index edf533fd..9548e387 100644 --- a/x86_64/Makefrag.am +++ b/x86_64/Makefrag.am @@ -242,6 +242,7 @@ include_mach_x86_64_HEADERS = \ i386/include/mach/i386/machine_types.defs \ i386/include/mach/i386/multiboot.h \ i386/include/mach/i386/syscall_sw.h \ + i386/include/mach/i386/stdint.h \ i386/include/mach/i386/thread_status.h \ i386/include/mach/i386/trap.h \ i386/include/mach/i386/vm_param.h \ -- cgit v1.2.3