]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/shared_memory_server.h
xnu-517.12.7.tar.gz
[apple/xnu.git] / osfmk / mach / shared_memory_server.h
1 /*
2 * Copyright (c) 2000 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 #define SHARED_LIBRARY_SERVER_SUPPORTED
33 #define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000
34 #define GLOBAL_SHARED_DATA_SEGMENT 0xA0000000
35 #define GLOBAL_SHARED_SEGMENT_MASK 0xF0000000
36
37 #define SHARED_TEXT_REGION_SIZE 0x10000000
38 #define SHARED_DATA_REGION_SIZE 0x10000000
39 #define SHARED_ALTERNATE_LOAD_BASE 0x9000000
40
41 /*
42 * Note: the two masks below are useful because the assumption is
43 * made that these shared regions will always be mapped on natural boundaries
44 * i.e. if the size is 0x10000000 the object can be mapped at
45 * 0x20000000, or 0x30000000, but not 0x1000000
46 */
47 #define SHARED_TEXT_REGION_MASK 0xFFFFFFF
48 #define SHARED_DATA_REGION_MASK 0xFFFFFFF
49
50
51 #include <mach/vm_prot.h>
52 #include <mach/mach_types.h>
53
54 #define SHARED_LIB_ALIAS 0x10
55
56
57 /* flags field aliases for copyin_shared_file and load_shared_file */
58
59 /* IN */
60 #define ALTERNATE_LOAD_SITE 0x1
61 #define NEW_LOCAL_SHARED_REGIONS 0x2
62 #define QUERY_IS_SYSTEM_REGION 0x4
63
64 /* OUT */
65 #define SF_PREV_LOADED 0x1
66 #define SYSTEM_REGION_BACKED 0x2
67
68
69 #define load_file_hash(file_object, size) \
70 ((((natural_t)file_object) & 0xffffff) % size)
71
72 #define VM_PROT_COW 0x8 /* must not interfere with normal prot assignments */
73 #define VM_PROT_ZF 0x10 /* must not interfere with normal prot assignments */
74
75 struct sf_mapping {
76 vm_offset_t mapping_offset;
77 vm_size_t size;
78 vm_offset_t file_offset;
79 vm_prot_t protection; /* read/write/execute/COW/ZF */
80 vm_offset_t cksum;
81 };
82
83 typedef struct sf_mapping sf_mapping_t;
84
85 #endif /* _MACH_SHARED_MEMORY_SERVER_H_ */