]> git.saurik.com Git - apple/xnu.git/blob - tests/vm_memory_tests_src/mach_vm_tests.h
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / tests / vm_memory_tests_src / mach_vm_tests.h
1 #include <unistd.h>
2 #include <spawn.h>
3 #include <os/log.h>
4 #include <bootstrap_priv.h>
5 #include <libproc.h>
6 #include <signal.h>
7 #include <stdatomic.h>
8 #include <os/assumes.h>
9 #include <assert.h>
10 #include <string.h>
11 #include <sys/stat.h>
12 #include <darwintest.h>
13 #include <darwintest_utils.h>
14
15 #include <mach/mach_time.h>
16 #include <mach/message.h>
17 #include <mach/mach_traps.h>
18 #include <mach/mach_vm.h>
19
20 #define VM_OP_NONE (0)
21 #define VM_OP_UNMAP (1)
22 #define VM_OP_EXIT (2)
23 #define VM_OP_COPY (3)
24 #define VM_OP_READ (4)
25 #define VM_OP_MEMENTRY (5)
26 #define VM_OP_REMAP (6)
27 #define VM_OP_READ_OVERWRITE (7)
28 #define VM_OP_WRITE (8)
29 #define VM_OP_EXIT_ERROR (9)
30
31 extern mach_port_t serverPort;
32 extern mach_port_t persistentReplyPort;
33 extern boolean_t debug;
34
35 struct ipc_message {
36 mach_msg_header_t header;
37 mach_msg_body_t body;
38 mach_msg_port_descriptor_t port_descriptor;
39 boolean_t copy;
40 int vm_op;
41 uint64_t address;
42 uint64_t pid;
43 uint64_t size;
44 uint64_t misoffset;
45 char value[64];
46 };
47 typedef struct ipc_message ipc_message_t;
48
49 void mach_vm_client(mach_port_t);
50 void mach_server_remap(mach_port_t);
51 void mach_server_read(mach_port_t, int);
52 void mach_server_make_memory_entry(mach_port_t);
53
54 int mach_server_data_setup(void **);
55 void mach_server_data_cleanup(void *, mach_vm_address_t, mach_vm_size_t);
56 void mach_server_construct_header(ipc_message_t *, mach_port_t);
57 void mach_server_create_allocation(mach_vm_address_t *, mach_vm_size_t, void *);
58 void mach_server_contruct_payload(ipc_message_t *, mach_vm_address_t, mach_port_t, mach_vm_size_t, mach_vm_offset_t, boolean_t, int);
59 void server_error_out(mach_port_t);
60
61
62 #define MACH_VM_TEST_SERVICE_NAME "com.apple.test.xnu.vm.machVMTest"
63 #define VM_SPAWN_TOOL "/AppleInternal/Tests/xnu/darwintests/tools/vm_spawn_tool"