]> git.saurik.com Git - apple/xnu.git/blame - tests/vm_memory_tests_src/mach_vm_tests.h
xnu-7195.81.3.tar.gz
[apple/xnu.git] / tests / vm_memory_tests_src / mach_vm_tests.h
CommitLineData
f427ee49
A
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
31extern mach_port_t serverPort;
32extern mach_port_t persistentReplyPort;
33extern boolean_t debug;
34
35struct 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};
47typedef struct ipc_message ipc_message_t;
48
49void mach_vm_client(mach_port_t);
50void mach_server_remap(mach_port_t);
51void mach_server_read(mach_port_t, int);
52void mach_server_make_memory_entry(mach_port_t);
53
54int mach_server_data_setup(void **);
55void mach_server_data_cleanup(void *, mach_vm_address_t, mach_vm_size_t);
56void mach_server_construct_header(ipc_message_t *, mach_port_t);
57void mach_server_create_allocation(mach_vm_address_t *, mach_vm_size_t, void *);
58void 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);
59void 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"