]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/mach/shared_region.h
xnu-6153.121.1.tar.gz
[apple/xnu.git] / osfmk / mach / shared_region.h
index ab5a722e11c52591ec2cd39edfd33e07252a6c8c..f6efdcbc169100fbc1e05e0a31b0677a1576a112 100644 (file)
@@ -2,14 +2,14 @@
  * Copyright (c) 2007 Apple Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
- * 
+ *
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
  * Version 2.0 (the 'License'). You may not use this file except in
  * compliance with the License. Please obtain a copy of the License at
  * http://www.opensource.apple.com/apsl/ and read it before using this
  * file.
- * 
+ *
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  * Please see the License for the specific language governing rights and
  * limitations under the License.
- * 
+ *
  * @APPLE_LICENSE_HEADER_END@
  */
 /*
  *
  *     File: mach/shared_region.h
  *
- *     protos and struct definitions for shared region
+ *      protos and struct definitions for shared region
  */
 
 #ifndef _MACH_SHARED_REGION_H_
 #include <mach/vm_types.h>
 #include <mach/mach_types.h>
 
-#define SHARED_REGION_BASE_I386                        0x90000000ULL
-#define SHARED_REGION_SIZE_I386                        0x20000000ULL
-#define SHARED_REGION_NESTING_BASE_I386                0x90000000ULL
-#define SHARED_REGION_NESTING_SIZE_I386                0x20000000ULL
-#define SHARED_REGION_NESTING_MIN_I386         0x00020000ULL
-#define SHARED_REGION_NESTING_MAX_I386         0xFFFE0000ULL
-
-#define SHARED_REGION_BASE_X86_64              0x00007FFF60000000ULL
-#define SHARED_REGION_SIZE_X86_64              0x000000009FE00000ULL
-#define SHARED_REGION_NESTING_BASE_X86_64      0x00007FFF60000000ULL
-#define SHARED_REGION_NESTING_SIZE_X86_64      0x000000009FE00000ULL
-#define SHARED_REGION_NESTING_MIN_X86_64       0x0000000000020000ULL
-#define SHARED_REGION_NESTING_MAX_X86_64       0xFFFFFFFFFFFE0000ULL
-
-#define SHARED_REGION_BASE_PPC                 0x90000000ULL
-#define SHARED_REGION_SIZE_PPC                 0x20000000ULL
-#define SHARED_REGION_NESTING_BASE_PPC         0x90000000ULL
-#define SHARED_REGION_NESTING_SIZE_PPC         0x10000000ULL
-#define SHARED_REGION_NESTING_MIN_PPC          0x10000000ULL
-#define SHARED_REGION_NESTING_MAX_PPC          0x10000000ULL
-
-#define SHARED_REGION_BASE_PPC64               0x00007FFF60000000ULL
-#define SHARED_REGION_SIZE_PPC64               0x00000000A0000000ULL
-#define SHARED_REGION_NESTING_BASE_PPC64       0x00007FFF60000000ULL
-#define SHARED_REGION_NESTING_SIZE_PPC64       0x00000000A0000000ULL
-#define SHARED_REGION_NESTING_MIN_PPC64                0x0000000010000000ULL
-#define SHARED_REGION_NESTING_MAX_PPC64                0x0000000010000000ULL
-
-#define SHARED_REGION_BASE_ARM                 0x30000000ULL
-#define SHARED_REGION_SIZE_ARM                 0x10000000ULL
-#define SHARED_REGION_NESTING_BASE_ARM         0x30000000ULL
-#define SHARED_REGION_NESTING_SIZE_ARM         0x08000000ULL
-#define SHARED_REGION_NESTING_MIN_ARM          ?
-#define SHARED_REGION_NESTING_MAX_ARM          ?
-
-/* 
+#define SHARED_REGION_BASE_I386                 0x90000000ULL
+#define SHARED_REGION_SIZE_I386                 0x20000000ULL
+#define SHARED_REGION_NESTING_BASE_I386         0x90000000ULL
+#define SHARED_REGION_NESTING_SIZE_I386         0x20000000ULL
+#define SHARED_REGION_NESTING_MIN_I386          0x00200000ULL
+#define SHARED_REGION_NESTING_MAX_I386          0xFFE00000ULL
+
+#define SHARED_REGION_BASE_X86_64               0x00007FFF00000000ULL
+#define SHARED_REGION_SIZE_X86_64               0x00000000FFE00000ULL
+#define SHARED_REGION_NESTING_BASE_X86_64       0x00007FFF00000000ULL
+#define SHARED_REGION_NESTING_SIZE_X86_64       0x00000000FFE00000ULL
+#define SHARED_REGION_NESTING_MIN_X86_64        0x0000000000200000ULL
+#define SHARED_REGION_NESTING_MAX_X86_64        0xFFFFFFFFFFE00000ULL
+
+#define SHARED_REGION_BASE_PPC                  0x90000000ULL
+#define SHARED_REGION_SIZE_PPC                  0x20000000ULL
+#define SHARED_REGION_NESTING_BASE_PPC          0x90000000ULL
+#define SHARED_REGION_NESTING_SIZE_PPC          0x10000000ULL
+#define SHARED_REGION_NESTING_MIN_PPC           0x10000000ULL
+#define SHARED_REGION_NESTING_MAX_PPC           0x10000000ULL
+
+#define SHARED_REGION_BASE_PPC64                0x00007FFF60000000ULL
+#define SHARED_REGION_SIZE_PPC64                0x00000000A0000000ULL
+#define SHARED_REGION_NESTING_BASE_PPC64        0x00007FFF60000000ULL
+#define SHARED_REGION_NESTING_SIZE_PPC64        0x00000000A0000000ULL
+#define SHARED_REGION_NESTING_MIN_PPC64         0x0000000010000000ULL
+#define SHARED_REGION_NESTING_MAX_PPC64         0x0000000010000000ULL
+
+#define SHARED_REGION_BASE_ARM                  0x40000000ULL
+#define SHARED_REGION_SIZE_ARM                  0x40000000ULL
+#define SHARED_REGION_NESTING_BASE_ARM          0x40000000ULL
+#define SHARED_REGION_NESTING_SIZE_ARM          0x40000000ULL
+#define SHARED_REGION_NESTING_MIN_ARM           ?
+#define SHARED_REGION_NESTING_MAX_ARM           ?
+
+#define SHARED_REGION_BASE_ARM64_32             0x1A000000ULL
+#define SHARED_REGION_SIZE_ARM64_32             0x40000000ULL
+#define SHARED_REGION_NESTING_BASE_ARM64_32     0x1A000000ULL
+#define SHARED_REGION_NESTING_SIZE_ARM64_32     0x40000000ULL
+#define SHARED_REGION_NESTING_MIN_ARM64_32      ?
+#define SHARED_REGION_NESTING_MAX_ARM64_32      ?
+
+#ifdef XNU_KERNEL_PRIVATE
+/* ARM64_TODO: move to higher memory */
+#endif
+#define SHARED_REGION_BASE_ARM64                0x180000000ULL
+#define SHARED_REGION_SIZE_ARM64                0x100000000ULL
+#define SHARED_REGION_NESTING_BASE_ARM64        0x180000000ULL
+#define SHARED_REGION_NESTING_SIZE_ARM64        0x100000000ULL
+#define SHARED_REGION_NESTING_MIN_ARM64         ?
+#define SHARED_REGION_NESTING_MAX_ARM64         ?
+
+#if defined(__i386__)
+#define SHARED_REGION_BASE                      SHARED_REGION_BASE_I386
+#define SHARED_REGION_SIZE                      SHARED_REGION_SIZE_I386
+#define SHARED_REGION_NESTING_BASE              SHARED_REGION_NESTING_BASE_I386
+#define SHARED_REGION_NESTING_SIZE              SHARED_REGION_NESTING_SIZE_I386
+#define SHARED_REGION_NESTING_MIN               SHARED_REGION_NESTING_MIN_I386
+#define SHARED_REGION_NESTING_MAX               SHARED_REGION_NESTING_MAX_I386
+#elif defined(__x86_64__)
+#define SHARED_REGION_BASE                      SHARED_REGION_BASE_X86_64
+#define SHARED_REGION_SIZE                      SHARED_REGION_SIZE_X86_64
+#define SHARED_REGION_NESTING_BASE              SHARED_REGION_NESTING_BASE_X86_64
+#define SHARED_REGION_NESTING_SIZE              SHARED_REGION_NESTING_SIZE_X86_64
+#define SHARED_REGION_NESTING_MIN               SHARED_REGION_NESTING_MIN_X86_64
+#define SHARED_REGION_NESTING_MAX               SHARED_REGION_NESTING_MAX_X86_64
+#elif defined(__arm__)
+#define SHARED_REGION_BASE                      SHARED_REGION_BASE_ARM
+#define SHARED_REGION_SIZE                      SHARED_REGION_SIZE_ARM
+#define SHARED_REGION_NESTING_BASE              SHARED_REGION_NESTING_BASE_ARM
+#define SHARED_REGION_NESTING_SIZE              SHARED_REGION_NESTING_SIZE_ARM
+#define SHARED_REGION_NESTING_MIN               SHARED_REGION_NESTING_MIN_ARM
+#define SHARED_REGION_NESTING_MAX               SHARED_REGION_NESTING_MAX_ARM
+#elif defined(__arm64__) && !defined(__LP64__)
+#define SHARED_REGION_BASE                      SHARED_REGION_BASE_ARM64_32
+#define SHARED_REGION_SIZE                      SHARED_REGION_SIZE_ARM64_32
+#define SHARED_REGION_NESTING_BASE              SHARED_REGION_NESTING_BASE_ARM64_32
+#define SHARED_REGION_NESTING_SIZE              SHARED_REGION_NESTING_SIZE_ARM64_32
+#define SHARED_REGION_NESTING_MIN               SHARED_REGION_NESTING_MIN_ARM64_32
+#define SHARED_REGION_NESTING_MAX               SHARED_REGION_NESTING_MAX_ARM64_32
+#elif defined(__arm64__) && defined(__LP64__)
+#define SHARED_REGION_BASE                      SHARED_REGION_BASE_ARM64
+#define SHARED_REGION_SIZE                      SHARED_REGION_SIZE_ARM64
+#define SHARED_REGION_NESTING_BASE              SHARED_REGION_NESTING_BASE_ARM64
+#define SHARED_REGION_NESTING_SIZE              SHARED_REGION_NESTING_SIZE_ARM64
+#define SHARED_REGION_NESTING_MIN               SHARED_REGION_NESTING_MIN_ARM64
+#define SHARED_REGION_NESTING_MAX               SHARED_REGION_NESTING_MAX_ARM64
+#endif
+
+#ifdef KERNEL_PRIVATE
+
+/*
+ * This is routine sets  the current source of power.
+ * Arguments:
+ * 0 if it is external source (connected to power )
+ * 1 if it is internal power source ie battery
+ */
+
+void post_sys_powersource(int);
+
+#endif /* KERNEL_PRIVATE */
+/*
  * All shared_region_* declarations are a private interface
  * between dyld and the kernel.
  *
  */
 struct shared_file_mapping_np {
-       mach_vm_address_t       sfm_address;
-       mach_vm_size_t          sfm_size;
-       mach_vm_offset_t        sfm_file_offset;
-       vm_prot_t               sfm_max_prot;
-       vm_prot_t               sfm_init_prot;
+       mach_vm_address_t       sfm_address;
+       mach_vm_size_t          sfm_size;
+       mach_vm_offset_t        sfm_file_offset;
+       vm_prot_t               sfm_max_prot;
+       vm_prot_t               sfm_init_prot;
 };
 #define VM_PROT_COW  0x8  /* must not interfere with normal prot assignments */
 #define VM_PROT_ZF  0x10  /* must not interfere with normal prot assignments */
+#define VM_PROT_SLIDE  0x20  /* must not interfere with normal prot assignments */
 
 #ifndef KERNEL
 
 __BEGIN_DECLS
-int    shared_region_check_np(uint64_t *startaddress);
-int    shared_region_map_np(int fd,
-                            uint32_t mappingCount,
-                            const struct shared_file_mapping_np *mappings);
+int     shared_region_check_np(uint64_t *startaddress);
+int     shared_region_map_np(int fd,
+    uint32_t mappingCount,
+    const struct shared_file_mapping_np *mappings);
+int     shared_region_slide_np(void);
 __END_DECLS
 
 #endif /* !KERNEL */