4 * Copyright 1995 Anand Kumria
14 #define VXD_BARF(context,name) \
15 fprintf( stderr, "vxd %s: unknown/not implemented parameters:\n" \
16 "vxd %s: AX %04x, BX %04x, CX %04x, DX %04x, " \
17 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
18 (name), (name), AX_reg(context), BX_reg(context), \
19 CX_reg(context), DX_reg(context), SI_reg(context), \
20 DI_reg(context), (WORD)DS_reg(context), (WORD)ES_reg(context) )
23 static WORD
VXD_WinVersion(void)
25 WORD version
= LOWORD(GetVersion16());
26 return (version
>> 8) | (version
<< 8);
29 /***********************************************************************
32 void WINAPI
VXD_PageFile( CONTEXT
*context
)
34 unsigned service
= AX_reg(context
);
36 /* taken from Ralf Brown's Interrupt List */
38 TRACE(vxd
,"[%04x] PageFile\n", (UINT16
)service
);
42 case 0x00: /* get version, is this windows version? */
43 TRACE(vxd
,"returning version\n");
44 AX_reg(context
) = VXD_WinVersion();
48 case 0x01: /* get swap file info */
49 TRACE(vxd
,"VxD PageFile: returning swap file info\n");
50 AX_reg(context
) = 0x00; /* paging disabled */
51 ECX_reg(context
) = 0; /* maximum size of paging file */
52 /* FIXME: do I touch DS:SI or DS:DI? */
56 case 0x02: /* delete permanent swap on exit */
57 TRACE(vxd
,"VxD PageFile: supposed to delete swap\n");
61 case 0x03: /* current temporary swap file size */
62 TRACE(vxd
,"VxD PageFile: what is current temp. swap size\n");
66 case 0x04: /* read or write?? INTERRUP.D */
67 case 0x05: /* cancel?? INTERRUP.D */
68 case 0x06: /* test I/O valid INTERRUP.D */
70 VXD_BARF( context
, "pagefile" );
76 /***********************************************************************
79 void WINAPI
VXD_Shell( CONTEXT
*context
)
81 unsigned service
= DX_reg(context
);
83 TRACE(vxd
,"[%04x] Shell\n", (UINT16
)service
);
85 switch (service
) /* Ralf Brown says EDX, but I use DX instead */
88 TRACE(vxd
,"returning version\n");
89 AX_reg(context
) = VXD_WinVersion();
90 EBX_reg(context
) = 1; /* system VM Handle */
98 TRACE(vxd
,"VxD Shell: EDX = %08lx\n",EDX_reg(context
));
99 VXD_BARF( context
, "shell" );
102 case 0x0006: /* SHELL_Get_VM_State */
103 TRACE(vxd
,"VxD Shell: returning VM state\n");
104 /* Actually we don't, not yet. We have to return a structure
105 * and I am not to sure how to set it up and return it yet,
106 * so for now let's do nothing. I can (hopefully) get this
107 * by the next release
109 /* RESET_CFLAG(context); */
129 TRACE(vxd
,"VxD Shell: EDX = %08lx\n",EDX_reg(context
));
130 VXD_BARF( context
, "shell");
136 /***********************************************************************
139 void WINAPI
VXD_Comm( CONTEXT
*context
)
141 unsigned service
= AX_reg(context
);
143 TRACE(vxd
,"[%04x] Comm\n", (UINT16
)service
);
147 case 0x0000: /* get version */
148 TRACE(vxd
,"returning version\n");
149 AX_reg(context
) = VXD_WinVersion();
150 RESET_CFLAG(context
);
153 case 0x0001: /* set port global */
154 case 0x0002: /* get focus */
155 case 0x0003: /* virtualise port */
157 VXD_BARF( context
, "comm" );
161 /***********************************************************************
164 void VXD_Timer( CONTEXT
*context
)
166 unsigned service
= AX_reg(context
);
168 TRACE(vxd
,"[%04x] Virtual Timer\n", (UINT16
)service
);
172 case 0x0000: /* version */
173 AX_reg(context
) = VXD_WinVersion();
174 RESET_CFLAG(context
);
177 case 0x0100: /* clock tick time, in 840nsecs */
178 EAX_reg(context
) = GetTickCount();
180 EDX_reg(context
) = EAX_reg(context
) >> 22;
181 EAX_reg(context
) <<= 10; /* not very precise */
184 case 0x0101: /* current Windows time, msecs */
185 case 0x0102: /* current VM time, msecs */
186 EAX_reg(context
) = GetTickCount();
190 VXD_BARF( context
, "VTD" );