[MVDM] Fix 64 bit issues

This commit is contained in:
Timo Kreuzer 2018-02-12 00:38:10 +01:00
parent 3323d117c3
commit 807331436e
13 changed files with 37 additions and 36 deletions

View file

@ -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 */

View file

@ -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)

View file

@ -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 */

View file

@ -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,

View file

@ -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;

View file

@ -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 */

View file

@ -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)

View file

@ -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 */

View file

@ -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;
}

View file

@ -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... */

View file

@ -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);

View file

@ -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));

View file

@ -67,6 +67,7 @@ DWORD WINAPI SetLastConsoleEventActive(VOID);
#define ADVANCED_DEBUGGING_LEVEL 1
#endif
#define NULL32 0
/* VARIABLES ******************************************************************/