]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * The contents of this file constitute Original Code as defined in and | |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
11 | * | |
12 | * This Original Code and all software distributed under the License are | |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the | |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * | |
24 | * File: mach/shared_memory_server.h | |
25 | * | |
26 | * protos and struct definitions for shared library | |
27 | * server and interface | |
28 | */ | |
29 | #ifndef _MACH_SHARED_MEMORY_SERVER_H_ | |
30 | #define _MACH_SHARED_MEMORY_SERVER_H_ | |
31 | ||
32 | #include <sys/cdefs.h> | |
33 | #include <mach/vm_prot.h> | |
34 | #include <mach/vm_types.h> | |
35 | #include <mach/mach_types.h> | |
36 | ||
37 | #define VM_PROT_COW 0x8 /* must not interfere with normal prot assignments */ | |
38 | #define VM_PROT_ZF 0x10 /* must not interfere with normal prot assignments */ | |
39 | ||
40 | ||
41 | #if !defined(__LP64__) | |
42 | ||
43 | #define SHARED_LIBRARY_SERVER_SUPPORTED | |
44 | #define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000 | |
45 | #define GLOBAL_SHARED_DATA_SEGMENT 0xA0000000 | |
46 | #define GLOBAL_SHARED_SEGMENT_MASK 0xF0000000 | |
47 | ||
48 | #define SHARED_TEXT_REGION_SIZE 0x10000000 | |
49 | #define SHARED_DATA_REGION_SIZE 0x10000000 | |
50 | #define SHARED_ALTERNATE_LOAD_BASE 0x09000000 | |
51 | ||
52 | /* | |
53 | * Note: the two masks below are useful because the assumption is | |
54 | * made that these shared regions will always be mapped on natural boundaries | |
55 | * i.e. if the size is 0x10000000 the object can be mapped at | |
56 | * 0x20000000, or 0x30000000, but not 0x1000000 | |
57 | */ | |
58 | #define SHARED_TEXT_REGION_MASK 0x0FFFFFFF | |
59 | #define SHARED_DATA_REGION_MASK 0x0FFFFFFF | |
60 | ||
61 | #define SHARED_LIB_ALIAS 0x10 | |
62 | ||
63 | ||
64 | /* flags field aliases for copyin_shared_file and load_shared_file */ | |
65 | ||
66 | /* IN */ | |
67 | #define ALTERNATE_LOAD_SITE 0x1 | |
68 | #define NEW_LOCAL_SHARED_REGIONS 0x2 | |
69 | #define QUERY_IS_SYSTEM_REGION 0x4 | |
70 | ||
71 | /* OUT */ | |
72 | #define SF_PREV_LOADED 0x1 | |
73 | #define SYSTEM_REGION_BACKED 0x2 | |
74 | ||
75 | ||
76 | struct sf_mapping { | |
77 | vm_offset_t mapping_offset; | |
78 | vm_size_t size; | |
79 | vm_offset_t file_offset; | |
80 | vm_prot_t protection; /* read/write/execute/COW/ZF */ | |
81 | vm_offset_t cksum; | |
82 | }; | |
83 | typedef struct sf_mapping sf_mapping_t; | |
84 | ||
85 | #ifndef KERNEL | |
86 | /* load_shared_file and friends is deprecated */ | |
87 | __BEGIN_DECLS | |
88 | int load_shared_file(char *, caddr_t, u_long, | |
89 | caddr_t *, int, sf_mapping_t *, int *); | |
90 | int reset_shared_file(caddr_t *, int, sf_mapping_t *); | |
91 | int new_system_shared_regions(void); | |
92 | __END_DECLS | |
93 | #endif /* !KERNEL */ | |
94 | ||
95 | #endif /* !defined(__LP64__) */ | |
96 | ||
97 | /* | |
98 | * All shared_region_* declarations are a private interface | |
99 | * between dyld and the kernel. | |
100 | * | |
101 | */ | |
102 | struct shared_file_mapping_np { | |
103 | mach_vm_address_t sfm_address; | |
104 | mach_vm_size_t sfm_size; | |
105 | mach_vm_offset_t sfm_file_offset; | |
106 | vm_prot_t sfm_max_prot; | |
107 | vm_prot_t sfm_init_prot; | |
108 | }; | |
109 | ||
110 | struct shared_region_range_np { | |
111 | mach_vm_address_t srr_address; | |
112 | mach_vm_size_t srr_size; | |
113 | }; | |
114 | ||
115 | #ifndef KERNEL | |
116 | ||
117 | __BEGIN_DECLS | |
118 | int shared_region_map_file_np(int fd, | |
119 | uint32_t mappingCount, | |
120 | const struct shared_file_mapping_np *mappings, | |
121 | int64_t *slide_p); | |
122 | int shared_region_make_private_np(uint32_t rangeCount, | |
123 | const struct shared_region_range_np *ranges); | |
124 | __END_DECLS | |
125 | ||
126 | #endif /* !KERNEL */ | |
127 | ||
128 | #endif /* _MACH_SHARED_MEMORY_SERVER_H_ */ |