forked from f0rb1dd3n/Reptile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
internal.h
60 lines (49 loc) · 1.18 KB
/
internal.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/kallsyms.h>
#include <linux/stop_machine.h>
#include <linux/delay.h>
#include <linux/version.h>
#include <linux/sched.h>
#ifndef for_each_process
# include <linux/sched/signal.h>
#endif
#include "engine.h"
extern khook_t KHOOK_tbl[];
extern khook_t KHOOK_tbl_end[];
#define KHOOK_FOREACH_HOOK(p) \
for (p = KHOOK_tbl; p < KHOOK_tbl_end; p++)
typedef struct {
#pragma pack(push, 1)
union {
unsigned char _0x00_[ 0x10 ];
atomic_t use_count;
};
union {
unsigned char _0x10_[ 0x20 ];
unsigned char orig[0];
};
union {
unsigned char _0x30_[ 0x40 ];
unsigned char hook[0];
};
#pragma pack(pop)
unsigned nbytes;
} __attribute__((aligned(32))) khook_stub_t;
static khook_stub_t *khook_stub_tbl;
#define KHOOK_STUB(h) \
(khook_stub_tbl + ((h) - KHOOK_tbl))
#define KHOOK_STUB_TBL_SIZE \
(sizeof(khook_stub_t) * (KHOOK_tbl_end - KHOOK_tbl + 1))
#if BITS_PER_LONG == 64
# define KHOOK_STUB_FILE_NAME "stub.inc"
#else
# define KHOOK_STUB_FILE_NAME "stub32.inc"
#endif
#ifdef DEBUG
# define khook_debug(fmt, ...) \
pr_debug("[khook] " fmt, ##__VA_ARGS__)
#else
# define khook_debug(fmt, ...)
#endif