Author: aandrejevic
Date: Fri Aug 9 23:52:08 2013
New Revision: 59684
URL:
http://svn.reactos.org/svn/reactos?rev=59684&view=rev
Log:
[NTVDM]
Synchronize with trunk again to fix important bugs in the build system.
Implement register control functions which should be exported (Adapted from a patch by
Hermes Belusca-Maito).
The actual export is temporarily disabled because a bug in the build system compiles ntvdm
as a DLL instead of an EXE.
Added:
branches/ntvdm/subsystems/ntvdm/ntvdm.spec (with props)
branches/ntvdm/subsystems/ntvdm/registers.c (with props)
branches/ntvdm/subsystems/ntvdm/registers.h (with props)
Modified:
branches/ntvdm/ (props changed)
branches/ntvdm/cmake/CMakeMacros.cmake
branches/ntvdm/drivers/hid/hidparse/ (props changed)
branches/ntvdm/drivers/hid/hidusb/ (props changed)
branches/ntvdm/drivers/usb/usbehci/ (props changed)
branches/ntvdm/drivers/usb/usbhub/ (props changed)
branches/ntvdm/drivers/usb/usbohci/ (props changed)
branches/ntvdm/lib/drivers/libusb/common_interfaces.h (props changed)
branches/ntvdm/lib/drivers/libusb/hcd_controller.cpp (props changed)
branches/ntvdm/lib/drivers/libusb/hub_controller.cpp (props changed)
branches/ntvdm/lib/drivers/libusb/libusb.cpp (props changed)
branches/ntvdm/lib/drivers/libusb/libusb.h (props changed)
branches/ntvdm/lib/drivers/libusb/memory_manager.cpp (props changed)
branches/ntvdm/lib/drivers/libusb/misc.cpp (props changed)
branches/ntvdm/lib/drivers/libusb/purecall.cpp (props changed)
branches/ntvdm/lib/drivers/libusb/usb_device.cpp (props changed)
branches/ntvdm/subsystems/ntvdm/CMakeLists.txt
branches/ntvdm/subsystems/ntvdm/emulator.c
branches/ntvdm/subsystems/ntvdm/emulator.h
Propchange: branches/ntvdm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -15,4 +15,4 @@
/branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859
/branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567
/branches/wlan-bringup:54809-54998
-/trunk/reactos:59241-59678
+/trunk/reactos:59241-59683
Modified: branches/ntvdm/cmake/CMakeMacros.cmake
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/cmake/CMakeMacros.cmake?r…
==============================================================================
--- branches/ntvdm/cmake/CMakeMacros.cmake [iso-8859-1] (original)
+++ branches/ntvdm/cmake/CMakeMacros.cmake [iso-8859-1] Fri Aug 9 23:52:08 2013
@@ -430,7 +430,13 @@
elseif(${TYPE} STREQUAL nativecui)
set(__entrypoint NtProcessStartup)
set(__entrystack 4)
- elseif((${TYPE} STREQUAL win32gui) OR (${TYPE} STREQUAL win32cui))
+ elseif(${TYPE} STREQUAL win32cui)
+ if(__module_UNICODE)
+ set(__entrypoint wmainCRTStartup)
+ else()
+ set(__entrypoint mainCRTStartup)
+ endif()
+ elseif(${TYPE} STREQUAL win32gui)
if(__module_UNICODE)
set(__entrypoint wWinMainCRTStartup)
else()
Propchange: branches/ntvdm/drivers/hid/hidparse/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -18,5 +18,5 @@
/branches/usb-bringup/drivers/hid/hidparse:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859
/branches/usb-bringup-trunk/drivers/hid/hidparse:55020-55543,55548-55554
/branches/wlan-bringup/drivers/hid/hidparse:54809-54998
-/trunk/reactos/drivers/hid/hidparse:59241-59678
+/trunk/reactos/drivers/hid/hidparse:59241-59683
/trunk/reactos/drivers/usb/hidparse:48236-51323
Propchange: branches/ntvdm/drivers/hid/hidusb/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -18,5 +18,5 @@
/branches/usb-bringup/drivers/hid/hidusb:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859
/branches/usb-bringup-trunk/drivers/hid/hidusb:55020-55543,55548-55554
/branches/wlan-bringup/drivers/hid/hidusb:54809-54998
-/trunk/reactos/drivers/hid/hidusb:59241-59678
+/trunk/reactos/drivers/hid/hidusb:59241-59683
/trunk/reactos/drivers/usb/hidusb:48236-51323
Propchange: branches/ntvdm/drivers/usb/usbehci/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new:54809-54998
-/trunk/reactos/drivers/usb/usbehci:59241-59678
+/trunk/reactos/drivers/usb/usbehci:59241-59683
Propchange: branches/ntvdm/drivers/usb/usbhub/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbhub:55524-55543,55548-55554
/branches/wlan-bringup/drivers/usb/usbhub:54809-54998
/branches/wlan-bringup/drivers/usb/usbhub_new:54809-54998
-/trunk/reactos/drivers/usb/usbhub:59241-59678
+/trunk/reactos/drivers/usb/usbhub:59241-59683
Propchange: branches/ntvdm/drivers/usb/usbohci/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -19,4 +19,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbohci:55019-55543,55548-55554
/branches/wlan-bringup/drivers/usb/usbohci:54809-54998
/trunk/reactos/drivers/usb/usbehci_new:48236-51323
-/trunk/reactos/drivers/usb/usbohci:59241-59678
+/trunk/reactos/drivers/usb/usbohci:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/common_interfaces.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/interfaces.h:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/interfaces.h:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/interfaces.h:54809-54998
-/trunk/reactos/lib/drivers/libusb/common_interfaces.h:59241-59678
+/trunk/reactos/lib/drivers/libusb/common_interfaces.h:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/hcd_controller.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/hcd_controller.cpp:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/hcd_controller.cpp:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/hcd_controller.cpp:54809-54998
-/trunk/reactos/lib/drivers/libusb/hcd_controller.cpp:59241-59678
+/trunk/reactos/lib/drivers/libusb/hcd_controller.cpp:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/hub_controller.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/hub_controller.cpp:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/hub_controller.cpp:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/hub_controller.cpp:54809-54998
-/trunk/reactos/lib/drivers/libusb/hub_controller.cpp:59241-59678
+/trunk/reactos/lib/drivers/libusb/hub_controller.cpp:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/libusb.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/usbehci.cpp:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/usbehci.cpp:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/usbehci.cpp:54809-54998
-/trunk/reactos/lib/drivers/libusb/libusb.cpp:59241-59678
+/trunk/reactos/lib/drivers/libusb/libusb.cpp:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/libusb.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/usbehci.h:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/usbehci.h:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/usbehci.h:54809-54998
-/trunk/reactos/lib/drivers/libusb/libusb.h:59241-59678
+/trunk/reactos/lib/drivers/libusb/libusb.h:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/memory_manager.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/memory_manager.cpp:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/memory_manager.cpp:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/memory_manager.cpp:54809-54998
-/trunk/reactos/lib/drivers/libusb/memory_manager.cpp:59241-59678
+/trunk/reactos/lib/drivers/libusb/memory_manager.cpp:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/misc.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/misc.cpp:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/misc.cpp:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/misc.cpp:54809-54998
-/trunk/reactos/lib/drivers/libusb/misc.cpp:59241-59678
+/trunk/reactos/lib/drivers/libusb/misc.cpp:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/purecall.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/purecall.cpp:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/purecall.cpp:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/purecall.cpp:54809-54998
-/trunk/reactos/lib/drivers/libusb/purecall.cpp:59241-59678
+/trunk/reactos/lib/drivers/libusb/purecall.cpp:59241-59683
Propchange: branches/ntvdm/lib/drivers/libusb/usb_device.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Aug 9 23:52:08 2013
@@ -27,4 +27,4 @@
/branches/usb-bringup-trunk/drivers/usb/usbehci/usb_device.cpp:55524-55543,55548-55554,55556-55567
/branches/wlan-bringup/drivers/usb/usbehci/usb_device.cpp:54809-54998
/branches/wlan-bringup/drivers/usb/usbehci_new/usb_device.cpp:54809-54998
-/trunk/reactos/lib/drivers/libusb/usb_device.cpp:59241-59678
+/trunk/reactos/lib/drivers/libusb/usb_device.cpp:59241-59683
Modified: branches/ntvdm/subsystems/ntvdm/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/CMakeLis…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/CMakeLists.txt [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/CMakeLists.txt [iso-8859-1] Fri Aug 9 23:52:08 2013
@@ -1,16 +1,20 @@
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs/softx86)
+
+spec2def(ntvdm.exe ntvdm.spec)
list(APPEND SOURCE
bios.c
dos.c
emulator.c
pic.c
+ registers.c
timer.c
ps2.c
vga.c
ntvdm.c
ntvdm.rc)
+# ${CMAKE_CURRENT_BINARY_DIR}/ntvdm.def
add_executable(ntvdm ${SOURCE})
set_module_type(ntvdm win32cui UNICODE)
Modified: branches/ntvdm/subsystems/ntvdm/emulator.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] Fri Aug 9 23:52:08 2013
@@ -416,7 +416,7 @@
return TRUE;
}
-VOID EmulatorSetStack(WORD Segment, WORD Offset)
+VOID EmulatorSetStack(WORD Segment, DWORD Offset)
{
#ifndef NEW_EMULATOR
/* Call the softx86 API */
@@ -479,6 +479,15 @@
#endif
}
+ULONG EmulatorGetProgramCounter(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->reg_ip;
+#else
+ return EmulatorContext.InstructionPointer.Long;
+#endif
+}
+
VOID EmulatorSetRegister(ULONG Register, ULONG Value)
{
#ifndef NEW_EMULATOR
@@ -524,9 +533,9 @@
VOID EmulatorStep(VOID)
{
+#ifndef NEW_EMULATOR
LPWORD Instruction;
-#ifndef NEW_EMULATOR
/* Print the current position - useful for debugging */
DPRINT("Executing at CS:IP = %04X:%04X\n",
EmulatorGetRegister(EMULATOR_REG_CS),
Modified: branches/ntvdm/subsystems/ntvdm/emulator.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/emulator.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/emulator.h [iso-8859-1] Fri Aug 9 23:52:08 2013
@@ -168,14 +168,22 @@
typedef VOID (*EMULATOR_OPCODE_HANDLER)(PEMULATOR_CONTEXT Context, BYTE Opcode);
+#ifndef NEW_EMULATOR
+extern softx86_ctx EmulatorContext;
+extern softx87_ctx FpuEmulatorContext;
+#else
+extern EMULATOR_CONTEXT EmulatorContext;
+#endif
+
/* FUNCTIONS ******************************************************************/
BOOLEAN EmulatorInitialize();
-VOID EmulatorSetStack(WORD Segment, WORD Offset);
+VOID EmulatorSetStack(WORD Segment, DWORD Offset);
VOID EmulatorExecute(WORD Segment, WORD Offset);
VOID EmulatorInterrupt(BYTE Number);
VOID EmulatorExternalInterrupt(BYTE Number);
ULONG EmulatorGetRegister(ULONG Register);
+ULONG EmulatorGetProgramCounter(VOID);
VOID EmulatorSetRegister(ULONG Register, ULONG Value);
BOOLEAN EmulatorGetFlag(ULONG Flag);
VOID EmulatorSetFlag(ULONG Flag);
Added: branches/ntvdm/subsystems/ntvdm/ntvdm.spec
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.sp…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.spec (added)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.spec [iso-8859-1] Fri Aug 9 23:52:08 2013
@@ -0,0 +1,88 @@
+@ cdecl getAF()
+@ cdecl getAH()
+@ cdecl getAL()
+@ cdecl getAX()
+@ cdecl getBH()
+@ cdecl getBL()
+@ cdecl getBP()
+@ cdecl getBX()
+@ cdecl getCF()
+@ cdecl getCH()
+@ cdecl getCL()
+@ cdecl getCS()
+@ cdecl getCX()
+@ cdecl getDF()
+@ cdecl getDH()
+@ cdecl getDI()
+@ cdecl getDL()
+@ cdecl getDS()
+@ cdecl getDX()
+@ cdecl getEAX()
+@ cdecl getEBP()
+@ cdecl getEBX()
+@ cdecl getECX()
+@ cdecl getEDI()
+@ cdecl getEDX()
+; @ cdecl getEFLAGS()
+@ cdecl getEIP()
+@ cdecl getES()
+@ cdecl getESI()
+@ cdecl getESP()
+@ cdecl getFS()
+@ cdecl getGS()
+@ cdecl getIF()
+; @ cdecl getIntelRegistersPointer()
+@ cdecl getIP()
+@ cdecl getMSW()
+@ cdecl getOF()
+@ cdecl getPF()
+@ cdecl getSF()
+@ cdecl getSI()
+@ cdecl getSP()
+@ cdecl getSS()
+@ cdecl getZF()
+
+
+
+@ cdecl setAF(long)
+@ cdecl setAH(long)
+@ cdecl setAL(long)
+@ cdecl setAX(long)
+@ cdecl setBH(long)
+@ cdecl setBL(long)
+@ cdecl setBP(long)
+@ cdecl setBX(long)
+@ cdecl setCF(long)
+@ cdecl setCH(long)
+@ cdecl setCL(long)
+@ cdecl setCS(long)
+@ cdecl setCX(long)
+@ cdecl setDF(long)
+@ cdecl setDH(long)
+@ cdecl setDI(long)
+@ cdecl setDL(long)
+@ cdecl setDS(long)
+@ cdecl setDX(long)
+@ cdecl setEAX(long)
+@ cdecl setEBP(long)
+@ cdecl setEBX(long)
+@ cdecl setECX(long)
+@ cdecl setEDI(long)
+@ cdecl setEDX(long)
+; @ cdecl setEFLAGS(long)
+@ cdecl setEIP(long)
+@ cdecl setES(long)
+@ cdecl setESI(long)
+@ cdecl setESP(long)
+@ cdecl setFS(long)
+@ cdecl setGS(long)
+@ cdecl setIF(long)
+@ cdecl setIP(long)
+@ cdecl setMSW(long)
+@ cdecl setOF(long)
+@ cdecl setPF(long)
+@ cdecl setSF(long)
+@ cdecl setSI(long)
+@ cdecl setSP(long)
+@ cdecl setSS(long)
+@ cdecl setZF(long)
Propchange: branches/ntvdm/subsystems/ntvdm/ntvdm.spec
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/ntvdm/subsystems/ntvdm/registers.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/register…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/registers.c (added)
+++ branches/ntvdm/subsystems/ntvdm/registers.c [iso-8859-1] Fri Aug 9 23:52:08 2013
@@ -0,0 +1,811 @@
+/*
+ * COPYRIGHT: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS Virtual DOS Machine
+ * FILE: registers.c
+ * PURPOSE: Exported functions for manipulating registers
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#define NDEBUG
+
+#include "emulator.h"
+
+/* PUBLIC FUNCTIONS ***********************************************************/
+
+ULONG
+CDECL
+getEAX(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_AX].val;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_AX].Long;
+#endif
+}
+
+VOID
+CDECL
+setEAX(ULONG Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_AX].val = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_AX].Long = Value;
+#endif
+}
+
+USHORT
+CDECL
+getAX(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_AX].w.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_AX].LowWord;
+#endif
+}
+
+VOID
+CDECL
+setAX(USHORT Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_AX].w.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_AX].LowWord = Value;
+#endif
+}
+
+UCHAR
+CDECL
+getAH(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.hi;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_AX].HighByte;
+#endif
+}
+
+VOID
+CDECL
+setAH(UCHAR Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.hi = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_AX].HighByte = Value;
+#endif
+}
+
+UCHAR
+CDECL
+getAL(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_AX].LowByte;
+#endif
+}
+
+VOID
+CDECL
+setAL(UCHAR Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_AX].LowByte = Value;
+#endif
+}
+
+ULONG
+CDECL
+getEBX(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_BX].val;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_BX].Long;
+#endif
+}
+
+VOID
+CDECL
+setEBX(ULONG Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_BX].val = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_BX].Long = Value;
+#endif
+}
+
+USHORT
+CDECL
+getBX(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_BX].w.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_BX].LowWord;
+#endif
+}
+
+VOID
+CDECL
+setBX(USHORT Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_BX].w.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_BX].LowWord = Value;
+#endif
+}
+
+UCHAR
+CDECL
+getBH(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.hi;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_BX].HighByte;
+#endif
+}
+
+VOID
+CDECL
+setBH(UCHAR Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.hi = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_BX].HighByte = Value;
+#endif
+}
+
+UCHAR
+CDECL
+getBL(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_BX].LowByte;
+#endif
+}
+
+VOID
+CDECL
+setBL(UCHAR Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_BX].LowByte = Value;
+#endif
+}
+
+
+
+ULONG
+CDECL
+getECX(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_CX].val;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_CX].Long;
+#endif
+}
+
+VOID
+CDECL
+setECX(ULONG Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_CX].val = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_CX].Long = Value;
+#endif
+}
+
+USHORT
+CDECL
+getCX(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_CX].w.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_CX].LowWord;
+#endif
+}
+
+VOID
+CDECL
+setCX(USHORT Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_CX].w.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_CX].LowWord = Value;
+#endif
+}
+
+UCHAR
+CDECL
+getCH(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.hi;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_CX].HighByte;
+#endif
+}
+
+VOID
+CDECL
+setCH(UCHAR Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.hi = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_CX].HighByte = Value;
+#endif
+}
+
+UCHAR
+CDECL
+getCL(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_CX].LowByte;
+#endif
+}
+
+VOID
+CDECL
+setCL(UCHAR Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_CX].LowByte = Value;
+#endif
+}
+
+
+
+ULONG
+CDECL
+getEDX(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_DX].val;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_DX].Long;
+#endif
+}
+
+VOID
+CDECL
+setEDX(ULONG Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_DX].val = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_DX].Long = Value;
+#endif
+}
+
+USHORT
+CDECL
+getDX(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_DX].w.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_DX].LowWord;
+#endif
+}
+
+VOID
+CDECL
+setDX(USHORT Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_DX].w.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_DX].LowWord = Value;
+#endif
+}
+
+UCHAR
+CDECL
+getDH(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.hi;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_DX].HighByte;
+#endif
+}
+
+VOID
+CDECL
+setDH(UCHAR Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.hi = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_DX].HighByte = Value;
+#endif
+}
+
+UCHAR
+CDECL
+getDL(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_DX].LowByte;
+#endif
+}
+
+VOID
+CDECL
+setDL(UCHAR Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_DX].LowByte = Value;
+#endif
+}
+
+
+
+ULONG
+CDECL
+getESP(VOID)
+{
+ return EmulatorGetRegister(EMULATOR_REG_SP);
+}
+
+VOID
+CDECL
+setESP(ULONG Value)
+{
+ EmulatorSetStack(EmulatorGetRegister(EMULATOR_REG_SS), Value);
+}
+
+USHORT
+CDECL
+getSP(VOID)
+{
+ return LOWORD(EmulatorGetRegister(EMULATOR_REG_SP));
+}
+
+VOID
+CDECL
+setSP(USHORT Value)
+{
+ EmulatorSetStack(EmulatorGetRegister(EMULATOR_REG_SS), Value);
+}
+
+
+
+ULONG
+CDECL
+getEBP(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_BP].val;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_BP].Long;
+#endif
+}
+
+VOID
+CDECL
+setEBP(ULONG Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_BP].val = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_BP].Long = Value;
+#endif
+}
+
+USHORT
+CDECL
+getBP(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_BP].w.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_BP].LowWord;
+#endif
+}
+
+VOID
+CDECL
+setBP(USHORT Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_BP].w.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_BP].LowWord = Value;
+#endif
+}
+
+
+
+ULONG
+CDECL
+getESI(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_SI].val;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_SI].Long;
+#endif
+}
+
+VOID
+CDECL
+setESI(ULONG Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_SI].val = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_SI].Long = Value;
+#endif
+}
+
+USHORT
+CDECL
+getSI(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_SI].w.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_SI].LowWord;
+#endif
+}
+
+VOID
+CDECL
+setSI(USHORT Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_SI].w.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_SI].LowWord = Value;
+#endif
+}
+
+
+
+ULONG
+CDECL
+getEDI(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_DI].val;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_DI].Long;
+#endif
+}
+
+VOID
+CDECL
+setEDI(ULONG Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_DI].val = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_DI].Long = Value;
+#endif
+}
+
+USHORT
+CDECL
+getDI(VOID)
+{
+#ifndef NEW_EMULATOR
+ return EmulatorContext.state->general_reg[EMULATOR_REG_DI].w.lo;
+#else
+ return EmulatorContext.Registers[EMULATOR_REG_DI].LowWord;
+#endif
+}
+
+VOID
+CDECL
+setDI(USHORT Value)
+{
+#ifndef NEW_EMULATOR
+ EmulatorContext.state->general_reg[EMULATOR_REG_DI].w.lo = Value;
+#else
+ EmulatorContext.Registers[EMULATOR_REG_DI].LowWord = Value;
+#endif
+}
+
+
+
+ULONG
+CDECL
+getEIP(VOID)
+{
+ return EmulatorGetProgramCounter();
+}
+
+VOID
+CDECL
+setEIP(ULONG Value)
+{
+ EmulatorExecute(EmulatorGetRegister(EMULATOR_REG_CS), Value);
+}
+
+USHORT
+CDECL
+getIP(VOID)
+{
+ return LOWORD(EmulatorGetProgramCounter());
+}
+
+VOID
+CDECL
+setIP(USHORT Value)
+{
+ EmulatorExecute(EmulatorGetRegister(EMULATOR_REG_CS), Value);
+}
+
+
+
+USHORT
+CDECL
+getCS(VOID)
+{
+ return EmulatorGetRegister(EMULATOR_REG_CS);
+}
+
+VOID
+CDECL
+setCS(USHORT Value)
+{
+ EmulatorSetRegister(EMULATOR_REG_CS, Value);
+}
+
+USHORT
+CDECL
+getSS(VOID)
+{
+ return EmulatorGetRegister(EMULATOR_REG_SS);
+}
+
+VOID
+CDECL
+setSS(USHORT Value)
+{
+ EmulatorSetRegister(EMULATOR_REG_SS, Value);
+}
+
+USHORT
+CDECL
+getDS(VOID)
+{
+ return EmulatorGetRegister(EMULATOR_REG_DS);
+}
+
+VOID
+CDECL
+setDS(USHORT Value)
+{
+ EmulatorSetRegister(EMULATOR_REG_DS, Value);
+}
+
+USHORT
+CDECL
+getES(VOID)
+{
+ return EmulatorGetRegister(EMULATOR_REG_ES);
+}
+
+VOID
+CDECL
+setES(USHORT Value)
+{
+ EmulatorSetRegister(EMULATOR_REG_ES, Value);
+}
+
+USHORT
+CDECL
+getFS(VOID)
+{
+ return EmulatorGetRegister(EMULATOR_REG_FS);
+}
+
+VOID
+CDECL
+setFS(USHORT Value)
+{
+ EmulatorSetRegister(EMULATOR_REG_FS, Value);
+}
+
+USHORT
+CDECL
+getGS(VOID)
+{
+ return EmulatorGetRegister(EMULATOR_REG_GS);
+}
+
+VOID
+CDECL
+setGS(USHORT Value)
+{
+ EmulatorSetRegister(EMULATOR_REG_GS, Value);
+}
+
+
+
+ULONG
+CDECL
+getCF(VOID)
+{
+ return EmulatorGetFlag(EMULATOR_FLAG_CF);
+}
+
+VOID
+CDECL
+setCF(ULONG Flag)
+{
+ if (Flag & 1)
+ EmulatorSetFlag(EMULATOR_FLAG_CF);
+ else
+ EmulatorClearFlag(EMULATOR_FLAG_CF);
+}
+
+ULONG
+CDECL
+getPF(VOID)
+{
+ return EmulatorGetFlag(EMULATOR_FLAG_PF);
+}
+
+VOID
+CDECL
+setPF(ULONG Flag)
+{
+ if (Flag & 1)
+ EmulatorSetFlag(EMULATOR_FLAG_PF);
+ else
+ EmulatorClearFlag(EMULATOR_FLAG_PF);
+}
+
+ULONG
+CDECL
+getAF(VOID)
+{
+ return EmulatorGetFlag(EMULATOR_FLAG_AF);
+}
+
+VOID
+CDECL
+setAF(ULONG Flag)
+{
+ if (Flag & 1)
+ EmulatorSetFlag(EMULATOR_FLAG_AF);
+ else
+ EmulatorClearFlag(EMULATOR_FLAG_AF);
+}
+
+ULONG
+CDECL
+getZF(VOID)
+{
+ return EmulatorGetFlag(EMULATOR_FLAG_ZF);
+}
+
+VOID
+CDECL
+setZF(ULONG Flag)
+{
+ if (Flag & 1)
+ EmulatorSetFlag(EMULATOR_FLAG_ZF);
+ else
+ EmulatorClearFlag(EMULATOR_FLAG_ZF);
+}
+
+ULONG
+CDECL
+getSF(VOID)
+{
+ return EmulatorGetFlag(EMULATOR_FLAG_SF);
+}
+
+VOID
+CDECL
+setSF(ULONG Flag)
+{
+ if (Flag & 1)
+ EmulatorSetFlag(EMULATOR_FLAG_SF);
+ else
+ EmulatorClearFlag(EMULATOR_FLAG_SF);
+}
+
+ULONG
+CDECL
+getIF(VOID)
+{
+ return EmulatorGetFlag(EMULATOR_FLAG_IF);
+}
+
+VOID
+CDECL
+setIF(ULONG Flag)
+{
+ if (Flag & 1)
+ EmulatorSetFlag(EMULATOR_FLAG_IF);
+ else
+ EmulatorClearFlag(EMULATOR_FLAG_IF);
+}
+
+ULONG
+CDECL
+getDF(VOID)
+{
+ return EmulatorGetFlag(EMULATOR_FLAG_DF);
+}
+
+VOID
+CDECL
+setDF(ULONG Flag)
+{
+ if (Flag & 1)
+ EmulatorSetFlag(EMULATOR_FLAG_DF);
+ else
+ EmulatorClearFlag(EMULATOR_FLAG_DF);
+}
+
+ULONG
+CDECL
+getOF(VOID)
+{
+ return EmulatorGetFlag(EMULATOR_FLAG_OF);
+}
+
+VOID
+CDECL
+setOF(ULONG Flag)
+{
+ if (Flag & 1)
+ EmulatorSetFlag(EMULATOR_FLAG_OF);
+ else
+ EmulatorClearFlag(EMULATOR_FLAG_OF);
+}
+
+
+
+USHORT
+CDECL
+getMSW(VOID)
+{
+ return 0; // UNIMPLEMENTED
+}
+
+VOID
+CDECL
+setMSW(USHORT Value)
+{
+ // UNIMPLEMENTED
+}
+
+/* EOF */
Propchange: branches/ntvdm/subsystems/ntvdm/registers.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/ntvdm/subsystems/ntvdm/registers.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/register…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/registers.h (added)
+++ branches/ntvdm/subsystems/ntvdm/registers.h [iso-8859-1] Fri Aug 9 23:52:08 2013
@@ -0,0 +1,112 @@
+/*
+ * COPYRIGHT: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS Virtual DOS Machine
+ * FILE: registers.c
+ * PURPOSE: Exported functions for manipulating registers
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+#ifndef _REGISTERS_H_
+#define _REGISTERS_H_
+
+/* INCLUDES *******************************************************************/
+
+ULONG getEAX(VOID);
+VOID setEAX(ULONG);
+USHORT getAX(VOID);
+VOID setAX(USHORT);
+UCHAR getAH(VOID);
+VOID setAH(UCHAR);
+UCHAR getAL(VOID);
+VOID setAL(UCHAR);
+
+ULONG getEBX(VOID);
+VOID setEBX(ULONG);
+USHORT getBX(VOID);
+VOID setBX(USHORT);
+UCHAR getBH(VOID);
+VOID setBH(UCHAR);
+UCHAR getBL(VOID);
+VOID setBL(UCHAR);
+
+ULONG getECX(VOID);
+VOID setECX(ULONG);
+USHORT getCX(VOID);
+VOID setCX(USHORT);
+UCHAR getCH(VOID);
+VOID setCH(UCHAR);
+UCHAR getCL(VOID);
+VOID setCL(UCHAR);
+
+ULONG getEDX(VOID);
+VOID setEDX(ULONG);
+USHORT getDX(VOID);
+VOID setDX(USHORT);
+UCHAR getDH(VOID);
+VOID setDH(UCHAR);
+UCHAR getDL(VOID);
+VOID setDL(UCHAR);
+
+
+
+ULONG getESP(VOID);
+VOID setESP(ULONG);
+USHORT getSP(VOID);
+VOID setSP(USHORT);
+
+ULONG getEBP(VOID);
+VOID setEBP(ULONG);
+USHORT getBP(VOID);
+VOID setBP(USHORT);
+
+ULONG getESI(VOID);
+VOID setESI(ULONG);
+USHORT getSI(VOID);
+VOID setSI(USHORT);
+
+ULONG getEDI(VOID);
+VOID setEDI(ULONG);
+USHORT getDI(VOID);
+VOID setDI(USHORT);
+
+ULONG getEIP(VOID);
+VOID setEIP(ULONG);
+USHORT getIP(VOID);
+VOID setIP(USHORT);
+
+USHORT getCS(VOID);
+VOID setCS(USHORT);
+USHORT getSS(VOID);
+VOID setSS(USHORT);
+USHORT getDS(VOID);
+VOID setDS(USHORT);
+USHORT getES(VOID);
+VOID setES(USHORT);
+USHORT getFS(VOID);
+VOID setFS(USHORT);
+USHORT getGS(VOID);
+VOID setGS(USHORT);
+
+ULONG getCF(VOID);
+VOID setCF(ULONG);
+ULONG getPF(VOID);
+VOID setPF(ULONG);
+ULONG getAF(VOID);
+VOID setAF(ULONG);
+ULONG getZF(VOID);
+VOID setZF(ULONG);
+ULONG getSF(VOID);
+VOID setSF(ULONG);
+ULONG getIF(VOID);
+VOID setIF(ULONG);
+ULONG getDF(VOID);
+VOID setDF(ULONG);
+ULONG getOF(VOID);
+VOID setOF(ULONG);
+
+USHORT getMSW(VOID);
+VOID setMSW(USHORT);
+
+#endif // _REGISTERS_H_
+
+/* EOF */
Propchange: branches/ntvdm/subsystems/ntvdm/registers.h
------------------------------------------------------------------------------
svn:eol-style = native