]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/shared_memory_server.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / mach / shared_memory_server.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
1c79356b 5 *
8ad349bb
A
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
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
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.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
1c79356b
A
29 */
30/*
31 *
9bccf70c 32 * File: mach/shared_memory_server.h
1c79356b
A
33 *
34 * protos and struct definitions for shared library
35 * server and interface
36 */
9bccf70c
A
37#ifndef _MACH_SHARED_MEMORY_SERVER_H_
38#define _MACH_SHARED_MEMORY_SERVER_H_
1c79356b 39
91447636
A
40#include <sys/cdefs.h>
41#include <mach/vm_prot.h>
42#include <mach/vm_types.h>
43#include <mach/mach_types.h>
44
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 */
47
48
49#if !defined(__LP64__)
50
0b4e3aa0 51#define SHARED_LIBRARY_SERVER_SUPPORTED
91447636
A
52#define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000
53#define GLOBAL_SHARED_DATA_SEGMENT 0xA0000000
54#define GLOBAL_SHARED_SEGMENT_MASK 0xF0000000
0b4e3aa0 55
91447636
A
56#define SHARED_TEXT_REGION_SIZE 0x10000000
57#define SHARED_DATA_REGION_SIZE 0x10000000
58#define SHARED_ALTERNATE_LOAD_BASE 0x09000000
0b4e3aa0 59
1c79356b
A
60/*
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
65 */
91447636
A
66#define SHARED_TEXT_REGION_MASK 0x0FFFFFFF
67#define SHARED_DATA_REGION_MASK 0x0FFFFFFF
1c79356b
A
68
69#define SHARED_LIB_ALIAS 0x10
70
71
72/* flags field aliases for copyin_shared_file and load_shared_file */
73
74/* IN */
75#define ALTERNATE_LOAD_SITE 0x1
76#define NEW_LOCAL_SHARED_REGIONS 0x2
9bccf70c 77#define QUERY_IS_SYSTEM_REGION 0x4
1c79356b
A
78
79/* OUT */
80#define SF_PREV_LOADED 0x1
9bccf70c 81#define SYSTEM_REGION_BACKED 0x2
1c79356b
A
82
83
1c79356b
A
84struct sf_mapping {
85 vm_offset_t mapping_offset;
86 vm_size_t size;
87 vm_offset_t file_offset;
88 vm_prot_t protection; /* read/write/execute/COW/ZF */
89 vm_offset_t cksum;
90};
1c79356b
A
91typedef struct sf_mapping sf_mapping_t;
92
91447636
A
93#ifndef KERNEL
94/* load_shared_file and friends is deprecated */
95__BEGIN_DECLS
96int load_shared_file(char *, caddr_t, u_long,
97 caddr_t *, int, sf_mapping_t *, int *);
98int reset_shared_file(caddr_t *, int, sf_mapping_t *);
99int new_system_shared_regions(void);
100__END_DECLS
101#endif /* !KERNEL */
102
103#endif /* !defined(__LP64__) */
104
105/*
106 * All shared_region_* declarations are a private interface
107 * between dyld and the kernel.
108 *
109 */
110struct 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;
116};
117
118struct shared_region_range_np {
119 mach_vm_address_t srr_address;
120 mach_vm_size_t srr_size;
121};
122
123#ifndef KERNEL
124
125__BEGIN_DECLS
126int shared_region_map_file_np(int fd,
127 uint32_t mappingCount,
128 const struct shared_file_mapping_np *mappings,
129 int64_t *slide_p);
130int shared_region_make_private_np(uint32_t rangeCount,
131 const struct shared_region_range_np *ranges);
132__END_DECLS
133
134#endif /* !KERNEL */
135
9bccf70c 136#endif /* _MACH_SHARED_MEMORY_SERVER_H_ */