forked from KoKuToru/koku-xinput-wine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
43 lines (36 loc) · 829 Bytes
/
main.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
#include <dlfcn.h>
#include <unistd.h>
#include <sys/mman.h>
#include <limits.h>
#include <stdint.h>
#ifndef PAGESIZE
#define PAGESIZE 4096
#endif
typedef uintptr_t t_ptr;
struct __attribute__((packed)) Sjmp
{
unsigned char op;
#ifdef __LP64__
unsigned char op2;
void* value;
unsigned char op3;
unsigned char op4;
Sjmp(void* value):
op(0x48), op2(0xb8), op3(0xff), op4(0xe0), value(value)
{
/*
This JITs a AMD64 jmp instruction
*/
}
#else
void* value;
Sjmp(void* value):
op(0xE9), value((void*)((t_ptr)value-(t_ptr)&op-5))
{
/*
This JITs a X86 jmp instruction
*/
}
#endif
};
extern bool debug;