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