1 /*
2  * COPYRIGHT:       GPL - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/bios/bios32/vidbios32.c
5  * PURPOSE:         VDM 32-bit Video BIOS
6  * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7  *
8  * NOTE:            All of the real code is in bios/vidbios.c
9  */
10 
11 /* INCLUDES *******************************************************************/
12 
13 #include "ntvdm.h"
14 
15 #define NDEBUG
16 #include <debug.h>
17 
18 #include "emulator.h"
19 #include "cpu/bop.h"
20 #include "int32.h"
21 
22 #include "vidbios32.h"
23 #include <bios/vidbios.h>
24 #include "bios32p.h"
25 
26 /* DEFINES ********************************************************************/
27 
28 /* BOP Identifiers */
29 #define BOP_VIDEO_INT   0x10
30 
31 /* PUBLIC FUNCTIONS ***********************************************************/
32 
33 extern VOID WINAPI VidBiosVideoService(LPWORD Stack);
VidBiosINT(LPWORD Stack)34 static VOID WINAPI VidBiosINT(LPWORD Stack)
35 {
36     /*
37      * Set up a false stack to hardwire the BOP function (that can directly
38      * manipulate CPU registers) to the 32-bit interrupt function (which uses
39      * the stack to be able to modify the original CS:IP and FLAGS).
40      *
41      * See int32.h stack codes.
42      */
43     WORD EmuStack[4];
44     DWORD Flags = getEFLAGS();
45 
46     DPRINT1("Calling BOP VidBiosINT\n");
47 
48     EmuStack[STACK_FLAGS]   = LOWORD(Flags);
49     EmuStack[STACK_CS]      = getCS();
50     EmuStack[STACK_IP]      = getIP();
51     EmuStack[STACK_INT_NUM] = BOP_VIDEO_INT;
52 
53     VidBiosVideoService(EmuStack);
54 
55     setIP(EmuStack[STACK_IP]);
56     setCS(EmuStack[STACK_CS]);
57     setEFLAGS(MAKELONG(EmuStack[STACK_FLAGS], HIWORD(Flags)));
58 }
59 
VidBios32Initialize(VOID)60 BOOLEAN VidBios32Initialize(VOID)
61 {
62     /* Register the BIOS support BOPs */
63     RegisterBop(BOP_VIDEO_INT, VidBiosINT);
64     return TRUE;
65 }
66 
VidBios32Cleanup(VOID)67 VOID VidBios32Cleanup(VOID)
68 {
69     /* Unregister the BIOS support BOPs */
70     RegisterBop(BOP_VIDEO_INT, NULL);
71 }
72 
73 /* EOF */
74