diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-02-28 14:19:04 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-02-28 14:19:04 +0100 |
| commit | e753c19da1b621b1e667de85ce5ef60d186f0684 (patch) | |
| tree | 9bc80378efbe42ec72678230de2905ab121a4d8f /src/include/box64context.h | |
| parent | 7b50468b61b7bdd9a15753c0a28711c1654a8c12 (diff) | |
| download | box64-e753c19da1b621b1e667de85ce5ef60d186f0684.tar.gz box64-e753c19da1b621b1e667de85ce5ef60d186f0684.zip | |
Added some minimal set of source (now box64 compile and say hello at least)
Diffstat (limited to 'src/include/box64context.h')
| -rwxr-xr-x | src/include/box64context.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/include/box64context.h b/src/include/box64context.h new file mode 100755 index 00000000..680b2d5e --- /dev/null +++ b/src/include/box64context.h @@ -0,0 +1,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_ \ No newline at end of file |