2001-07-06 22:05:05 +00:00
|
|
|
/*
|
|
|
|
* FreeLoader
|
2002-01-19 00:37:06 +00:00
|
|
|
* Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
|
2001-07-06 22:05:05 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
2001-11-28 10:26:53 +00:00
|
|
|
#include <freeldr.h>
|
|
|
|
#include <debug.h>
|
|
|
|
#include <rtl.h>
|
|
|
|
#include <comm.h>
|
2001-08-07 06:19:43 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-07-06 22:05:05 +00:00
|
|
|
|
2002-11-24 19:10:06 +00:00
|
|
|
#define DEBUG_ALL
|
2002-06-11 16:23:20 +00:00
|
|
|
//#define DEBUG_INIFILE
|
|
|
|
//#define DEBUG_REACTOS
|
2002-09-06 22:38:10 +00:00
|
|
|
//#define DEBUG_CUSTOM
|
|
|
|
#define DEBUG_NONE
|
2002-06-11 16:23:20 +00:00
|
|
|
|
2002-11-24 19:10:06 +00:00
|
|
|
#if defined (DEBUG_ALL)
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
U32 DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
|
2002-07-22 03:44:08 +00:00
|
|
|
DPRINT_UI | DPRINT_DISK | DPRINT_CACHE | DPRINT_REACTOS |
|
|
|
|
DPRINT_LINUX;
|
|
|
|
#elif defined (DEBUG_INIFILE)
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
U32 DebugPrintMask = DPRINT_INIFILE;
|
2002-07-22 03:44:08 +00:00
|
|
|
#elif defined (DEBUG_REACTOS)
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
U32 DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
|
2002-07-22 03:44:08 +00:00
|
|
|
#elif defined (DEBUG_CUSTOM)
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
U32 DebugPrintMask = DPRINT_WARNING|DPRINT_FILESYSTEM;
|
2002-07-22 03:44:08 +00:00
|
|
|
#else //#elif defined (DEBUG_NONE)
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
U32 DebugPrintMask = 0;
|
2002-06-11 16:23:20 +00:00
|
|
|
#endif
|
2001-07-06 22:05:05 +00:00
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
#define SCREEN 0
|
|
|
|
#define RS232 1
|
|
|
|
#define BOCHS 2
|
2001-08-07 06:19:43 +00:00
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
#define COM1 1
|
|
|
|
#define COM2 2
|
|
|
|
#define COM3 3
|
|
|
|
#define COM4 4
|
2001-08-07 06:19:43 +00:00
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
#define BOCHS_OUTPUT_PORT 0xe9
|
|
|
|
|
2002-11-24 19:10:06 +00:00
|
|
|
U32 DebugPort = RS232;
|
|
|
|
//U32 DebugPort = SCREEN;
|
2002-09-06 22:38:10 +00:00
|
|
|
//U32 DebugPort = BOCHS;
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
U32 ComPort = COM1;
|
|
|
|
//U32 BaudRate = 19200;
|
|
|
|
U32 BaudRate = 115200;
|
2001-08-07 06:19:43 +00:00
|
|
|
|
2002-01-18 05:59:58 +00:00
|
|
|
BOOL DebugStartOfLine = TRUE;
|
|
|
|
|
2001-08-07 06:19:43 +00:00
|
|
|
VOID DebugInit(VOID)
|
|
|
|
{
|
|
|
|
if (DebugPort == RS232)
|
|
|
|
{
|
|
|
|
Rs232PortInitialize(ComPort, BaudRate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
VOID DebugPrintChar(UCHAR Character)
|
|
|
|
{
|
2002-01-18 05:59:58 +00:00
|
|
|
if (Character == '\n')
|
|
|
|
{
|
|
|
|
DebugStartOfLine = TRUE;
|
|
|
|
}
|
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
if (DebugPort == RS232)
|
|
|
|
{
|
|
|
|
if (Character == '\n')
|
|
|
|
{
|
|
|
|
Rs232PortPutByte('\r');
|
|
|
|
}
|
2002-03-12 19:55:08 +00:00
|
|
|
Rs232PortPutByte(Character);
|
2001-11-15 07:48:33 +00:00
|
|
|
}
|
|
|
|
else if (DebugPort == BOCHS)
|
|
|
|
{
|
|
|
|
WRITE_PORT_UCHAR((PUCHAR)BOCHS_OUTPUT_PORT, Character);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
putchar(Character);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
VOID DebugPrintHeader(U32 Mask)
|
2002-01-18 05:59:58 +00:00
|
|
|
{
|
2002-06-11 16:23:20 +00:00
|
|
|
/* No header */
|
|
|
|
if (Mask == 0)
|
|
|
|
return;
|
|
|
|
|
2002-01-18 05:59:58 +00:00
|
|
|
switch (Mask)
|
|
|
|
{
|
|
|
|
case DPRINT_WARNING:
|
|
|
|
DebugPrintChar('W');
|
|
|
|
DebugPrintChar('A');
|
|
|
|
DebugPrintChar('R');
|
|
|
|
DebugPrintChar('N');
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar('N');
|
|
|
|
DebugPrintChar('G');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
|
|
|
case DPRINT_MEMORY:
|
|
|
|
DebugPrintChar('M');
|
|
|
|
DebugPrintChar('E');
|
|
|
|
DebugPrintChar('M');
|
|
|
|
DebugPrintChar('O');
|
|
|
|
DebugPrintChar('R');
|
|
|
|
DebugPrintChar('Y');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
|
|
|
case DPRINT_FILESYSTEM:
|
|
|
|
DebugPrintChar('F');
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar('L');
|
|
|
|
DebugPrintChar('E');
|
|
|
|
DebugPrintChar('S');
|
|
|
|
DebugPrintChar('Y');
|
|
|
|
DebugPrintChar('S');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
|
|
|
case DPRINT_INIFILE:
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar('N');
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar('F');
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar('L');
|
|
|
|
DebugPrintChar('E');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
|
|
|
case DPRINT_UI:
|
|
|
|
DebugPrintChar('U');
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
|
|
|
case DPRINT_DISK:
|
|
|
|
DebugPrintChar('D');
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar('S');
|
|
|
|
DebugPrintChar('K');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
|
|
|
case DPRINT_CACHE:
|
|
|
|
DebugPrintChar('C');
|
|
|
|
DebugPrintChar('A');
|
|
|
|
DebugPrintChar('C');
|
|
|
|
DebugPrintChar('H');
|
|
|
|
DebugPrintChar('E');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
2002-06-11 16:23:20 +00:00
|
|
|
case DPRINT_REGISTRY:
|
|
|
|
DebugPrintChar('R');
|
|
|
|
DebugPrintChar('E');
|
|
|
|
DebugPrintChar('G');
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar('S');
|
|
|
|
DebugPrintChar('T');
|
|
|
|
DebugPrintChar('R');
|
|
|
|
DebugPrintChar('Y');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
2002-04-25 02:48:15 +00:00
|
|
|
case DPRINT_REACTOS:
|
|
|
|
DebugPrintChar('R');
|
|
|
|
DebugPrintChar('E');
|
|
|
|
DebugPrintChar('A');
|
|
|
|
DebugPrintChar('C');
|
|
|
|
DebugPrintChar('T');
|
|
|
|
DebugPrintChar('O');
|
|
|
|
DebugPrintChar('S');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
|
|
|
case DPRINT_LINUX:
|
|
|
|
DebugPrintChar('L');
|
|
|
|
DebugPrintChar('I');
|
|
|
|
DebugPrintChar('N');
|
|
|
|
DebugPrintChar('U');
|
|
|
|
DebugPrintChar('X');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
2002-01-18 05:59:58 +00:00
|
|
|
default:
|
|
|
|
DebugPrintChar('U');
|
|
|
|
DebugPrintChar('N');
|
|
|
|
DebugPrintChar('K');
|
|
|
|
DebugPrintChar('N');
|
|
|
|
DebugPrintChar('O');
|
|
|
|
DebugPrintChar('W');
|
|
|
|
DebugPrintChar('N');
|
|
|
|
DebugPrintChar(':');
|
|
|
|
DebugPrintChar(' ');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
VOID DebugPrint(U32 Mask, char *format, ...)
|
2001-07-06 22:05:05 +00:00
|
|
|
{
|
|
|
|
int *dataptr = (int *) &format;
|
|
|
|
char c, *ptr, str[16];
|
|
|
|
|
|
|
|
// Mask out unwanted debug messages
|
|
|
|
if (!(Mask & DebugPrintMask))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-01-18 05:59:58 +00:00
|
|
|
// Print the header if we have started a new line
|
|
|
|
if (DebugStartOfLine)
|
|
|
|
{
|
|
|
|
DebugPrintHeader(Mask);
|
|
|
|
DebugStartOfLine = FALSE;
|
|
|
|
}
|
|
|
|
|
2001-07-06 22:05:05 +00:00
|
|
|
dataptr++;
|
|
|
|
|
|
|
|
while ((c = *(format++)))
|
|
|
|
{
|
2001-11-15 07:48:33 +00:00
|
|
|
if (c != '%')
|
2001-07-06 22:05:05 +00:00
|
|
|
{
|
2001-11-15 07:48:33 +00:00
|
|
|
DebugPrintChar(c);
|
2001-07-06 22:05:05 +00:00
|
|
|
}
|
2001-11-15 07:48:33 +00:00
|
|
|
else
|
|
|
|
{
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
switch (c = *(format++))
|
2001-11-15 07:48:33 +00:00
|
|
|
{
|
|
|
|
case 'd': case 'u': case 'x':
|
|
|
|
|
|
|
|
*convert_to_ascii(str, c, *((unsigned long *) dataptr++)) = 0;
|
2001-07-06 22:05:05 +00:00
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
ptr = str;
|
2001-07-06 22:05:05 +00:00
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
while (*ptr)
|
|
|
|
{
|
|
|
|
DebugPrintChar(*(ptr++));
|
|
|
|
}
|
|
|
|
break;
|
2001-07-06 22:05:05 +00:00
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
case 'c':
|
2001-07-06 22:05:05 +00:00
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
DebugPrintChar((*(dataptr++))&0xff);
|
|
|
|
break;
|
2001-07-06 22:05:05 +00:00
|
|
|
|
2001-11-15 07:48:33 +00:00
|
|
|
case 's':
|
|
|
|
|
|
|
|
ptr = (char *)(*(dataptr++));
|
|
|
|
|
|
|
|
while ((c = *(ptr++)))
|
|
|
|
{
|
|
|
|
DebugPrintChar(c);
|
|
|
|
}
|
|
|
|
break;
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
case '%':
|
|
|
|
DebugPrintChar(c);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
DebugPrint(Mask, "\nDebugPrint() invalid format specifier - %%%c\n", c);
|
|
|
|
break;
|
2001-08-07 06:19:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-11-15 07:48:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (DebugPort == SCREEN)
|
2001-08-07 06:19:43 +00:00
|
|
|
{
|
2001-11-15 07:48:33 +00:00
|
|
|
//getch();
|
2001-08-07 06:19:43 +00:00
|
|
|
}
|
2001-11-15 07:48:33 +00:00
|
|
|
|
2001-07-06 22:05:05 +00:00
|
|
|
}
|
2001-08-07 06:19:43 +00:00
|
|
|
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
VOID DebugDumpBuffer(U32 Mask, PVOID Buffer, U32 Length)
|
2002-04-25 02:48:15 +00:00
|
|
|
{
|
|
|
|
PUCHAR BufPtr = (PUCHAR)Buffer;
|
Changes in v1.7 (8/6/2002) (brianp)
- EXT2/EXT3 file system support.
- Does not yet support symbolic links or booting from an EXT2/3 partition.
- Fixed bug in UI code.
- Added '%%' format specifier to printf()-like functions.
- Added functions __udivdi3 & __umoddi3 so that 64-bit division is now supported.
- Changed types BYTE, WORD, DWORD, LONG, ULONG to U8, U16, U32, S32, U32
so that you know the size of the variable across different
architectures with different sized words & dwords, etc.
- Types CHAR, UCHAR, PCHAR, PUCHAR, WCHAR, PWCHAR have not been
changed yet (I haven't decided exactly how I'm going to handle unicode)
(isn't this an awesome commit? ;-) Just look at that list of files)
svn path=/trunk/; revision=3318
2002-08-07 05:13:18 +00:00
|
|
|
U32 Idx;
|
|
|
|
U32 Idx2;
|
2002-04-25 02:48:15 +00:00
|
|
|
|
|
|
|
// Mask out unwanted debug messages
|
|
|
|
if (!(Mask & DebugPrintMask))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DebugStartOfLine = FALSE; // We don't want line headers
|
|
|
|
DebugPrint(Mask, "Dumping buffer at 0x%x with length of %d bytes:\n", Buffer, Length);
|
|
|
|
|
|
|
|
for (Idx=0; Idx<Length; )
|
|
|
|
{
|
|
|
|
DebugStartOfLine = FALSE; // We don't want line headers
|
|
|
|
|
|
|
|
if (Idx < 0x0010)
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, "000%x:\t", Idx);
|
|
|
|
}
|
|
|
|
else if (Idx < 0x0100)
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, "00%x:\t", Idx);
|
|
|
|
}
|
|
|
|
else if (Idx < 0x1000)
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, "0%x:\t", Idx);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, "%x:\t", Idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Idx2=0; Idx2<16; Idx2++,Idx++)
|
|
|
|
{
|
|
|
|
if (BufPtr[Idx] < 0x10)
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, "0");
|
|
|
|
}
|
|
|
|
DebugPrint(Mask, "%x", BufPtr[Idx]);
|
|
|
|
|
|
|
|
if (Idx2 == 7)
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, "-");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, " ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Idx -= 16;
|
|
|
|
DebugPrint(Mask, " ");
|
|
|
|
|
|
|
|
for (Idx2=0; Idx2<16; Idx2++,Idx++)
|
|
|
|
{
|
|
|
|
if ((BufPtr[Idx] > 20) && (BufPtr[Idx] < 0x80))
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, "%c", BufPtr[Idx]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DebugPrint(Mask, ".");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DebugPrint(Mask, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-08-07 06:19:43 +00:00
|
|
|
#endif // defined DEBUG
|