aboutsummaryrefslogtreecommitdiffstats
path: root/src/vm.h
blob: 9164c577c6b82c5afbb487acbf91147629822c3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef _VM_H_
#define _VM_H_
#include <stdint.h>
#include <sys/types.h>

typedef struct VMMapping {
  void *begin;
  void *end;
  uint8_t r:1;
  uint8_t w:1;
  uint8_t x:1;
  uint8_t s:1;
  uint8_t p:1;
  const char *name;
  struct VMMapping *next;
} VMMapping;

typedef struct MemscanResult {
  VMMapping *mapping;
  off_t offset;
  struct MemscanResult *next;
} MemscanResult;

typedef struct Bytes {
  uint8_t *data;
  size_t len;
} Bytes;

VMMapping* parse_vmmap (int pid);

MemscanResult* memscan(int pid, Bytes aob);

void memwrite(int pid, void *address, Bytes aob);

Bytes memread(int pid, void *address, size_t nbytes);

#endif // _VM_H_