/*
- * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <vm/vm_map.h>
#include <ipc/ipc_port.h>
-extern vm_map_t com_region_map32; // the 32-bit shared submap, set up in vm init
-extern vm_map_t com_region_map64; // the 64-bit shared submap
+extern vm_map_t commpage32_map; // the 32-bit shared submap, set up in vm init
+extern vm_map_t commpage64_map; // the 64-bit shared submap
char *commPagePtr32 = NULL; // virtual address of 32-bit comm page in kernel map
char *commPagePtr64 = NULL; // and 64-bit commpage
*/
static void*
commpage_allocate(
- vm_map_t submap ) // com_region_map32 or com_region_map64
+ vm_map_t submap ) // commpage32_map or commpage64_map
{
- vm_offset_t kernel_addr; // address of commpage in kernel map
+ vm_offset_t kernel_addr = 0; // address of commpage in kernel map
vm_offset_t zero = 0;
vm_size_t size = _COMM_PAGE_AREA_USED; // size actually populated
vm_map_entry_t entry;
if (submap == NULL)
panic("commpage submap is null");
- if (vm_allocate(kernel_map,&kernel_addr,_COMM_PAGE_AREA_USED,VM_FLAGS_ANYWHERE))
+ if (vm_map(kernel_map,&kernel_addr,_COMM_PAGE_AREA_USED,0,VM_FLAGS_ANYWHERE,NULL,0,FALSE,VM_PROT_ALL,VM_PROT_ALL,VM_INHERIT_NONE))
panic("cannot allocate commpage");
if (vm_map_wire(kernel_map,kernel_addr,kernel_addr+_COMM_PAGE_AREA_USED,VM_PROT_DEFAULT,FALSE))
if (mach_make_memory_entry( kernel_map, // target map
&size, // size
kernel_addr, // offset (address in kernel map)
- VM_PROT_DEFAULT, // map it RW
+ VM_PROT_ALL, // map it RWX
&handle, // this is the object handle we get
NULL )) // parent_entry
panic("cannot make entry for commpage");
handle, // port is the memory entry we just made
0, // offset (map 1st page in memory entry)
FALSE, // copy
- VM_PROT_READ, // cur_protection (R-only in user map)
- VM_PROT_READ, // max_protection
+ VM_PROT_READ|VM_PROT_EXECUTE, // cur_protection (R-only in user map)
+ VM_PROT_READ|VM_PROT_EXECUTE, // max_protection
VM_INHERIT_SHARE )) // inheritance
panic("cannot map commpage");
char *dest = commpage_addr_of(address);
if (dest < next)
- panic("commpage overlap: %08 - %08X", dest, next);
+ panic("commpage overlap: %p - %p", dest, next);
bcopy((const char*)source,dest,length);
commpage_populate( void )
{
commpage_init_cpu_capabilities();
- commpage_populate_one( com_region_map32, &commPagePtr32, kCommPage32, "commpage 32-bit");
+ commpage_populate_one( commpage32_map, &commPagePtr32, kCommPage32, "commpage 32-bit");
if (_cpu_capabilities & k64Bit) {
- commpage_populate_one( com_region_map64, &commPagePtr64, kCommPage64, "commpage 64-bit");
+ commpage_populate_one( commpage64_map, &commPagePtr64, kCommPage64, "commpage 64-bit");
pmap_init_sharedpage((vm_offset_t)commPagePtr64); // Do the 64-bit version
}