| 1 | /* |
| 2 | * Copyright (c) 2007 Apple 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 | * FILE_ID: vm_param.h |
| 30 | */ |
| 31 | |
| 32 | /* |
| 33 | *	ARM machine dependent virtual memory parameters. |
| 34 | */ |
| 35 | |
| 36 | #ifndef _MACH_ARM_VM_PARAM_H_ |
| 37 | #define _MACH_ARM_VM_PARAM_H_ |
| 38 | |
| 39 | #if defined (__arm__) || defined (__arm64__) |
| 40 | |
| 41 | |
| 42 | |
| 43 | #if !defined (KERNEL) && !defined (__ASSEMBLER__) |
| 44 | #include <mach/vm_page_size.h> |
| 45 | #endif |
| 46 | |
| 47 | #define BYTE_SIZE 8 /* byte size in bits */ |
| 48 | |
| 49 | |
| 50 | #define PAGE_SHIFT vm_page_shift |
| 51 | #define PAGE_SIZE vm_page_size |
| 52 | #define PAGE_MASK vm_page_mask |
| 53 | |
| 54 | #define VM_PAGE_SIZE vm_page_size |
| 55 | |
| 56 | #define machine_ptob(x) ((x) << PAGE_SHIFT) |
| 57 | |
| 58 | |
| 59 | #define PAGE_MAX_SHIFT 14 |
| 60 | #define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT) |
| 61 | #define PAGE_MAX_MASK (PAGE_MAX_SIZE-1) |
| 62 | |
| 63 | #define PAGE_MIN_SHIFT 12 |
| 64 | #define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT) |
| 65 | #define PAGE_MIN_MASK (PAGE_MIN_SIZE-1) |
| 66 | |
| 67 | #define VM_MAX_PAGE_ADDRESS MACH_VM_MAX_ADDRESS |
| 68 | |
| 69 | #ifndef __ASSEMBLER__ |
| 70 | |
| 71 | |
| 72 | #if defined (__arm__) |
| 73 | |
| 74 | #define VM_MIN_ADDRESS ((vm_address_t) 0x00000000) |
| 75 | #define VM_MAX_ADDRESS ((vm_address_t) 0x80000000) |
| 76 | |
| 77 | /* system-wide values */ |
| 78 | #define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0) |
| 79 | #define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS) |
| 80 | |
| 81 | #elif defined (__arm64__) |
| 82 | |
| 83 | #define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL) |
| 84 | #define VM_MAX_ADDRESS ((vm_address_t) 0x00000000F0000000ULL) |
| 85 | |
| 86 | /* system-wide values */ |
| 87 | #define MACH_VM_MIN_ADDRESS_RAW 0x0ULL |
| 88 | #define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL |
| 89 | |
| 90 | /* |
| 91 | * `MACH_VM_MAX_ADDRESS` is exported to user space, but we don't want this |
| 92 | * larger value for `MACH_VM_MAX_ADDRESS` to be exposed outside the kernel. |
| 93 | */ |
| 94 | |
| 95 | #define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW) |
| 96 | #define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW) |
| 97 | |
| 98 | #define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW 0x0000001000000000ULL |
| 99 | #define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW 0x0000007000000000ULL |
| 100 | #define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW) |
| 101 | #define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW) |
| 102 | |
| 103 | #else /* defined(__arm64__) */ |
| 104 | #error architecture not supported |
| 105 | #endif |
| 106 | |
| 107 | #define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS |
| 108 | #define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS |
| 109 | |
| 110 | |
| 111 | #endif /* !__ASSEMBLER__ */ |
| 112 | |
| 113 | #define SWI_SYSCALL 0x80 |
| 114 | |
| 115 | #endif /* defined (__arm__) || defined (__arm64__) */ |
| 116 | |
| 117 | #endif /* _MACH_ARM_VM_PARAM_H_ */ |