https://git.reactos.org/?p=reactos.git;a=commitdiff;h=807331436ee5de09dbd34013fbbf237b7a92cc63

commit 807331436ee5de09dbd34013fbbf237b7a92cc63
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Mon Feb 12 00:38:10 2018 +0100
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sat Aug 4 19:19:34 2018 +0200

    [MVDM] Fix 64 bit issues
---
 subsystems/mvdm/ntvdm/bios/bios.c             |  2 +-
 subsystems/mvdm/ntvdm/bios/bios32/bios32.c    | 18 +++++++++---------
 subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c |  6 +++---
 subsystems/mvdm/ntvdm/bios/vidbios.c          | 10 +++++-----
 subsystems/mvdm/ntvdm/cpu/cpu.c               |  2 +-
 subsystems/mvdm/ntvdm/dos/dem.c               |  2 +-
 subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c  |  4 ++--
 subsystems/mvdm/ntvdm/dos/dos32krnl/process.c |  2 +-
 subsystems/mvdm/ntvdm/dos/mouse32.c           | 12 ++++++------
 subsystems/mvdm/ntvdm/emulator.c              |  6 +++---
 subsystems/mvdm/ntvdm/hardware/video/svga.c   |  4 ++--
 subsystems/mvdm/ntvdm/ntvdm.c                 |  4 ++--
 subsystems/mvdm/ntvdm/ntvdm.h                 |  1 +
 13 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/subsystems/mvdm/ntvdm/bios/bios.c 
b/subsystems/mvdm/ntvdm/bios/bios.c
index 9ee04e264d..14c44ae5ee 100644
--- a/subsystems/mvdm/ntvdm/bios/bios.c
+++ b/subsystems/mvdm/ntvdm/bios/bios.c
@@ -64,7 +64,7 @@ BiosInitialize(IN LPCSTR BiosFileName,
     BOOLEAN Success2 = FALSE;
     LPCSTR RomFile;
     LPSTR ptr;
-    ULONG RomAddress;
+    ULONG_PTR RomAddress;
     CHAR RomFileName[MAX_PATH + 10 + 1];
 
     /* Disable interrupts */
diff --git a/subsystems/mvdm/ntvdm/bios/bios32/bios32.c 
b/subsystems/mvdm/ntvdm/bios/bios32/bios32.c
index 1a65f0e0a3..a6dfa39de8 100644
--- a/subsystems/mvdm/ntvdm/bios/bios32/bios32.c
+++ b/subsystems/mvdm/ntvdm/bios/bios32/bios32.c
@@ -1017,16 +1017,16 @@ static VOID InitializeBiosInt32(VOID)
     // They don't have any default handler at the moment.
 
     /* Some vectors are in fact addresses to tables */
-    ((PULONG)BaseAddress)[0x1D] = (ULONG)NULL; // Video Parameter Tables
-    ((PULONG)BaseAddress)[0x1E] = (ULONG)NULL; // Diskette Parameters
-    ((PULONG)BaseAddress)[0x1F] = (ULONG)NULL; // 8x8 Graphics Font
-    ((PULONG)BaseAddress)[0x41] = (ULONG)NULL; // Hard Disk 0 Parameter Table 
Address
-    ((PULONG)BaseAddress)[0x43] = (ULONG)NULL; // Character Table (EGA, MCGA, 
VGA)
-    ((PULONG)BaseAddress)[0x46] = (ULONG)NULL; // Hard Disk 1 Drive Parameter 
Table Address
+    ((PULONG)BaseAddress)[0x1D] = NULL32; // Video Parameter Tables
+    ((PULONG)BaseAddress)[0x1E] = NULL32; // Diskette Parameters
+    ((PULONG)BaseAddress)[0x1F] = NULL32; // 8x8 Graphics Font
+    ((PULONG)BaseAddress)[0x41] = NULL32; // Hard Disk 0 Parameter Table 
Address
+    ((PULONG)BaseAddress)[0x43] = NULL32; // Character Table (EGA, MCGA, VGA)
+    ((PULONG)BaseAddress)[0x46] = NULL32; // Hard Disk 1 Drive Parameter Table 
Address
     /* Tables that are always uninitialized */
