mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 01:53:42 +00:00
[NTVDM]
Add debug output. svn path=/branches/ntvdm/; revision=59555
This commit is contained in:
parent
f603441db9
commit
c04b008f1f
8 changed files with 69 additions and 7 deletions
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
#include "pic.h"
|
#include "pic.h"
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
#include "dos.h"
|
#include "dos.h"
|
||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
|
@ -349,11 +351,15 @@ BOOLEAN DosResizeMemory(WORD BlockData, WORD NewSize, WORD *MaxAvailable)
|
||||||
WORD Segment = BlockData - 1, ReturnSize = 0, NextSegment;
|
WORD Segment = BlockData - 1, ReturnSize = 0, NextSegment;
|
||||||
PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment), NextMcb;
|
PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment), NextMcb;
|
||||||
|
|
||||||
|
DPRINT("DosResizeMemory: BlockData 0x%04X, NewSize 0x%04X\n",
|
||||||
|
BlockData,
|
||||||
|
NewSize);
|
||||||
|
|
||||||
/* Make sure this is a valid, allocated block */
|
/* Make sure this is a valid, allocated block */
|
||||||
if ((Mcb->BlockType != 'M' && Mcb->BlockType != 'Z') || Mcb->OwnerPsp == 0)
|
if ((Mcb->BlockType != 'M' && Mcb->BlockType != 'Z') || Mcb->OwnerPsp == 0)
|
||||||
{
|
{
|
||||||
Success = FALSE;
|
Success = FALSE;
|
||||||
DosLastError = ERROR_INVALID_PARAMETER;
|
DosLastError = ERROR_INVALID_HANDLE;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,6 +382,7 @@ BOOLEAN DosResizeMemory(WORD BlockData, WORD NewSize, WORD *MaxAvailable)
|
||||||
/* Make sure the next segment is free */
|
/* Make sure the next segment is free */
|
||||||
if (NextMcb->OwnerPsp != 0)
|
if (NextMcb->OwnerPsp != 0)
|
||||||
{
|
{
|
||||||
|
DPRINT("Cannot expand memory block: next segment is not free!\n");
|
||||||
DosLastError = ERROR_NOT_ENOUGH_MEMORY;
|
DosLastError = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
Success = FALSE;
|
Success = FALSE;
|
||||||
goto Done;
|
goto Done;
|
||||||
|
@ -397,6 +404,10 @@ BOOLEAN DosResizeMemory(WORD BlockData, WORD NewSize, WORD *MaxAvailable)
|
||||||
/* Check if the block is larger than requested */
|
/* Check if the block is larger than requested */
|
||||||
if (Mcb->Size > NewSize)
|
if (Mcb->Size > NewSize)
|
||||||
{
|
{
|
||||||
|
DPRINT("Block too large, reducing size from 0x%04X to 0x%04X\n",
|
||||||
|
Mcb->Size,
|
||||||
|
NewSize);
|
||||||
|
|
||||||
/* It is, split it into two blocks */
|
/* It is, split it into two blocks */
|
||||||
NextMcb = SEGMENT_TO_MCB(Segment + NewSize + 1);
|
NextMcb = SEGMENT_TO_MCB(Segment + NewSize + 1);
|
||||||
|
|
||||||
|
@ -412,6 +423,10 @@ BOOLEAN DosResizeMemory(WORD BlockData, WORD NewSize, WORD *MaxAvailable)
|
||||||
}
|
}
|
||||||
else if (NewSize < Mcb->Size)
|
else if (NewSize < Mcb->Size)
|
||||||
{
|
{
|
||||||
|
DPRINT("Shrinking block from 0x%04X to 0x%04X\n",
|
||||||
|
Mcb->Size,
|
||||||
|
NewSize);
|
||||||
|
|
||||||
/* Just split the block */
|
/* Just split the block */
|
||||||
NextMcb = SEGMENT_TO_MCB(Segment + NewSize + 1);
|
NextMcb = SEGMENT_TO_MCB(Segment + NewSize + 1);
|
||||||
NextMcb->BlockType = Mcb->BlockType;
|
NextMcb->BlockType = Mcb->BlockType;
|
||||||
|
@ -427,6 +442,9 @@ Done:
|
||||||
/* Check if the operation failed */
|
/* Check if the operation failed */
|
||||||
if (!Success)
|
if (!Success)
|
||||||
{
|
{
|
||||||
|
DPRINT("DosResizeMemory FAILED. Maximum available: 0x%04X\n",
|
||||||
|
ReturnSize);
|
||||||
|
|
||||||
/* Return the maximum possible size */
|
/* Return the maximum possible size */
|
||||||
if (MaxAvailable) *MaxAvailable = ReturnSize;
|
if (MaxAvailable) *MaxAvailable = ReturnSize;
|
||||||
}
|
}
|
||||||
|
@ -438,8 +456,14 @@ BOOLEAN DosFreeMemory(WORD BlockData)
|
||||||
{
|
{
|
||||||
PDOS_MCB Mcb = SEGMENT_TO_MCB(BlockData - 1);
|
PDOS_MCB Mcb = SEGMENT_TO_MCB(BlockData - 1);
|
||||||
|
|
||||||
|
DPRINT("DosFreeMemory: BlockData 0x%04X\n", BlockData);
|
||||||
|
|
||||||
/* Make sure the MCB is valid */
|
/* Make sure the MCB is valid */
|
||||||
if (Mcb->BlockType != 'M' && Mcb->BlockType != 'Z') return FALSE;
|
if (Mcb->BlockType != 'M' && Mcb->BlockType != 'Z')
|
||||||
|
{
|
||||||
|
DPRINT("MCB block type '%c' not valid!\n", Mcb->BlockType);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Mark the block as free */
|
/* Mark the block as free */
|
||||||
Mcb->OwnerPsp = 0;
|
Mcb->OwnerPsp = 0;
|
||||||
|
@ -452,6 +476,8 @@ BOOLEAN DosLinkUmb(VOID)
|
||||||
DWORD Segment = FIRST_MCB_SEGMENT;
|
DWORD Segment = FIRST_MCB_SEGMENT;
|
||||||
PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment);
|
PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment);
|
||||||
|
|
||||||
|
DPRINT("Linking UMB\n");
|
||||||
|
|
||||||
/* Check if UMBs are already linked */
|
/* Check if UMBs are already linked */
|
||||||
if (DosUmbLinked) return FALSE;
|
if (DosUmbLinked) return FALSE;
|
||||||
|
|
||||||
|
@ -477,6 +503,8 @@ BOOLEAN DosUnlinkUmb(VOID)
|
||||||
DWORD Segment = FIRST_MCB_SEGMENT;
|
DWORD Segment = FIRST_MCB_SEGMENT;
|
||||||
PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment);
|
PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment);
|
||||||
|
|
||||||
|
DPRINT("Unlinking UMB\n");
|
||||||
|
|
||||||
/* Check if UMBs are already unlinked */
|
/* Check if UMBs are already unlinked */
|
||||||
if (!DosUmbLinked) return FALSE;
|
if (!DosUmbLinked) return FALSE;
|
||||||
|
|
||||||
|
@ -506,6 +534,10 @@ WORD DosCreateFile(LPWORD Handle, LPCSTR FilePath, WORD Attributes)
|
||||||
HANDLE FileHandle;
|
HANDLE FileHandle;
|
||||||
WORD DosHandle;
|
WORD DosHandle;
|
||||||
|
|
||||||
|
DPRINT("DosCreateFile: FilePath \"%s\", Attributes 0x%04X\n",
|
||||||
|
FilePath,
|
||||||
|
Attributes);
|
||||||
|
|
||||||
/* Create the file */
|
/* Create the file */
|
||||||
FileHandle = CreateFileA(FilePath,
|
FileHandle = CreateFileA(FilePath,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
|
@ -544,6 +576,10 @@ WORD DosOpenFile(LPWORD Handle, LPCSTR FilePath, BYTE AccessMode)
|
||||||
ACCESS_MASK Access = 0;
|
ACCESS_MASK Access = 0;
|
||||||
WORD DosHandle;
|
WORD DosHandle;
|
||||||
|
|
||||||
|
DPRINT("DosOpenFile: FilePath \"%s\", AccessMode 0x%04X\n",
|
||||||
|
FilePath,
|
||||||
|
AccessMode);
|
||||||
|
|
||||||
/* Parse the access mode */
|
/* Parse the access mode */
|
||||||
switch (AccessMode & 3)
|
switch (AccessMode & 3)
|
||||||
{
|
{
|
||||||
|
@ -613,8 +649,10 @@ WORD DosReadFile(WORD FileHandle, LPVOID Buffer, WORD Count, LPWORD BytesRead)
|
||||||
DWORD BytesRead32 = 0;
|
DWORD BytesRead32 = 0;
|
||||||
HANDLE Handle = DosGetRealHandle(FileHandle);
|
HANDLE Handle = DosGetRealHandle(FileHandle);
|
||||||
|
|
||||||
|
DPRINT("DosReadFile: FileHandle 0x%04X, Count 0x%04X\n", FileHandle, Count);
|
||||||
|
|
||||||
/* Make sure the handle is valid */
|
/* Make sure the handle is valid */
|
||||||
if (Handle == INVALID_HANDLE_VALUE) return ERROR_INVALID_PARAMETER;
|
if (Handle == INVALID_HANDLE_VALUE) return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
/* Read the file */
|
/* Read the file */
|
||||||
if (!ReadFile(Handle, Buffer, Count, &BytesRead32, NULL))
|
if (!ReadFile(Handle, Buffer, Count, &BytesRead32, NULL))
|
||||||
|
@ -636,8 +674,12 @@ WORD DosWriteFile(WORD FileHandle, LPVOID Buffer, WORD Count, LPWORD BytesWritte
|
||||||
DWORD BytesWritten32 = 0;
|
DWORD BytesWritten32 = 0;
|
||||||
HANDLE Handle = DosGetRealHandle(FileHandle);
|
HANDLE Handle = DosGetRealHandle(FileHandle);
|
||||||
|
|
||||||
|
DPRINT("DosWriteFile: FileHandle 0x%04X, Count 0x%04X\n",
|
||||||
|
FileHandle,
|
||||||
|
Count);
|
||||||
|
|
||||||
/* Make sure the handle is valid */
|
/* Make sure the handle is valid */
|
||||||
if (Handle == INVALID_HANDLE_VALUE) return ERROR_INVALID_PARAMETER;
|
if (Handle == INVALID_HANDLE_VALUE) return ERROR_INVALID_HANDLE;
|
||||||
|
|
||||||
/* Write the file */
|
/* Write the file */
|
||||||
if (!WriteFile(Handle, Buffer, Count, &BytesWritten32, NULL))
|
if (!WriteFile(Handle, Buffer, Count, &BytesWritten32, NULL))
|
||||||
|
@ -659,6 +701,8 @@ BOOLEAN DosCloseHandle(WORD DosHandle)
|
||||||
PDOS_PSP PspBlock;
|
PDOS_PSP PspBlock;
|
||||||
LPBYTE HandleTable;
|
LPBYTE HandleTable;
|
||||||
|
|
||||||
|
DPRINT("DosCloseHandle: DosHandle 0x%04X\n", DosHandle);
|
||||||
|
|
||||||
/* The system PSP has no handle table */
|
/* The system PSP has no handle table */
|
||||||
if (CurrentPsp == SYSTEM_PSP) return FALSE;
|
if (CurrentPsp == SYSTEM_PSP) return FALSE;
|
||||||
|
|
||||||
|
@ -747,6 +791,10 @@ BOOLEAN DosCreateProcess(LPCSTR CommandLine, WORD EnvBlock)
|
||||||
PDWORD RelocationTable;
|
PDWORD RelocationTable;
|
||||||
PWORD RelocWord;
|
PWORD RelocWord;
|
||||||
|
|
||||||
|
DPRINT("DosCreateProcess: CommandLine \"%s\", EnvBlock 0x%04X\n",
|
||||||
|
CommandLine,
|
||||||
|
EnvBlock);
|
||||||
|
|
||||||
/* Save a copy of the command line */
|
/* Save a copy of the command line */
|
||||||
strcpy(CommandLineCopy, CommandLine);
|
strcpy(CommandLineCopy, CommandLine);
|
||||||
|
|
||||||
|
@ -950,6 +998,10 @@ VOID DosTerminateProcess(WORD Psp, BYTE ReturnCode)
|
||||||
LPDWORD IntVecTable = (LPDWORD)((ULONG_PTR)BaseAddress);
|
LPDWORD IntVecTable = (LPDWORD)((ULONG_PTR)BaseAddress);
|
||||||
PDOS_PSP PspBlock = SEGMENT_TO_PSP(Psp);
|
PDOS_PSP PspBlock = SEGMENT_TO_PSP(Psp);
|
||||||
|
|
||||||
|
DPRINT("DosTerminateProcess: Psp 0x%04X, ReturnCode 0x%02X\n",
|
||||||
|
Psp,
|
||||||
|
ReturnCode);
|
||||||
|
|
||||||
/* Check if this PSP is it's own parent */
|
/* Check if this PSP is it's own parent */
|
||||||
if (PspBlock->ParentPsp == Psp) goto Done;
|
if (PspBlock->ParentPsp == Psp) goto Done;
|
||||||
|
|
||||||
|
@ -1416,7 +1468,7 @@ VOID DosInt21h(WORD CodeSegment)
|
||||||
|
|
||||||
/* Return the error code in AX */
|
/* Return the error code in AX */
|
||||||
EmulatorSetRegister(EMULATOR_REG_AX,
|
EmulatorSetRegister(EMULATOR_REG_AX,
|
||||||
(Eax & 0xFFFF0000) | ERROR_INVALID_PARAMETER);
|
(Eax & 0xFFFF0000) | ERROR_INVALID_HANDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
#include "dos.h"
|
#include "dos.h"
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
#include "ntvdm.h"
|
#include "ntvdm.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
#include "bios.h"
|
#include "bios.h"
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define NDEBUG
|
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* DEFINES ********************************************************************/
|
/* DEFINES ********************************************************************/
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
#include "pic.h"
|
#include "pic.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
#include "ps2.h"
|
#include "ps2.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
#include "pic.h"
|
#include "pic.h"
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
/* INCLUDES *******************************************************************/
|
/* INCLUDES *******************************************************************/
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "pic.h"
|
#include "pic.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue