mirror of
https://github.com/reactos/reactos.git
synced 2025-05-08 19:27:00 +00:00
Improved debug output and
added hal READ_XXX and WRITE_XXX functions. svn path=/trunk/; revision=716
This commit is contained in:
parent
d2e85caa9e
commit
7228dc135c
5 changed files with 110 additions and 117 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: print.c,v 1.2 1999/10/16 21:08:23 ekohl Exp $
|
/* $Id: print.c,v 1.3 1999/10/21 11:13:04 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -14,7 +14,6 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <internal/hal/ddk.h>
|
#include <internal/hal/ddk.h>
|
||||||
#include <internal/ntoskrnl.h>
|
#include <internal/ntoskrnl.h>
|
||||||
#include <internal/halio.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -43,42 +42,11 @@
|
||||||
/* #define SERIAL_DEBUG_PORT 0x02f8 */ /* COM 2 */
|
/* #define SERIAL_DEBUG_PORT 0x02f8 */ /* COM 2 */
|
||||||
#define SERIAL_DEBUG_BAUD_RATE 19200
|
#define SERIAL_DEBUG_BAUD_RATE 19200
|
||||||
|
|
||||||
#define SERIAL_LINE_CONTROL (SR_LCR_CS8 | SR_LCR_ST1 | SR_LCR_PNO)
|
|
||||||
|
|
||||||
#ifdef BOCHS_DEBUGGING
|
#ifdef BOCHS_DEBUGGING
|
||||||
#define BOCHS_LOGGER_PORT (0x3ed)
|
#define BOCHS_LOGGER_PORT (0x3ed)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERIAL_DEBUGGING
|
|
||||||
#define SER_RBR SERIAL_DEBUG_PORT + 0
|
|
||||||
#define SER_THR SERIAL_DEBUG_PORT + 0
|
|
||||||
#define SER_DLL SERIAL_DEBUG_PORT + 0
|
|
||||||
#define SER_IER SERIAL_DEBUG_PORT + 1
|
|
||||||
#define SER_DLM SERIAL_DEBUG_PORT + 1
|
|
||||||
#define SER_IIR SERIAL_DEBUG_PORT + 2
|
|
||||||
#define SER_LCR SERIAL_DEBUG_PORT + 3
|
|
||||||
#define SR_LCR_CS5 0x00
|
|
||||||
#define SR_LCR_CS6 0x01
|
|
||||||
#define SR_LCR_CS7 0x02
|
|
||||||
#define SR_LCR_CS8 0x03
|
|
||||||
#define SR_LCR_ST1 0x00
|
|
||||||
#define SR_LCR_ST2 0x04
|
|
||||||
#define SR_LCR_PNO 0x00
|
|
||||||
#define SR_LCR_POD 0x08
|
|
||||||
#define SR_LCR_PEV 0x18
|
|
||||||
#define SR_LCR_PMK 0x28
|
|
||||||
#define SR_LCR_PSP 0x38
|
|
||||||
#define SR_LCR_BRK 0x40
|
|
||||||
#define SR_LCR_DLAB 0x80
|
|
||||||
#define SER_MCR SERIAL_DEBUG_PORT + 4
|
|
||||||
#define SR_MCR_DTR 0x01
|
|
||||||
#define SR_MCR_RTS 0x02
|
|
||||||
#define SER_LSR SERIAL_DEBUG_PORT + 5
|
|
||||||
#define SR_LSR_TBE 0x20
|
|
||||||
#define SER_MSR SERIAL_DEBUG_PORT + 6
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
@ -86,26 +54,19 @@
|
||||||
static VOID
|
static VOID
|
||||||
DbgDisplaySerialString(PCH String)
|
DbgDisplaySerialString(PCH String)
|
||||||
{
|
{
|
||||||
PCH pch = String;
|
PCH pch = String;
|
||||||
|
|
||||||
while (*pch != 0)
|
while (*pch != 0)
|
||||||
{
|
{
|
||||||
|
if (*pch == '\n')
|
||||||
|
{
|
||||||
|
KdPortPutByte ('\r');
|
||||||
|
}
|
||||||
|
|
||||||
while ((inb_p(SER_LSR) & SR_LSR_TBE) == 0)
|
KdPortPutByte (*pch);
|
||||||
;
|
|
||||||
|
|
||||||
outb_p(SER_THR, *pch);
|
pch++;
|
||||||
|
}
|
||||||
if (*pch == '\n')
|
|
||||||
{
|
|
||||||
while ((inb_p(SER_LSR) & SR_LSR_TBE) == 0)
|
|
||||||
;
|
|
||||||
|
|
||||||
outb_p(SER_THR, '\r');
|
|
||||||
}
|
|
||||||
|
|
||||||
pch++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* SERIAL_DEBUGGING */
|
#endif /* SERIAL_DEBUGGING */
|
||||||
|
|
||||||
|
@ -114,35 +75,35 @@ DbgDisplaySerialString(PCH String)
|
||||||
static VOID
|
static VOID
|
||||||
DbgDisplayBochsString(PCH String)
|
DbgDisplayBochsString(PCH String)
|
||||||
{
|
{
|
||||||
PCH pch = String;
|
PCH pch = String;
|
||||||
|
|
||||||
while (*pch != 0)
|
while (*pch != 0)
|
||||||
{
|
{
|
||||||
outb_p(BOCHS_LOGGER_PORT, *pch);
|
if (*pch == '\n')
|
||||||
|
{
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r');
|
||||||
|
}
|
||||||
|
|
||||||
if (*pch == '\n')
|
WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, *pch);
|
||||||
{
|
|
||||||
outb_p(BOCHS_LOGGER_PORT, '\r');
|
|
||||||
}
|
|
||||||
|
|
||||||
pch++;
|
pch++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* BOCHS_DEBUGGING */
|
#endif /* BOCHS_DEBUGGING */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
DbgInit (VOID)
|
DbgInit (VOID)
|
||||||
{
|
{
|
||||||
#ifdef SERIAL_DEBUGGING
|
#ifdef SERIAL_DEBUGGING
|
||||||
/* turn on DTR and RTS */
|
KD_PORT_INFORMATION PortInfo;
|
||||||
outb_p(SER_MCR, SR_MCR_DTR | SR_MCR_RTS);
|
|
||||||
/* set baud rate, line control */
|
PortInfo.BaseAddress = SERIAL_DEBUG_PORT;
|
||||||
outb_p(SER_LCR, SERIAL_LINE_CONTROL | SR_LCR_DLAB);
|
PortInfo.BaudRate = SERIAL_DEBUG_BAUD_RATE;
|
||||||
outb_p(SER_DLL, (115200 / SERIAL_DEBUG_BAUD_RATE) & 0xff);
|
|
||||||
outb_p(SER_DLM, ((115200 / SERIAL_DEBUG_BAUD_RATE) >> 8) & 0xff);
|
KdPortInitialize (&PortInfo,
|
||||||
outb_p(SER_LCR, SERIAL_LINE_CONTROL);
|
0,
|
||||||
|
0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
/* $Id: kdebug.c,v 1.1 1999/08/20 16:28:10 ea Exp $
|
/* $Id: kdebug.c,v 1.2 1999/10/21 11:13:38 ekohl Exp $
|
||||||
*
|
*
|
||||||
* reactos/ntoskrnl/kd/kdebug.c
|
* reactos/ntoskrnl/kd/kdebug.c
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <ntos.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
BYTE STDCALL KdPortPollByte(VOID);
|
|
||||||
|
//BYTE STDCALL KdPortPollByte(VOID);
|
||||||
|
|
||||||
/* DATA */
|
/* DATA */
|
||||||
|
|
||||||
|
@ -15,11 +16,37 @@ KdDebuggerEnabled = FALSE;
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
KdDebuggerNotPresent = TRUE;
|
KdDebuggerNotPresent = TRUE;
|
||||||
|
|
||||||
BOOLEAN
|
/* This is exported by hal.dll (Eric Kohl) */
|
||||||
KdComPortInUse = FALSE;
|
//ULONG
|
||||||
|
//KdComPortInUse = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* PRIVATE FUNCTIONS ********************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KdInit (VOID)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* FIXME: parse kernel command line */
|
||||||
|
|
||||||
|
/* initialize debug port */
|
||||||
|
#ifdef SERIAL_DEBUGGING
|
||||||
|
KD_PORT_INFORMATION PortInfo;
|
||||||
|
|
||||||
|
PortInfo.BaseAddress = SERIAL_DEBUG_PORT;
|
||||||
|
PortInfo.BaudRate = SERIAL_DEBUG_BAUD_RATE;
|
||||||
|
|
||||||
|
KdPortInitialize (&PortInfo,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* PUBLIC FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
/* NTOSKRNL.KdPollBreakIn */
|
/* NTOSKRNL.KdPollBreakIn */
|
||||||
|
/*
|
||||||
BYTE
|
BYTE
|
||||||
STDCALL
|
STDCALL
|
||||||
KdPollBreakIn (
|
KdPollBreakIn (
|
||||||
|
@ -28,7 +55,7 @@ KdPollBreakIn (
|
||||||
{
|
{
|
||||||
return KdPortPollByte();
|
return KdPortPollByte();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: makefile_rex,v 1.32 1999/10/16 00:17:40 ekohl Exp $
|
# $Id: makefile_rex,v 1.33 1999/10/21 11:10:26 ekohl Exp $
|
||||||
#
|
#
|
||||||
# ReactOS Operating System
|
# ReactOS Operating System
|
||||||
#
|
#
|
||||||
|
@ -61,9 +61,11 @@ LDR_OBJECTS = ldr/loader.o ldr/init.o ldr/syspath.o
|
||||||
|
|
||||||
CC_OBJECTS = cc/cacheman.o cc/view.o
|
CC_OBJECTS = cc/cacheman.o cc/view.o
|
||||||
|
|
||||||
|
KD_OBJECTS = kd/kdebug.o
|
||||||
|
|
||||||
RESOURCE_OBJECT = $(TARGET).coff
|
RESOURCE_OBJECT = $(TARGET).coff
|
||||||
|
|
||||||
objects:
|
objects:
|
||||||
mkdir objects
|
mkdir objects
|
||||||
|
|
||||||
objects/hal.o: $(HAL_OBJECTS)
|
objects/hal.o: $(HAL_OBJECTS)
|
||||||
|
@ -108,25 +110,28 @@ objects/nt.o: $(NT_OBJECTS)
|
||||||
objects/cc.o: $(CC_OBJECTS)
|
objects/cc.o: $(CC_OBJECTS)
|
||||||
$(LD) -r $(CC_OBJECTS) -o objects/cc.o
|
$(LD) -r $(CC_OBJECTS) -o objects/cc.o
|
||||||
|
|
||||||
|
objects/kd.o: $(KD_OBJECTS)
|
||||||
|
$(LD) -r $(KD_OBJECTS) -o objects/kd.o
|
||||||
|
|
||||||
$(TARGET).coff: $(TARGET).rc ../include/reactos/resource.h
|
$(TARGET).coff: $(TARGET).rc ../include/reactos/resource.h
|
||||||
|
|
||||||
|
|
||||||
OBJECTS = objects/hal.o objects/ke.o objects/rtl.o objects/mm.o \
|
OBJECTS = objects/hal.o objects/ke.o objects/rtl.o objects/mm.o \
|
||||||
objects/io.o objects/ob.o objects/ps.o objects/ex.o \
|
objects/io.o objects/ob.o objects/ps.o objects/ex.o \
|
||||||
objects/se.o objects/cm.o objects/dbg.o \
|
objects/se.o objects/cm.o objects/dbg.o objects/nt.o \
|
||||||
objects/nt.o objects/cc.o objects/ldr.o \
|
objects/cc.o objects/kd.o objects/ldr.o \
|
||||||
$(TARGET).coff
|
$(TARGET).coff
|
||||||
|
|
||||||
ifeq ($(DOSCLI),yes)
|
ifeq ($(DOSCLI),yes)
|
||||||
CLEAN_FILES = objects\*.o cc\*.o cm\*.o dbg\*.o ex\*.o hal\x86\*.o io\*.o \
|
CLEAN_FILES = objects\*.o cc\*.o cm\*.o dbg\*.o ex\*.o hal\x86\*.o io\*.o \
|
||||||
ke\*.o ldr\*.o mm\*.o nt\*.o ob\*.o ps\*.o rtl\*.o se\*.o \
|
ke\*.o ldr\*.o mm\*.o nt\*.o ob\*.o ps\*.o rtl\*.o se\*.o \
|
||||||
utils\export\export.exe $(TARGET).o $(TARGET).a junk.tmp \
|
kd\*.o utils\export\export.exe $(TARGET).o $(TARGET).a junk.tmp \
|
||||||
base.tmp temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
|
base.tmp temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
|
||||||
else
|
else
|
||||||
CLEAN_FILES = objects/*.o cc/*.o cm/*.o dbg/*.o ex/*.o hal/x86/*.o io/*.o \
|
CLEAN_FILES = objects/*.o cc/*.o cm/*.o dbg/*.o ex/*.o hal/x86/*.o io/*.o \
|
||||||
ke/*.o ldr/*.o mm/*.o nt/*.o ob/*.o ps/*.o rtl/*.o se/*.o \
|
ke/*.o ldr/*.o mm/*.o nt/*.o ob/*.o ps/*.o rtl/*.o se/*.o \
|
||||||
utils/export/export $(TARGET).o $(TARGET).a junk.tmp base.tmp \
|
kd/*.o utils/export/export $(TARGET).o $(TARGET).a junk.tmp \
|
||||||
temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
|
base.tmp temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(TARGET).exe: $(OBJECTS) $(TARGET).def
|
$(TARGET).exe: $(OBJECTS) $(TARGET).def
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.def,v 1.18 1999/10/16 21:09:12 ekohl Exp $
|
; $Id: ntoskrnl.def,v 1.19 1999/10/21 11:10:26 ekohl Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -389,7 +389,7 @@ HalSetBusDataByOffset
|
||||||
HalSetDisplayParameters
|
HalSetDisplayParameters
|
||||||
;HalSetEnvironmentVariable
|
;HalSetEnvironmentVariable
|
||||||
;HalSetProfileInterval
|
;HalSetProfileInterval
|
||||||
HalSetRealTimeClock
|
;HalSetRealTimeClock
|
||||||
;HalSetTimeIncrement
|
;HalSetTimeIncrement
|
||||||
;HalStartNextProcessor
|
;HalStartNextProcessor
|
||||||
;HalStartProfileInterrupt
|
;HalStartProfileInterrupt
|
||||||
|
@ -406,9 +406,9 @@ HalSetRealTimeClock
|
||||||
;IoWritePartitionTable
|
;IoWritePartitionTable
|
||||||
;KdComPortInUse
|
;KdComPortInUse
|
||||||
;KdPortGetByte
|
;KdPortGetByte
|
||||||
;KdPortInitialize
|
KdPortInitialize
|
||||||
;KdPortPollByte
|
;KdPortPollByte
|
||||||
;KdPortPutByte
|
KdPortPutByte
|
||||||
;KdPortRestore
|
;KdPortRestore
|
||||||
;KdPortSave
|
;KdPortSave
|
||||||
KeAcquireSpinLock
|
KeAcquireSpinLock
|
||||||
|
@ -426,16 +426,16 @@ KeStallExecutionProcessor
|
||||||
;KfLowerIrql
|
;KfLowerIrql
|
||||||
;KfRaiseIrql
|
;KfRaiseIrql
|
||||||
;KfReleaseSpinLock
|
;KfReleaseSpinLock
|
||||||
;READ_PORT_BUFFER_UCHAR
|
READ_PORT_BUFFER_UCHAR
|
||||||
;READ_PORT_BUFFER_ULONG
|
READ_PORT_BUFFER_ULONG
|
||||||
;READ_PORT_BUFFER_USHORT
|
READ_PORT_BUFFER_USHORT
|
||||||
;READ_PORT_UCHAR
|
READ_PORT_UCHAR
|
||||||
;READ_PORT_ULONG
|
READ_PORT_ULONG
|
||||||
;READ_PORT_USHORT
|
READ_PORT_USHORT
|
||||||
;WRITE_PORT_BUFFER_UCHAR
|
WRITE_PORT_BUFFER_UCHAR
|
||||||
;WRITE_PORT_BUFFER_ULONG
|
WRITE_PORT_BUFFER_ULONG
|
||||||
;WRITE_PORT_BUFFER_USHORT
|
WRITE_PORT_BUFFER_USHORT
|
||||||
;WRITE_PORT_UCHAR
|
WRITE_PORT_UCHAR
|
||||||
;WRITE_PORT_ULONG
|
WRITE_PORT_ULONG
|
||||||
;WRITE_PORT_USHORT
|
WRITE_PORT_USHORT
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.edf,v 1.6 1999/10/16 21:09:12 ekohl Exp $
|
; $Id: ntoskrnl.edf,v 1.7 1999/10/21 11:10:26 ekohl Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -389,7 +389,7 @@ HalSetBusDataByOffset
|
||||||
HalSetDisplayParameters
|
HalSetDisplayParameters
|
||||||
;HalSetEnvironmentVariable
|
;HalSetEnvironmentVariable
|
||||||
;HalSetProfileInterval
|
;HalSetProfileInterval
|
||||||
HalSetRealTimeClock
|
;HalSetRealTimeClock
|
||||||
;HalSetTimeIncrement
|
;HalSetTimeIncrement
|
||||||
;HalStartNextProcessor
|
;HalStartNextProcessor
|
||||||
;HalStartProfileInterrupt
|
;HalStartProfileInterrupt
|
||||||
|
@ -404,11 +404,11 @@ HalSetRealTimeClock
|
||||||
;IoReadPartitionTable
|
;IoReadPartitionTable
|
||||||
;IoSetPartitionInformation
|
;IoSetPartitionInformation
|
||||||
;IoWritePartitionTable
|
;IoWritePartitionTable
|
||||||
;KdComPortInUse
|
KdComPortInUse
|
||||||
;KdPortGetByte
|
;KdPortGetByte
|
||||||
;KdPortInitialize
|
KdPortInitialize=KdPortInitialize@12
|
||||||
;KdPortPollByte
|
;KdPortPollByte
|
||||||
;KdPortPutByte
|
KdPortPutByte=KdPortPutByte@4
|
||||||
;KdPortRestore
|
;KdPortRestore
|
||||||
;KdPortSave
|
;KdPortSave
|
||||||
KeAcquireSpinLock
|
KeAcquireSpinLock
|
||||||
|
@ -426,15 +426,15 @@ KeStallExecutionProcessor
|
||||||
;KfLowerIrql
|
;KfLowerIrql
|
||||||
;KfRaiseIrql
|
;KfRaiseIrql
|
||||||
;KfReleaseSpinLock
|
;KfReleaseSpinLock
|
||||||
;READ_PORT_BUFFER_UCHAR
|
READ_PORT_BUFFER_UCHAR
|
||||||
;READ_PORT_BUFFER_ULONG
|
READ_PORT_BUFFER_ULONG
|
||||||
;READ_PORT_BUFFER_USHORT
|
READ_PORT_BUFFER_USHORT
|
||||||
;READ_PORT_UCHAR
|
READ_PORT_UCHAR
|
||||||
;READ_PORT_ULONG
|
READ_PORT_ULONG
|
||||||
;READ_PORT_USHORT
|
READ_PORT_USHORT
|
||||||
;WRITE_PORT_BUFFER_UCHAR
|
WRITE_PORT_BUFFER_UCHAR
|
||||||
;WRITE_PORT_BUFFER_ULONG
|
WRITE_PORT_BUFFER_ULONG
|
||||||
;WRITE_PORT_BUFFER_USHORT
|
WRITE_PORT_BUFFER_USHORT
|
||||||
;WRITE_PORT_UCHAR
|
WRITE_PORT_UCHAR
|
||||||
;WRITE_PORT_ULONG
|
WRITE_PORT_ULONG
|
||||||
;WRITE_PORT_USHORT
|
WRITE_PORT_USHORT
|
||||||
|
|
Loading…
Reference in a new issue