-    ((PULONG)BaseAddress)[0x44] = (ULONG)NULL; // ROM BIOS Character Font, 
Characters 00h-7Fh (PCjr)
-    ((PULONG)BaseAddress)[0x48] = (ULONG)NULL; // Cordless Keyboard 
Translation (PCjr)
-    ((PULONG)BaseAddress)[0x49] = (ULONG)NULL; // Non-Keyboard Scan-code 
Translation Table (PCJr)
+    ((PULONG)BaseAddress)[0x44] = NULL32; // ROM BIOS Character Font, 
Characters 00h-7Fh (PCjr)
+    ((PULONG)BaseAddress)[0x48] = NULL32; // Cordless Keyboard Translation 
(PCjr)
+    ((PULONG)BaseAddress)[0x49] = NULL32; // Non-Keyboard Scan-code 
Translation Table (PCJr)
 }
 
 static VOID InitializeBiosData(VOID)
diff --git a/subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c 
b/subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c
index a4731787bb..2a3691ea19 100644
--- a/subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c
+++ b/subsystems/mvdm/ntvdm/bios/bios32/dskbios32.c
@@ -654,12 +654,12 @@ VOID DiskBios32Post(VOID)
     // Diskette Parameters
     ((PULONG)BaseAddress)[0x1E] = MAKELONG(0xEFC7, BIOS_SEGMENT);
     // Hard Disk 0 Parameter Table Address
-    ((PULONG)BaseAddress)[0x41] = (ULONG)NULL;
+    ((PULONG)BaseAddress)[0x41] = NULL32;
     // Hard Disk 1 Drive Parameter Table Address
-    ((PULONG)BaseAddress)[0x46] = (ULONG)NULL;
+    ((PULONG)BaseAddress)[0x46] = NULL32;
 
     /* Relocated services by the BIOS (when needed) */
-    ((PULONG)BaseAddress)[0x40] = (ULONG)NULL; // ROM BIOS Diskette Handler 
relocated by Hard Disk BIOS
+    ((PULONG)BaseAddress)[0x40] = NULL32; // ROM BIOS Diskette Handler 
relocated by Hard Disk BIOS
     // RegisterBiosInt32(0x40, NULL); // ROM BIOS Diskette Handler relocated 
by Hard Disk BIOS
 
     /* Register the BIOS 32-bit Interrupts */
