175 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
19 lines
760 B
C
19 lines
760 B
C
typedef unsigned int u32;
|
|
typedef unsigned long long u64;
|
|
typedef void (*PollFunction)(void *);
|
|
struct PollHost {
|
|
u32 abi,size;
|
|
volatile u32 stage,calls,windows_thread,error;
|
|
u64 owner,original_vtable,original_poll;
|
|
u64 vtable[129];
|
|
};
|
|
__declspec(dllexport) extern struct PollHost gw_poll_host_data;
|
|
static inline int record_poll(void *owner) {
|
|
u64 thread;
|
|
if((u64)owner!=gw_poll_host_data.owner){gw_poll_host_data.error=1;return 0;}
|
|
__asm__ volatile("movq %%gs:0x48, %0":"=r"(thread));
|
|
if(gw_poll_host_data.windows_thread && gw_poll_host_data.windows_thread!=(u32)thread){gw_poll_host_data.error=2;return 0;}
|
|
gw_poll_host_data.windows_thread=(u32)thread;
|
|
++gw_poll_host_data.calls;gw_poll_host_data.stage=3;return 1;
|
|
}
|