about summary refs log tree commit diff stats
path: root/src/include
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-02 15:18:23 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-02 15:18:23 +0100
commiteb6c4594e1831daeddc469ed69c4dee917e627c1 (patch)
treeff8e5ec2506fde9ff69ca0850e84667669c8f471 /src/include
parent1b9d1dc6093028ceb0f2eeeccf9cfbc5610fcf30 (diff)
downloadbox64-eb6c4594e1831daeddc469ed69c4dee917e627c1.tar.gz
box64-eb6c4594e1831daeddc469ed69c4dee917e627c1.zip
Added basic thread infrastructure
Diffstat (limited to 'src/include')
-rwxr-xr-xsrc/include/box64context.h5
-rwxr-xr-xsrc/include/threads.h23
2 files changed, 28 insertions, 0 deletions
diff --git a/src/include/box64context.h b/src/include/box64context.h
index e6b4be63..8422a765 100755
--- a/src/include/box64context.h
+++ b/src/include/box64context.h
@@ -9,6 +9,7 @@ typedef struct cleanup_s cleanup_t;
 typedef struct x64emu_s x64emu_t;
 typedef struct zydis_s zydis_t;
 typedef struct zydis_dec_s zydis_dec_t;
+typedef struct kh_threadstack_s kh_threadstack_t;
 
 typedef void* (*procaddess_t)(const char* name);
 typedef void* (*vkprocaddess_t)(void* instance, const char* name);
@@ -57,6 +58,10 @@ typedef struct box64context_s {
 
     uintptr_t           ep;             // entry point
 
+    kh_threadstack_t    *stacksizes;    // stack sizes attributes for thread (temporary)
+
+    pthread_mutex_t     mutex_thread;
+
     pthread_key_t       tlskey;     // then tls key to have actual tlsdata
     void*               tlsdata;    // the initial global tlsdata
     int32_t             tlssize;    // wanted size of tlsdata
diff --git a/src/include/threads.h b/src/include/threads.h
new file mode 100755
index 00000000..fa9d64ab
--- /dev/null
+++ b/src/include/threads.h
@@ -0,0 +1,23 @@
+#ifndef _THREADS_H_
+#define _THREADS_H_
+
+typedef struct box64context_s box64context_t;
+typedef struct x64emu_s x64emu_t;
+
+typedef struct emu_jmpbuf_s {
+    x64emu_t*   emu;
+	void* 	    jmpbuf;
+	int 	    jmpbuf_ok;
+} emu_jmpbuf_t;
+
+void CleanStackSize(box64context_t* context);
+
+emu_jmpbuf_t* GetJmpBuf();
+
+void init_pthread_helper();
+void fini_pthread_helper(box64context_t* context);
+
+// prepare an "emuthread structure" in pet and return address of function pointer for a "thread creation routine"
+void* my_prepare_thread(x64emu_t *emu, void* f, void* arg, int ssize, void** pet);
+
+#endif //_THREADS_H_
\ No newline at end of file