]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/shared_memory_server.h
xnu-1699.26.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 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
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.
8f6c56a5 14 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 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 */
2d21ac55
A
35
36/*
37 * XXX
38 *
39 * NOTE: this file is deprecated and will be removed in the near future.
40 * Any project that includes this file should be changed to:
41 * 1. use <mach/shared_region.h> instead of this file,
42 * 2. handle the new shared regions, now available on more platforms
43 */
44
9bccf70c
A
45#ifndef _MACH_SHARED_MEMORY_SERVER_H_
46#define _MACH_SHARED_MEMORY_SERVER_H_
1c79356b 47
b0d623f7
A
48#warning "<mach/shared_memory_server.h> is deprecated. Please use <mach/shared_region.h> instead."
49
91447636
A
50#include <sys/cdefs.h>
51#include <mach/vm_prot.h>
52#include <mach/vm_types.h>
53#include <mach/mach_types.h>
54
55#define VM_PROT_COW 0x8 /* must not interfere with normal prot assignments */
56#define VM_PROT_ZF 0x10 /* must not interfere with normal prot assignments */
57
2d21ac55
A
58#define GLOBAL_SHARED_TEXT_SEGMENT 0x90000000U
59#define GLOBAL_SHARED_DATA_SEGMENT 0xA0000000U
60#define GLOBAL_SHARED_SEGMENT_MASK 0xF0000000U
61
62#define SHARED_TEXT_REGION_SIZE 0x10000000
63#define SHARED_DATA_REGION_SIZE 0x10000000
91447636
A
64
65#if !defined(__LP64__)
66
0b4e3aa0 67#define SHARED_LIBRARY_SERVER_SUPPORTED
0b4e3aa0 68
91447636 69#define SHARED_ALTERNATE_LOAD_BASE 0x09000000
0b4e3aa0 70
1c79356b
A
71/*
72 * Note: the two masks below are useful because the assumption is
73 * made that these shared regions will always be mapped on natural boundaries
74 * i.e. if the size is 0x10000000 the object can be mapped at
75 * 0x20000000, or 0x30000000, but not 0x1000000
76 */
91447636
A
77#define SHARED_TEXT_REGION_MASK 0x0FFFFFFF
78#define SHARED_DATA_REGION_MASK 0x0FFFFFFF
1c79356b 79
1c79356b
A
80
81/* flags field aliases for copyin_shared_file and load_shared_file */
82
83/* IN */
84#define ALTERNATE_LOAD_SITE 0x1
85#define NEW_LOCAL_SHARED_REGIONS 0x2
9bccf70c 86#define QUERY_IS_SYSTEM_REGION 0x4
1c79356b
A
87
88/* OUT */
89#define SF_PREV_LOADED 0x1
9bccf70c 90#define SYSTEM_REGION_BACKED 0x2
1c79356b
A
91
92
1c79356b
A
93struct sf_mapping {
94 vm_offset_t mapping_offset;
95 vm_size_t size;
96 vm_offset_t file_offset;
97 vm_prot_t protection; /* read/write/execute/COW/ZF */
98 vm_offset_t cksum;
99};
1c79356b
A
100typedef struct sf_mapping sf_mapping_t;
101
91447636
A
102#endif /* !defined(__LP64__) */
103
104/*
105 * All shared_region_* declarations are a private interface
106 * between dyld and the kernel.
107 *
108 */
109struct shared_file_mapping_np {
110 mach_vm_address_t sfm_address;
111 mach_vm_size_t sfm_size;
112 mach_vm_offset_t sfm_file_offset;
113 vm_prot_t sfm_max_prot;
114 vm_prot_t sfm_init_prot;
115};
116
117struct shared_region_range_np {
118 mach_vm_address_t srr_address;
119 mach_vm_size_t srr_size;
120};
121
122#ifndef KERNEL
123
124__BEGIN_DECLS
125int shared_region_map_file_np(int fd,
126 uint32_t mappingCount,
127 const struct shared_file_mapping_np *mappings,
128 int64_t *slide_p);
129int shared_region_make_private_np(uint32_t rangeCount,
130 const struct shared_region_range_np *ranges);
131__END_DECLS
132
133#endif /* !KERNEL */
134
9bccf70c 135#endif /* _MACH_SHARED_MEMORY_SERVER_H_ */