aboutsummaryrefslogtreecommitdiff
path: root/w9x/inc/vmm.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2026-10-26 00:50:06 +0100
committerJavier <dev.git@javispedro.com>2026-10-26 00:50:06 +0100
commit6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a (patch)
treee274d41a8dd5e912e20617a937a1fda5af91f8de /w9x/inc/vmm.h
parent9b1cf601360fb194047e6dcc2af75c2f38c611ec (diff)
downloadchu-6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a.tar.gz
chu-6b8a368c51082fdd010ef5e1b0be4eb9b5059d1a.zip
refactor common parts into inc/ch375.h and add win9x, linux drivers
Diffstat (limited to 'w9x/inc/vmm.h')
-rw-r--r--w9x/inc/vmm.h161
1 files changed, 161 insertions, 0 deletions
diff --git a/w9x/inc/vmm.h b/w9x/inc/vmm.h
new file mode 100644
index 0000000..eb8f834
--- /dev/null
+++ b/w9x/inc/vmm.h
@@ -0,0 +1,161 @@
+#ifndef VMM_H
+#define VMM_H
+
+/** VMM VxD services and types.
+ * Manually generated for now. */
+
+#include <stdint.h>
+
+#define PAGESHIFT 12
+#define PAGESIZE (1 << PAGESHIFT)
+
+/** Timeout handle, see Set_*_Time_Out, Cancel_Time_Out services. */
+typedef void* HTIMEOUT;
+
+static inline unsigned short Get_VMM_Version(void);
+#pragma aux Get_VMM_Version = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 0" \
+ __parm caller [] __value [ax]
+
+static inline void Release_Time_Slice(void);
+#pragma aux Release_Time_Slice = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 56" \
+ __parm caller __modify []
+
+static inline void Time_Slice_Sleep(uint32_t ms);
+#pragma aux Time_Slice_Sleep = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 353" \
+ __parm caller [eax] __modify []
+
+typedef void (Global_Time_Out_Proc)(void *VMHandle, uint32_t tardiness, uint32_t ref_data);
+#pragma aux Global_Time_Out_Proc __parm [ebx] [ecx] [edx]
+
+static inline HTIMEOUT Set_Global_Time_Out(Global_Time_Out_Proc *proc, uint32_t ms, uint32_t refData);
+#pragma aux Set_Global_Time_Out = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 60" \
+ __parm caller [esi] __value [esi] __modify [ecx edx]
+
+static inline void Cancel_Time_Out(HTIMEOUT timeout);
+#pragma aux Cancel_Time_Out = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 62" \
+ __parm caller [esi] __modify [eax ecx edx]
+
+typedef void (Async_Time_Out_Proc)(uint32_t tardiness, uint32_t ref_data);
+#pragma aux Async_Time_Out_Proc __parm [ecx] [edx]
+
+static inline HTIMEOUT Set_Async_Time_Out(Async_Time_Out_Proc *proc, uint32_t ms, uint32_t refData);
+#pragma aux Set_Async_Time_Out = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 254" \
+ __parm caller [esi] [eax] [edx] __value [esi] __modify [ecx edx]
+
+static inline uint32_t Get_System_Time(void);
+#pragma aux Get_System_Time = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 63" \
+ __parm caller __value [eax] __modify []
+
+static inline uint32_t Get_Last_Updated_System_Time(void);
+#pragma aux Get_Last_Updated_System_Time = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 207" \
+ __parm caller __value [eax] __modify []
+
+static inline uint32_t * Get_System_Time_Address(void);
+#pragma aux Get_System_Time_Address = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 324" \
+ __parm caller __value [eax] __modify []
+
+enum {
+ HEAPZEROINIT = 0x0001,
+ HEAPZEROREINIT = 0x0002,
+ HEAPNOCOPY = 0x0004,
+ HEAPLOCKEDIFDP = 0x0100,
+ HEAPSWAP = 0x0200,
+ HEAPINIT = 0x0400,
+ HEAPCLEAN = 0x0800
+};
+
+static inline void * HeapAllocate(unsigned long bytes, unsigned long flags);
+#pragma aux HeapAllocate = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 79" \
+ __parm caller [] __value [eax] __modify [ecx edx]
+
+static inline unsigned long HeapFree(void *addr, unsigned long flags);
+#pragma aux HeapFree = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 81" \
+ __parm caller [] __value [eax] __modify [ecx edx]
+
+enum page_allocate_types {
+ PG_VM = 0,
+ PG_SYS = 1,
+ PG_RESERVED1 = 2,
+ PG_PRIVATE = 3,
+ PG_RESERVED2 = 4,
+ PG_RELOCK = 5,
+ PG_INSTANCE = 6,
+ PG_HOOKED = 7
+};
+
+enum page_allocate_flags {
+ PAGEZEROINIT = 0x00000001,
+ PAGEUSEALIGN = 0x00000002,
+ PAGECONTIG = 0x00000004,
+ PAGEFIXED = 0x00000008,
+ PAGEDEBUGNULFAULT = 0x00000010,
+ PAGEZEROREINIT = 0x00000020,
+ PAGENOCOPY = 0x00000040,
+ PAGELOCKED = 0x00000080,
+ PAGELOCKEDIFDP = 0x00000100,
+ PAGESETV86PAGEABLE = 0x00000200,
+ PAGECLEARV86PAGEABLE = 0x00000400,
+ PAGESETV86INTSLOCKED = 0x00000800,
+ PAGECLEARV86INTSLOCKED = 0x00001000,
+ PAGEMARKPAGEOUT = 0x00002000,
+ PAGEPDPSETBASE = 0x00004000,
+ PAGEPDPCLEARBASE = 0x00008000,
+ PAGEDISCARD = 0x00010000,
+ PAGEPDPQUERYDIRTY = 0x00020000,
+ PAGEMAPFREEPHYSREG = 0x00040000,
+ PAGENOMOVE = 0x10000000,
+ PAGEMAPGLOBAL = 0x40000000,
+ PAGEMARKDIRTY = 0x80000000
+};
+
+static inline void * PageAllocate(unsigned long npages, unsigned long type, unsigned long vm,
+ unsigned long alignMask, unsigned long minPhys, unsigned long maxPhys,
+ uint32_t *physAddr, unsigned long flags);
+#pragma aux PageAllocate = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 83" \
+ __parm caller [] __value [eax] __modify [ecx edx]
+
+static inline unsigned long PageFree(void *addr, unsigned long flags);
+#pragma aux PageFree = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 85" \
+ __parm caller [] __value [eax] __modify [ecx edx]
+
+static inline char Hook_Device_Service(uint32_t service, void *hook);
+#pragma aux Hook_Device_Service = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 144" \
+ "setc al" \
+ __parm caller [eax] [esi] __value [al] __modify [ecx edx]
+
+static inline char Unhook_Device_Service(uint32_t service, void *hook);
+#pragma aux Unhook_Device_Service = \
+ "int 0x20" \
+ "dd ( 1 shl 16 ) + 284" \
+ "setc al" \
+ __parm caller [eax] [esi] __value [al] __modify [ecx edx]
+
+#endif // VMM_H