2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
24 * File: mach/shared_memory_server.h
26 * protos and struct definitions for shared library
27 * server and interface
29 #ifndef _MACH_SHARED_MEMORY_SERVER_H_
30 #define _MACH_SHARED_MEMORY_SERVER_H_
32 #include <sys/cdefs.h>
33 #include <mach/vm_prot.h>
34 #include <mach/vm_types.h>
35 #include <mach/mach_types.h>
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 */
41 #if !defined(__LP64__)
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
48 #define SHARED_TEXT_REGION_SIZE 0x10000000
49 #define SHARED_DATA_REGION_SIZE 0x10000000
50 #define SHARED_ALTERNATE_LOAD_BASE 0x09000000
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
58 #define SHARED_TEXT_REGION_MASK 0x0FFFFFFF
59 #define SHARED_DATA_REGION_MASK 0x0FFFFFFF
61 #define SHARED_LIB_ALIAS 0x10
64 /* flags field aliases for copyin_shared_file and load_shared_file */
67 #define ALTERNATE_LOAD_SITE 0x1
68 #define NEW_LOCAL_SHARED_REGIONS 0x2
69 #define QUERY_IS_SYSTEM_REGION 0x4
72 #define SF_PREV_LOADED 0x1
73 #define SYSTEM_REGION_BACKED 0x2
77 vm_offset_t mapping_offset
;
79 vm_offset_t file_offset
;
80 vm_prot_t protection
; /* read/write/execute/COW/ZF */
83 typedef struct sf_mapping sf_mapping_t
;
86 /* load_shared_file and friends is deprecated */
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);
95 #endif /* !defined(__LP64__) */
98 * All shared_region_* declarations are a private interface
99 * between dyld and the kernel.
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
;
110 struct shared_region_range_np
{
111 mach_vm_address_t srr_address
;
112 mach_vm_size_t srr_size
;
118 int shared_region_map_file_np(int fd
,
119 uint32_t mappingCount
,
120 const struct shared_file_mapping_np
*mappings
,
122 int shared_region_make_private_np(uint32_t rangeCount
,
123 const struct shared_region_range_np
*ranges
);
128 #endif /* _MACH_SHARED_MEMORY_SERVER_H_ */