xref: /xnu-11417.140.69/osfmk/mach/machine/machine_types.defs (revision 43a90889846e00bfb5cf1d255cdc0a701a1e05a4)
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#define VM_TYPE_SAFE_UNSAFE(_safe_type, _unsafe_type) ctype: _unsafe_type
49#else /* VM_KERNEL_SERVER */
50#define VM_ADD_CTYPE(type)
51#define VM_TYPE_SAFE_UNSAFE(_safe_type, _unsafe_type) ctype: _safe_type
52#endif /* VM_KERNEL_SERVER */
53
54#define VM_UNSAFE_TYPE(_unsafe_type) VM_ADD_CTYPE(_unsafe_type)
55
56/* from ISO/IEC 988:1999 spec */
57/* 7.18.1.4 Integer types capable of hgolding object pointers */
58/*
59 * The [u]intptr_t types for the native
60 * integer type, e.g. 32 or 64 or.. whatever
61 * register size the machine has.  They are
62 * used for entities that might be either
63 * [unsigned] integers or pointers, and for
64 * type-casting between the two.
65 *
66 * For instance, the IPC system represents
67 * a port in user space as an integer and
68 * in kernel space as a pointer.
69 */
70#if defined(__LP64__)
71type uintptr_t = uint64_t;
72type intptr_t = int64_t;
73#else
74type uintptr_t = uint32_t;
75type intptr_t = int32_t;
76#endif
77
78/*
79 * These are the legacy Mach types that are
80 * the [rough] equivalents of the standards above.
81 * They were defined in terms of int, not
82 * long int, so they remain separate.
83 */
84#if defined(__LP64__)
85type register_t = int64_t;
86#else
87type register_t = int32_t;
88#endif
89type integer_t = int32_t;
90type natural_t = uint32_t;
91
92/*
93 * These are the VM types that scale with the address
94 * space size of a given process.
95 */
96
97#if defined(__LP64__)
98type vm_address_t = uint64_t VM_UNSAFE_TYPE(vm_address_ut);
99type vm_offset_t = uint64_t VM_UNSAFE_TYPE(vm_offset_ut);
100type vm_size_t = uint64_t VM_UNSAFE_TYPE(vm_size_ut);
101#else
102type vm_address_t = natural_t VM_UNSAFE_TYPE(vm_address_ut);
103type vm_offset_t = natural_t VM_UNSAFE_TYPE(vm_offset_ut);
104type vm_size_t = natural_t VM_UNSAFE_TYPE(vm_size_ut);
105#endif
106
107/* 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 */
108type mach_port_context_t = uint64_t;
109
110/*
111 * The mach_vm_xxx_t types are sized to hold the
112 * maximum pointer, offset, etc... supported on the
113 * platform.
114 */
115type mach_vm_address_t = uint64_t VM_UNSAFE_TYPE(mach_vm_address_ut);
116type mach_vm_offset_t = uint64_t VM_UNSAFE_TYPE(mach_vm_offset_ut);
117type mach_vm_size_t = uint64_t VM_UNSAFE_TYPE(mach_vm_size_ut);
118
119/*
120 * These are types used internal to Mach to implement the
121 * legacy 32-bit VM APIs published by the kernel.
122 */
123#define	VM32_SUPPORT	1
124
125type vm32_address_t = uint32_t VM_UNSAFE_TYPE(vm32_address_ut);
126type vm32_offset_t = uint32_t VM_UNSAFE_TYPE(vm32_offset_ut);
127type vm32_size_t = uint32_t VM_UNSAFE_TYPE(vm32_size_ut);
128
129#endif /* _MACH_MACHINE_MACHNINE_TYPES_DEFS */
130
131/* vim: set ft=c : */
132