2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
32 * File: mach/shared_memory_server.h
34 * protos and struct definitions for shared library
35 * server and interface
37 #ifndef _MACH_SHARED_MEMORY_SERVER_H_
38 #define _MACH_SHARED_MEMORY_SERVER_H_
40 #include <sys/cdefs.h>
41 #include <mach/vm_prot.h>
42 #include <mach/vm_types.h>
43 #include <mach/mach_types.h>
45 #define VM_PROT_COW 0x8 /* must not interfere with normal prot assignments */
46 #define VM_PROT_ZF 0x10 /* must not interfere with normal prot assignments */
49 #if !defined(__LP64__)
51 #define SHARED_LIBRARY_SERVER_SUPPORTED
52 #define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000
53 #define GLOBAL_SHARED_DATA_SEGMENT 0xA0000000
54 #define GLOBAL_SHARED_SEGMENT_MASK 0xF0000000
56 #define SHARED_TEXT_REGION_SIZE 0x10000000
57 #define SHARED_DATA_REGION_SIZE 0x10000000
58 #define SHARED_ALTERNATE_LOAD_BASE 0x09000000
61 * Note: the two masks below are useful because the assumption is
62 * made that these shared regions will always be mapped on natural boundaries
63 * i.e. if the size is 0x10000000 the object can be mapped at
64 * 0x20000000, or 0x30000000, but not 0x1000000
66 #define SHARED_TEXT_REGION_MASK 0x0FFFFFFF
67 #define SHARED_DATA_REGION_MASK 0x0FFFFFFF
69 #define SHARED_LIB_ALIAS 0x10
72 /* flags field aliases for copyin_shared_file and load_shared_file */
75 #define ALTERNATE_LOAD_SITE 0x1
76 #define NEW_LOCAL_SHARED_REGIONS 0x2
77 #define QUERY_IS_SYSTEM_REGION 0x4
80 #define SF_PREV_LOADED 0x1
81 #define SYSTEM_REGION_BACKED 0x2
85 vm_offset_t mapping_offset
;
87 vm_offset_t file_offset
;
88 vm_prot_t protection
; /* read/write/execute/COW/ZF */
91 typedef struct sf_mapping sf_mapping_t
;
94 /* load_shared_file and friends is deprecated */
96 int load_shared_file(char *, caddr_t
, u_long
,
97 caddr_t
*, int, sf_mapping_t
*, int *);
98 int reset_shared_file(caddr_t
*, int, sf_mapping_t
*);
99 int new_system_shared_regions(void);
103 #endif /* !defined(__LP64__) */
106 * All shared_region_* declarations are a private interface
107 * between dyld and the kernel.
110 struct shared_file_mapping_np
{
111 mach_vm_address_t sfm_address
;
112 mach_vm_size_t sfm_size
;
113 mach_vm_offset_t sfm_file_offset
;
114 vm_prot_t sfm_max_prot
;
115 vm_prot_t sfm_init_prot
;
118 struct shared_region_range_np
{
119 mach_vm_address_t srr_address
;
120 mach_vm_size_t srr_size
;
126 int shared_region_map_file_np(int fd
,
127 uint32_t mappingCount
,
128 const struct shared_file_mapping_np
*mappings
,
130 int shared_region_make_private_np(uint32_t rangeCount
,
131 const struct shared_region_range_np
*ranges
);
136 #endif /* _MACH_SHARED_MEMORY_SERVER_H_ */