blob: 680b2d5ee4e60c5b4a3195921376c040c29eeec6 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#ifndef __BOX64CONTEXT_H_
#define __BOX64CONTEXT_H_
#include <stdint.h>
#include <pthread.h>
#include "pathcoll.h"
typedef void* (*procaddess_t)(const char* name);
typedef void* (*vkprocaddess_t)(void* instance, const char* name);
#define MAX_SIGNAL 64
typedef struct tlsdatasize_s {
int32_t tlssize;
void* tlsdata;
} tlsdatasize_t;
void free_tlsdatasize(void* p);
typedef struct box64context_s {
path_collection_t box64_path; // PATH env. variable
path_collection_t box64_ld_lib; // LD_LIBRARY_PATH env. variable
path_collection_t box64_emulated_libs; // Collection of libs that should not be wrapped
int x86trace;
int trace_tid;
uint32_t sel_serial; // will be increment each time selectors changes
//zydis_t *zydis; // dlopen the zydis dissasembler
void* box64lib; // dlopen on box86 itself
int argc;
char** argv;
int envc;
char** envv;
char* fullpath;
char* box64path; // path of current box86 executable
uint32_t stacksz;
int stackalign;
void* stack; // alocated stack
int deferedInit;
pthread_key_t tlskey; // then tls key to have actual tlsdata
void* tlsdata; // the initial global tlsdata
int32_t tlssize; // wanted size of tlsdata
//zydis_dec_t *dec; // trace
uint8_t canary[4];
uintptr_t signals[MAX_SIGNAL];
uintptr_t restorer[MAX_SIGNAL];
int onstack[MAX_SIGNAL];
int is_sigaction[MAX_SIGNAL];
int no_sigsegv;
int no_sigill;
} box64context_t;
extern box64context_t *my_context; // global context
box64context_t *NewBox64Context(int argc);
void FreeBox64Context(box64context_t** context);
// return the tlsbase (negative) for the new TLS partition created (no partition index is stored in the context)
int AddTLSPartition(box64context_t* context, int tlssize);
#endif //__BOX64CONTEXT_H_
|