1/* 2 * Copyright (c) 2000-2007 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28/* 29 * @OSF_COPYRIGHT@ 30 */ 31 32/* 33 * Header file for basic, machine-dependent data types. arm+i386 version. 34 */ 35 36#ifndef _MACH_MACHINE_MACHNINE_TYPES_DEFS 37#define _MACH_MACHINE_MACHNINE_TYPES_DEFS 38 39type short = int16_t; 40type int = int32_t; 41type unsigned = uint32_t; 42 43type float = MACH_MSG_TYPE_REAL_32; 44type double = MACH_MSG_TYPE_REAL_64; 45 46#if VM_KERNEL_SERVER 47#define VM_ADD_CTYPE(type) ctype: type 48#else /* VM_KERNEL_SERVER */ 49#define VM_ADD_CTYPE(type) 50#endif /* VM_KERNEL_SERVER */ 51 52#define VM_GENERATE_MIG_TMPTYPE_U64(_original_type, _unsafe_type) \ 53 type _unsafe_type = uint64_t; \ 54 type _original_type ## _tmp = uint64_t VM_ADD_CTYPE(_unsafe_type); 55 56#define VM_GENERATE_MIG_TMPTYPE_U32(_original_type, _unsafe_type) \ 57 type _unsafe_type = uint32_t; \ 58 type _original_type ## _tmp = uint32_t VM_ADD_CTYPE(_unsafe_type); 59 60#define VM_GENERATE_MIG_TMPTYPE_I32(_original_type, _unsafe_type) \ 61 type _unsafe_type = int32_t; \ 62 type _original_type ## _tmp = int32_t VM_ADD_CTYPE(_unsafe_type); 63 64 65#if VM_KERNEL_SERVER 66#define VM_USE_TMPTYPE(_original_type) _original_type ## _tmp 67#else /* VM_KERNEL_SERVER */ 68#define VM_USE_TMPTYPE(_original_type) _original_type 69#endif /* VM_KERNEL_SERVER */ 70 71/* from ISO/IEC 988:1999 spec */ 72/* 7.18.1.4 Integer types capable of hgolding object pointers */ 73/* 74 * The [u]intptr_t types for the native 75 * integer type, e.g. 32 or 64 or.. whatever 76 * register size the machine has. They are 77 * used for entities that might be either 78 * [unsigned] integers or pointers, and for 79 * type-casting between the two. 80 * 81 * For instance, the IPC system represents 82 * a port in user space as an integer and 83 * in kernel space as a pointer. 84 */ 85#if defined(__LP64__) 86type uintptr_t = uint64_t; 87type intptr_t = int64_t; 88#else 89type uintptr_t = uint32_t; 90type intptr_t = int32_t; 91#endif 92 93/* 94 * These are the legacy Mach types that are 95 * the [rough] equivalents of the standards above. 96 * They were defined in terms of int, not 97 * long int, so they remain separate. 98 */ 99#if defined(__LP64__) 100type register_t = int64_t; 101#else 102type register_t = int32_t; 103#endif 104type integer_t = int32_t; 105type natural_t = uint32_t; 106 107/* 108 * These are the VM types that scale with the address 109 * space size of a given process. 110 */ 111 112#if defined(__LP64__) 113type vm_address_t = uint64_t; 114type vm_offset_t = uint64_t; 115type vm_size_t = uint64_t; 116#else 117type vm_address_t = natural_t; 118type vm_offset_t = natural_t; 119type vm_size_t = natural_t; 120#endif 121 122/* This is a bit of a hack for arm. We implement the backend with a wide type, but present a native-sized type to callers */ 123type mach_port_context_t = uint64_t; 124 125/* 126 * The mach_vm_xxx_t types are sized to hold the 127 * maximum pointer, offset, etc... supported on the 128 * platform. 129 */ 130type mach_vm_address_t = uint64_t; 131type mach_vm_offset_t = uint64_t; 132type mach_vm_size_t = uint64_t; 133 134/* 135 * Temporary VM types to allow parallelizing semantic type adoption 136 */ 137VM_GENERATE_MIG_TMPTYPE_U64(mach_vm_address_t, mach_vm_address_ut); 138VM_GENERATE_MIG_TMPTYPE_U64(mach_vm_offset_t, mach_vm_offset_ut); 139VM_GENERATE_MIG_TMPTYPE_U64(mach_vm_size_t, mach_vm_size_ut); 140 141VM_GENERATE_MIG_TMPTYPE_U64(vm_address_t, vm_address_ut); 142VM_GENERATE_MIG_TMPTYPE_U64(vm_offset_t, vm_offset_ut); 143VM_GENERATE_MIG_TMPTYPE_U64(vm_size_t, vm_size_ut); 144 145VM_GENERATE_MIG_TMPTYPE_U64(memory_object_offset_t, memory_object_offset_ut); 146VM_GENERATE_MIG_TMPTYPE_U64(memory_object_size_t, memory_object_size_ut); 147 148VM_GENERATE_MIG_TMPTYPE_U32(vm32_address_t, vm32_address_ut); 149VM_GENERATE_MIG_TMPTYPE_U32(vm32_offset_t, vm32_offset_ut); 150VM_GENERATE_MIG_TMPTYPE_U32(vm32_size_t, vm32_size_ut); 151 152VM_GENERATE_MIG_TMPTYPE_I32(vm_prot_t, vm_prot_ut); 153VM_GENERATE_MIG_TMPTYPE_I32(vm_inherit_t, vm_inherit_ut); 154 155/* 156 * These are types used internal to Mach to implement the 157 * legacy 32-bit VM APIs published by the kernel. 158 */ 159#define VM32_SUPPORT 1 160 161type vm32_address_t = uint32_t; 162type vm32_offset_t = uint32_t; 163type vm32_size_t = uint32_t; 164 165#endif /* _MACH_MACHINE_MACHNINE_TYPES_DEFS */ 166 167/* vim: set ft=c : */ 168