#include <mach/mach_types.defs>
#include <mach_debug/mach_debug_types.defs>
+#define CONCAT(a,b) a ## b
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+#define PREFIX(NAME) CONCAT(_kernelrpc_, NAME)
+#else
+#define PREFIX(NAME) NAME
+#endif
+
+#if KERNEL_SERVER
+#define KERNEL_SERVER_SUFFIX(NAME) CONCAT(NAME, _external)
+#else
+#define KERNEL_SERVER_SUFFIX(NAME) NAME
+#endif
+
/*
* Allocate zero-filled memory in the address space
* of the target task, either at the specified address,
* allocation actually took place is returned.
*/
#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
-routine mach_vm_allocate(
+routine PREFIX(KERNEL_SERVER_SUFFIX(mach_vm_allocate)) (
+ target : vm_task_entry_t;
+ inout address : mach_vm_address_t;
+ size : mach_vm_size_t;
+ flags : int);
+
#else
-routine vm_allocate(
-#endif
+
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+skip;
+#else
+routine PREFIX(KERNEL_SERVER_SUFFIX(vm_allocate)) (
target : vm_task_entry_t;
inout address : mach_vm_address_t;
size : mach_vm_size_t;
flags : int);
+#endif
+
+#endif
+
+
/*
* Deallocate the specified range from the virtual
* address space of the target virtual memory map.
*/
#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
-routine mach_vm_deallocate(
+routine PREFIX(mach_vm_deallocate) (
+ target : vm_task_entry_t;
+ address : mach_vm_address_t;
+ size : mach_vm_size_t);
+
#else
-routine vm_deallocate(
-#endif
+
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+skip;
+#else
+routine PREFIX(vm_deallocate) (
target : vm_task_entry_t;
address : mach_vm_address_t;
size : mach_vm_size_t);
+#endif
+
+#endif
/*
* Set the current or maximum protection attribute
* *permissions*.
*/
#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
-routine mach_vm_protect(
+routine PREFIX(mach_vm_protect) (
+ target_task : vm_task_entry_t;
+ address : mach_vm_address_t;
+ size : mach_vm_size_t;
+ set_maximum : boolean_t;
+ new_protection : vm_prot_t);
+
+
#else
-routine vm_protect(
-#endif
+
+#if !KERNEL && !LIBSYSCALL_INTERFACE
+skip;
+#else
+
+routine PREFIX(vm_protect) (
target_task : vm_task_entry_t;
address : mach_vm_address_t;
size : mach_vm_size_t;
set_maximum : boolean_t;
new_protection : vm_prot_t);
+#endif
+
+#endif
+
/*
* Set the inheritance attribute for the specified range
* of the virtual address space of the target address space.
* protection on the specified range must permit reading.]
*/
#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
-routine mach_vm_read(
+routine PREFIX(mach_vm_read) (
#else
-routine vm_read(
+routine PREFIX(vm_read) (
#endif
target_task : vm_map_t;
address : mach_vm_address_t;
* for further consistency.]
*/
#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
-routine mach_vm_map(
+routine PREFIX(KERNEL_SERVER_SUFFIX(mach_vm_map)) (
#else
#if defined(__arm__) && !LIBSYSCALL_INTERFACE
routine _vm_map_arm(
#else
-routine vm_map(
+routine PREFIX(KERNEL_SERVER_SUFFIX(vm_map)) (
#endif
#endif
target_task : vm_task_entry_t;
* Map portion of a task's address space.
*/
#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
-routine mach_vm_remap(
+routine PREFIX(KERNEL_SERVER_SUFFIX(mach_vm_remap)) (
#else
-routine vm_remap(
+routine PREFIX(KERNEL_SERVER_SUFFIX(vm_remap)) (
#endif
target_task : vm_map_t;
inout target_address : mach_vm_address_t;
* definition of the routine.
*/
#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
-routine mach_vm_purgable_control(
+routine PREFIX(mach_vm_purgable_control) (
#else
-routine vm_purgable_control(
+routine PREFIX(vm_purgable_control) (
#endif
target_task : vm_map_t;
address : mach_vm_address_t;
skip;
#endif
+#if !defined(_MACH_VM_PUBLISH_AS_LOCAL_)
+routine mach_vm_page_range_query(
+ target_map : vm_map_t;
+ address : mach_vm_offset_t;
+ size : mach_vm_size_t;
+ dispositions : mach_vm_address_t;
+ inout dispositions_count : mach_vm_size_t);
+#else
+skip;
+#endif
+
/****************************** Legacy section ***************************/
/* The following definitions are exist to provide compatibility with */
/* the legacy APIs. They are no different. We just need to produce */