diff --git a/subsystems/mvdm/ntvdm/bios/vidbios.c 
b/subsystems/mvdm/ntvdm/bios/vidbios.c
index a2e19ac756..54ce259c7b 100644
--- a/subsystems/mvdm/ntvdm/bios/vidbios.c
+++ b/subsystems/mvdm/ntvdm/bios/vidbios.c
@@ -3628,7 +3628,7 @@ VOID WINAPI VidBiosVideoService(LPWORD Stack)
                 /* Get Current Character Font Information */
                 case 0x30:
                 {
-                    ULONG Address = (ULONG)NULL;
+                    ULONG Address = NULL32;
 
                     switch (getBH())
                     {
@@ -3936,16 +3936,16 @@ VOID VidBiosPost(VOID)
      */
 
     /* Some vectors are in fact addresses to tables */
-    ((PULONG)BaseAddress)[0x1D] = (ULONG)NULL; // Video Parameter Tables
+    ((PULONG)BaseAddress)[0x1D] = NULL32; // Video Parameter Tables
     // Far pointer to the 8x8 graphics font for the 8x8 characters 80h-FFh
     ((PULONG)BaseAddress)[0x1F] = MAKELONG(FONT_8x8_HIGH_OFFSET, 
VIDEO_BIOS_DATA_SEG);
     // Far pointer to the character table (EGA, MCGA, VGA) for the 8x16 
characters 00h-...
     ((PULONG)BaseAddress)[0x43] = MAKELONG(FONT_8x16_OFFSET, 
VIDEO_BIOS_DATA_SEG);
-    ((PULONG)BaseAddress)[0x44] = (ULONG)NULL; // ROM BIOS Character Font, 
Characters 00h-7Fh (PCjr)
+    ((PULONG)BaseAddress)[0x44] = NULL32; // ROM BIOS Character Font, 
Characters 00h-7Fh (PCjr)
 
     /* Relocated services by the BIOS (when needed) */
-    ((PULONG)BaseAddress)[0x42] = (ULONG)NULL; // Relocated Default INT 10h 
Video Services
-    ((PULONG)BaseAddress)[0x6D] = (ULONG)NULL; // Video BIOS Entry Point
+    ((PULONG)BaseAddress)[0x42] = NULL32; // Relocated Default INT 10h Video 
Services
+    ((PULONG)BaseAddress)[0x6D] = NULL32; // Video BIOS Entry Point
 
     //
     // FIXME: At the moment we always set a VGA mode. In the future,
diff --git a/subsystems/mvdm/ntvdm/cpu/cpu.c b/subsystems/mvdm/ntvdm/cpu/cpu.c
index 212f522d0a..2fcbc00dd8 100644
--- a/subsystems/mvdm/ntvdm/cpu/cpu.c
+++ b/subsystems/mvdm/ntvdm/cpu/cpu.c
@@ -147,7 +147,7 @@ LONG CpuExceptionFilter(IN PEXCEPTION_POINTERS 
ExceptionInfo)
             Fast486Rewind(&EmulatorContext);
 
             /* Call the memory handler */
-            MemExceptionHandler((ULONG)PHYS_TO_REAL(Address), Writing);
+            MemExceptionHandler((ULONG_PTR)PHYS_TO_REAL(Address), Writing);
 
             /* The execution of the CPU opcode handler MUST NOT continue */
             return EXCEPTION_EXECUTE_HANDLER;
diff --git a/subsystems/mvdm/ntvdm/dos/dem.c b/subsystems/mvdm/ntvdm/dos/dem.c
index 1c81eacc1c..d1edc10d2f 100644
--- a/subsystems/mvdm/ntvdm/dos/dem.c
+++ b/subsystems/mvdm/ntvdm/dos/dem.c
@@ -418,7 +418,7 @@ static VOID CmdStartExternalCommand(VOID)
     LPSTR Command = (LPSTR)SEG_OFF_TO_PTR(getDS(), getSI());
     CHAR CmdLine[sizeof("cmd.exe /c ") + DOS_CMDLINE_LENGTH + 1] = "";
     LPSTR CmdLinePtr;
-    ULONG CmdLineLen;
+    SIZE_T CmdLineLen;
 
     /* Spawn a user-defined 32-bit command preprocessor */
 
diff --git a/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c 
b/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c
index 8ba74891c9..7f4026012a 100644
--- a/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c
+++ b/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c
@@ -830,7 +830,7 @@ BOOLEAN EmsDrvInitialize(USHORT Segment, ULONG TotalPages)
         return FALSE;
     }
 
-    MemInstallFastMemoryHook((PVOID)TO_LINEAR(EmsSegment, 0),
+    MemInstallFastMemoryHook(UlongToPtr(TO_LINEAR(EmsSegment, 0)),
                              EMS_PHYSICAL_PAGES * EMS_PAGE_SIZE,
                              EmsReadMemory,
                              EmsWriteMemory);
@@ -852,7 +852,7 @@ VOID EmsDrvCleanup(VOID)
     /* Delete the device */
     DosDeleteDevice(Node);
 
-    MemRemoveFastMemoryHook((PVOID)TO_LINEAR(EmsSegment, 0),
+    MemRemoveFastMemoryHook(UlongToPtr(TO_LINEAR(EmsSegment, 0)),
                             EMS_PHYSICAL_PAGES * EMS_PAGE_SIZE);
 
     if (EmsMemory)
diff --git a/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c 
b/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c
index 01291b4506..7f356b0912 100644
--- a/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c
+++ b/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c
@@ -174,7 +174,7 @@ static WORD DosCopyEnvironmentBlock(IN LPCSTR Environment 
OPTIONAL,
                                     IN LPCSTR ProgramName)
 {
     PCHAR Ptr, DestBuffer = NULL;
-    ULONG TotalSize = 0;
+    SIZE_T TotalSize = 0;
     WORD DestSegment;
 
     /* If we have an environment strings list, compute its size */
diff --git a/subsystems/mvdm/ntvdm/dos/mouse32.c 
b/subsystems/mvdm/ntvdm/dos/mouse32.c
index 7b0671b8b5..1353bb5681 100644
--- a/subsystems/mvdm/ntvdm/dos/mouse32.c
+++ b/subsystems/mvdm/ntvdm/dos/mouse32.c
@@ -397,7 +397,7 @@ static VOID CallMouseUserHandlers(USHORT CallMask)
 
     /* Call handler 0 */
     if ((DriverState.Handler0.CallMask & CallMask) != 0 &&
-         DriverState.Handler0.Callback != (ULONG)NULL)
+         DriverState.Handler0.Callback != NULL32)
     {
         /*
          * Set the parameters for the callback.
@@ -445,7 +445,7 @@ static VOID CallMouseUserHandlers(USHORT CallMask)
     {
         /* Call the suitable handlers */
         if ((DriverState.Handlers[i].CallMask & CallMask) != 0 &&
-             DriverState.Handlers[i].Callback != (ULONG)NULL)
+             DriverState.Handlers[i].Callback != NULL32)
         {
             /*
              * Set the parameters for the callback.
@@ -920,13 +920,13 @@ static VOID WINAPI DosMouseService(LPWORD Stack)
                     {
                         /* Found it, undefine the handler */
                         DriverState.Handlers[i].CallMask = 0x0000;
-                        DriverState.Handlers[i].Callback = (ULONG)NULL;
+                        DriverState.Handlers[i].Callback = NULL32;
                         Success = TRUE;
                         break;
                     }
                 }
             }
-            else if (Callback == (ULONG)NULL)
+            else if (Callback == NULL32)
             {
                 /*
                  * Find the handler entry corresponding to the given
@@ -938,7 +938,7 @@ static VOID WINAPI DosMouseService(LPWORD Stack)
                     {
                         /* Found it, undefine the handler */
                         DriverState.Handlers[i].CallMask = 0x0000;
-                        DriverState.Handlers[i].Callback = (ULONG)NULL;
+                        DriverState.Handlers[i].Callback = NULL32;
                         Success = TRUE;
                         break;
                     }
@@ -959,7 +959,7 @@ static VOID WINAPI DosMouseService(LPWORD Stack)
                     /* Find the first empty handler */
                     if (EmptyHandler == 0xFFFF &&
                         DriverState.Handlers[i].CallMask == 0x0000 &&
-                        DriverState.Handlers[i].Callback == (ULONG)NULL)
+                        DriverState.Handlers[i].Callback == NULL32)
                     {
                         EmptyHandler = i;
                     }
