Author: aandrejevic
Date: Mon Jul 22 13:51:26 2013
New Revision: 59555
URL:
http://svn.reactos.org/svn/reactos?rev=59555&view=rev
Log:
[NTVDM]
Add debug output.
Modified:
branches/ntvdm/subsystems/ntvdm/bios.c
branches/ntvdm/subsystems/ntvdm/dos.c
branches/ntvdm/subsystems/ntvdm/emulator.c
branches/ntvdm/subsystems/ntvdm/ntvdm.c
branches/ntvdm/subsystems/ntvdm/ntvdm.h
branches/ntvdm/subsystems/ntvdm/pic.c
branches/ntvdm/subsystems/ntvdm/ps2.c
branches/ntvdm/subsystems/ntvdm/timer.c
Modified: branches/ntvdm/subsystems/ntvdm/bios.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?r…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Mon Jul 22 13:51:26 2013
@@ -7,6 +7,8 @@
*/
/* INCLUDES *******************************************************************/
+
+#define NDEBUG
#include "bios.h"
#include "emulator.h"
Modified: branches/ntvdm/subsystems/ntvdm/dos.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Mon Jul 22 13:51:26 2013
@@ -8,6 +8,8 @@
/* INCLUDES *******************************************************************/
+#define NDEBUG
+
#include "dos.h"
#include "bios.h"
#include "emulator.h"
@@ -349,11 +351,15 @@
WORD Segment = BlockData - 1, ReturnSize = 0, NextSegment;
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 */
if ((Mcb->BlockType != 'M' && Mcb->BlockType != 'Z') ||
Mcb->OwnerPsp == 0)
{
Success = FALSE;
- DosLastError = ERROR_INVALID_PARAMETER;
+ DosLastError = ERROR_INVALID_HANDLE;
goto Done;
}
@@ -376,6 +382,7 @@
/* Make sure the next segment is free */
if (NextMcb->OwnerPsp != 0)
{
+ DPRINT("Cannot expand memory block: next segment is not free!\n");
DosLastError = ERROR_NOT_ENOUGH_MEMORY;
Success = FALSE;
goto Done;
@@ -397,6 +404,10 @@
/* Check if the block is larger than requested */
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 */
NextMcb = SEGMENT_TO_MCB(Segment + NewSize + 1);
@@ -412,6 +423,10 @@
}
else if (NewSize < Mcb->Size)
{
+ DPRINT("Shrinking block from 0x%04X to 0x%04X\n",
+ Mcb->Size,
+ NewSize);
+
/* Just split the block */
NextMcb = SEGMENT_TO_MCB(Segment + NewSize + 1);
NextMcb->BlockType = Mcb->BlockType;
@@ -427,6 +442,9 @@
/* Check if the operation failed */
if (!Success)
{
+ DPRINT("DosResizeMemory FAILED. Maximum available: 0x%04X\n",
+ ReturnSize);
+
/* Return the maximum possible size */
if (MaxAvailable) *MaxAvailable = ReturnSize;
}
@@ -438,8 +456,14 @@
{
PDOS_MCB Mcb = SEGMENT_TO_MCB(BlockData - 1);
+ DPRINT("DosFreeMemory: BlockData 0x%04X\n", BlockData);
+
/* 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 */
Mcb->OwnerPsp = 0;
@@ -452,6 +476,8 @@
DWORD Segment = FIRST_MCB_SEGMENT;
PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment);
+ DPRINT("Linking UMB\n");
+
/* Check if UMBs are already linked */
if (DosUmbLinked) return FALSE;
@@ -476,6 +502,8 @@
{
DWORD Segment = FIRST_MCB_SEGMENT;
PDOS_MCB Mcb = SEGMENT_TO_MCB(Segment);
+
+ DPRINT("Unlinking UMB\n");
/* Check if UMBs are already unlinked */
if (!DosUmbLinked) return FALSE;
@@ -505,6 +533,10 @@
{
HANDLE FileHandle;
WORD DosHandle;
+
+ DPRINT("DosCreateFile: FilePath \"%s\", Attributes 0x%04X\n",
+ FilePath,
+ Attributes);
/* Create the file */
FileHandle = CreateFileA(FilePath,
@@ -544,6 +576,10 @@
ACCESS_MASK Access = 0;
WORD DosHandle;
+ DPRINT("DosOpenFile: FilePath \"%s\", AccessMode 0x%04X\n",
+ FilePath,
+ AccessMode);
+
/* Parse the access mode */
switch (AccessMode & 3)
{
@@ -613,8 +649,10 @@
DWORD BytesRead32 = 0;
HANDLE Handle = DosGetRealHandle(FileHandle);
+ DPRINT("DosReadFile: FileHandle 0x%04X, Count 0x%04X\n", FileHandle,
Count);
+
/* 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 */
if (!ReadFile(Handle, Buffer, Count, &BytesRead32, NULL))
@@ -636,8 +674,12 @@
DWORD BytesWritten32 = 0;
HANDLE Handle = DosGetRealHandle(FileHandle);
+ DPRINT("DosWriteFile: FileHandle 0x%04X, Count 0x%04X\n",
+ FileHandle,
+ Count);
+
/* 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 */
if (!WriteFile(Handle, Buffer, Count, &BytesWritten32, NULL))
@@ -658,6 +700,8 @@
BYTE SftIndex;
PDOS_PSP PspBlock;
LPBYTE HandleTable;
+
+ DPRINT("DosCloseHandle: DosHandle 0x%04X\n", DosHandle);
/* The system PSP has no handle table */
if (CurrentPsp == SYSTEM_PSP) return FALSE;
@@ -747,6 +791,10 @@
PDWORD RelocationTable;
PWORD RelocWord;
+ DPRINT("DosCreateProcess: CommandLine \"%s\", EnvBlock
0x%04X\n",
+ CommandLine,
+ EnvBlock);
+
/* Save a copy of the command line */
strcpy(CommandLineCopy, CommandLine);
@@ -949,6 +997,10 @@
PDOS_MCB CurrentMcb;
LPDWORD IntVecTable = (LPDWORD)((ULONG_PTR)BaseAddress);
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 */
if (PspBlock->ParentPsp == Psp) goto Done;
@@ -1416,7 +1468,7 @@
/* Return the error code in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
- (Eax & 0xFFFF0000) | ERROR_INVALID_PARAMETER);
+ (Eax & 0xFFFF0000) | ERROR_INVALID_HANDLE);
}
break;
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] Mon Jul 22 13:51:26 2013
@@ -8,6 +8,8 @@
/* INCLUDES *******************************************************************/
+#define NDEBUG
+
#include "emulator.h"
#include "bios.h"
#include "dos.h"
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Mon Jul 22 13:51:26 2013
@@ -7,6 +7,8 @@
*/
/* INCLUDES *******************************************************************/
+
+#define NDEBUG
#include "ntvdm.h"
#include "emulator.h"
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.h?…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] Mon Jul 22 13:51:26 2013
@@ -16,8 +16,6 @@
#include <stdio.h>
#include <conio.h>
#include <stdarg.h>
-
-#define NDEBUG
#include <debug.h>
/* DEFINES ********************************************************************/
Modified: branches/ntvdm/subsystems/ntvdm/pic.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/pic.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/pic.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/pic.c [iso-8859-1] Mon Jul 22 13:51:26 2013
@@ -8,6 +8,8 @@
/* INCLUDES *******************************************************************/
+#define NDEBUG
+
#include "pic.h"
#include "emulator.h"
Modified: branches/ntvdm/subsystems/ntvdm/ps2.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ps2.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] Mon Jul 22 13:51:26 2013
@@ -7,6 +7,8 @@
*/
/* INCLUDES *******************************************************************/
+
+#define NDEBUG
#include "ps2.h"
#include "emulator.h"
Modified: branches/ntvdm/subsystems/ntvdm/timer.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/timer.c?…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/timer.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/timer.c [iso-8859-1] Mon Jul 22 13:51:26 2013
@@ -8,6 +8,8 @@
/* INCLUDES *******************************************************************/
+#define NDEBUG
+
#include "timer.h"
#include "pic.h"