diff --git a/subsystems/mvdm/ntvdm/emulator.c b/subsystems/mvdm/ntvdm/emulator.c
index b90d8e8313..2a6b186f27 100644
--- a/subsystems/mvdm/ntvdm/emulator.c
+++ b/subsystems/mvdm/ntvdm/emulator.c
@@ -304,7 +304,7 @@ static VOID
 DumpMemoryRaw(HANDLE hFile)
 {
     PVOID  Buffer;
-    SIZE_T Size;
+    DWORD Size;
 
     /* Dump the VM memory */
     SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
@@ -321,7 +321,7 @@ DumpMemoryTxt(HANDLE hFile)
     PBYTE  Ptr1, Ptr2;
     CHAR   LineBuffer[LINE_SIZE];
     PCHAR  Line;
-    SIZE_T LineSize;
+    DWORD LineSize;
 
     /* Dump the VM memory */
     SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
@@ -332,7 +332,7 @@ DumpMemoryTxt(HANDLE hFile)
         Line = LineBuffer;
 
         /* Print the address */
-        Line += snprintf(Line, LINE_SIZE + LineBuffer - Line, "%08x ", 
PHYS_TO_REAL(Ptr1));
+        Line += snprintf(Line, LINE_SIZE + LineBuffer - Line, "%08Ix ", 
(ULONG_PTR)PHYS_TO_REAL(Ptr1));
 
         /* Print up to 16 bytes... */
 
diff --git a/subsystems/mvdm/ntvdm/hardware/video/svga.c 
b/subsystems/mvdm/ntvdm/hardware/video/svga.c
index b253d6da09..209f8ead5a 100644
--- a/subsystems/mvdm/ntvdm/hardware/video/svga.c
+++ b/subsystems/mvdm/ntvdm/hardware/video/svga.c
@@ -1296,7 +1296,7 @@ static inline VOID VgaWriteGc(BYTE Data)
                 UCHAR MemoryMap = (VgaGcRegisters[VGA_GC_MISC_REG] >> 2) & 
0x03;
 
                 /* Register a memory hook */
-                MemInstallFastMemoryHook((PVOID)MemoryBase[MemoryMap],
+                MemInstallFastMemoryHook(UlongToPtr(MemoryBase[MemoryMap]),
                                          MemorySize[MemoryMap],
                                          VgaReadMemory,
                                          VgaWriteMemory);
@@ -1466,7 +1466,7 @@ static VOID WINAPI VgaWritePort(USHORT Port, BYTE Data)
                 UCHAR MemoryMap = (VgaGcRegisters[VGA_GC_MISC_REG] >> 2) & 
0x03;
 
                 /* Register a memory hook */
-                MemInstallFastMemoryHook((PVOID)MemoryBase[MemoryMap],
+                MemInstallFastMemoryHook(UlongToPtr(MemoryBase[MemoryMap]),
                                          MemorySize[MemoryMap],
                                          VgaReadMemory,
                                          VgaWriteMemory);
diff --git a/subsystems/mvdm/ntvdm/ntvdm.c b/subsystems/mvdm/ntvdm/ntvdm.c
index 48045369bb..4e5cd99a1c 100644
--- a/subsystems/mvdm/ntvdm/ntvdm.c
+++ b/subsystems/mvdm/ntvdm/ntvdm.c
@@ -95,7 +95,7 @@ NtVdmConfigureFloppy(IN PWSTR ValueName,
 {
     BOOLEAN Success;
     PNTVDM_SETTINGS Settings = (PNTVDM_SETTINGS)Context;
-    ULONG DiskNumber = (ULONG)EntryContext;
+    ULONG DiskNumber = PtrToUlong(EntryContext);
 
     ASSERT(DiskNumber < ARRAYSIZE(Settings->FloppyDisks));
 
@@ -131,7 +131,7 @@ NtVdmConfigureHDD(IN PWSTR ValueName,
 {
     BOOLEAN Success;
     PNTVDM_SETTINGS Settings = (PNTVDM_SETTINGS)Context;
-    ULONG DiskNumber = (ULONG)EntryContext;
+    ULONG DiskNumber = PtrToUlong(EntryContext);
 
     ASSERT(DiskNumber < ARRAYSIZE(Settings->HardDisks));
 
diff --git a/subsystems/mvdm/ntvdm/ntvdm.h b/subsystems/mvdm/ntvdm/ntvdm.h
index 60a763fd15..17dbd8dfa1 100644
--- a/subsystems/mvdm/ntvdm/ntvdm.h
+++ b/subsystems/mvdm/ntvdm/ntvdm.h
@@ -67,6 +67,7 @@ DWORD WINAPI SetLastConsoleEventActive(VOID);
 #define ADVANCED_DEBUGGING_LEVEL    1
 #endif
 
+#define NULL32 0
 
 /* VARIABLES 
******************************************************************/
 

Reply via email to