mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +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
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -14,7 +14,6 @@
|
|||
#include <ddk/ntddk.h>
|
||||
#include <internal/hal/ddk.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/halio.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -43,42 +42,11 @@
|
|||
/* #define SERIAL_DEBUG_PORT 0x02f8 */ /* COM 2 */
|
||||
#define SERIAL_DEBUG_BAUD_RATE 19200
|
||||
|
||||
#define SERIAL_LINE_CONTROL (SR_LCR_CS8 | SR_LCR_ST1 | SR_LCR_PNO)
|
||||
|
||||
#ifdef BOCHS_DEBUGGING
|
||||
#define BOCHS_LOGGER_PORT (0x3ed)
|
||||
#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 ****************************************************************/
|
||||
|
||||
|
@ -86,26 +54,19 @@
|
|||
static VOID
|
||||
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);
|
||||
|
||||
if (*pch == '\n')
|
||||
{
|
||||
while ((inb_p(SER_LSR) & SR_LSR_TBE) == 0)
|
||||
;
|
||||
|
||||
outb_p(SER_THR, '\r');
|
||||
}
|
||||
|
||||
pch++;
|
||||
}
|
||||
pch++;
|
||||
}
|
||||
}
|
||||
#endif /* SERIAL_DEBUGGING */
|
||||
|
||||
|
@ -114,35 +75,35 @@ DbgDisplaySerialString(PCH String)
|
|||
static VOID
|
||||
DbgDisplayBochsString(PCH String)
|
||||
{
|
||||
PCH pch = String;
|
||||
PCH pch = String;
|
||||
|
||||
while (*pch != 0)
|
||||
{
|
||||
outb_p(BOCHS_LOGGER_PORT, *pch);
|
||||
while (*pch != 0)
|
||||
{
|
||||
if (*pch == '\n')
|
||||
{
|
||||
WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r');
|
||||
}
|
||||
|
||||
if (*pch == '\n')
|
||||
{
|
||||
outb_p(BOCHS_LOGGER_PORT, '\r');
|
||||
}
|
||||
WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, *pch);
|
||||
|
||||
pch++;
|
||||
}
|
||||
pch++;
|
||||
}
|
||||
}
|
||||
#endif /* BOCHS_DEBUGGING */
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
DbgInit (VOID)
|
||||
{
|
||||
#ifdef SERIAL_DEBUGGING
|
||||
/* turn on DTR and RTS */
|
||||
outb_p(SER_MCR, SR_MCR_DTR | SR_MCR_RTS);
|
||||
/* set baud rate, line control */
|
||||
outb_p(SER_LCR, SERIAL_LINE_CONTROL | SR_LCR_DLAB);
|
||||
outb_p(SER_DLL, (115200 / SERIAL_DEBUG_BAUD_RATE) & 0xff);
|
||||
outb_p(SER_DLM, ((115200 / SERIAL_DEBUG_BAUD_RATE) >> 8) & 0xff);
|
||||
outb_p(SER_LCR, SERIAL_LINE_CONTROL);
|
||||
KD_PORT_INFORMATION PortInfo;
|
||||
|
||||
PortInfo.BaseAddress = SERIAL_DEBUG_PORT;
|
||||
PortInfo.BaudRate = SERIAL_DEBUG_BAUD_RATE;
|
||||
|
||||
KdPortInitialize (&PortInfo,
|
||||
0,
|
||||
0);
|
||||
#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
|
||||
*
|
||||
*/
|
||||
#include <ntos.h>
|
||||
#include <ddk/ntddk.h>
|
||||
|
||||
BYTE STDCALL KdPortPollByte(VOID);
|
||||
|
||||
//BYTE STDCALL KdPortPollByte(VOID);
|
||||
|
||||
/* DATA */
|
||||
|
||||
|
@ -15,11 +16,37 @@ KdDebuggerEnabled = FALSE;
|
|||
BOOLEAN
|
||||
KdDebuggerNotPresent = TRUE;
|
||||
|
||||
BOOLEAN
|
||||
KdComPortInUse = FALSE;
|
||||
/* This is exported by hal.dll (Eric Kohl) */
|
||||
//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 */
|
||||
/*
|
||||
BYTE
|
||||
STDCALL
|
||||
KdPollBreakIn (
|
||||
|
@ -28,7 +55,7 @@ KdPollBreakIn (
|
|||
{
|
||||
return KdPortPollByte();
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* 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
|
||||
#
|
||||
|
@ -61,9 +61,11 @@ LDR_OBJECTS = ldr/loader.o ldr/init.o ldr/syspath.o
|
|||
|
||||
CC_OBJECTS = cc/cacheman.o cc/view.o
|
||||
|
||||
KD_OBJECTS = kd/kdebug.o
|
||||
|
||||
RESOURCE_OBJECT = $(TARGET).coff
|
||||
|
||||
objects:
|
||||
objects:
|
||||
mkdir objects
|
||||
|
||||
objects/hal.o: $(HAL_OBJECTS)
|
||||
|
@ -108,25 +110,28 @@ objects/nt.o: $(NT_OBJECTS)
|
|||
objects/cc.o: $(CC_OBJECTS)
|
||||
$(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
|
||||
|
||||
|
||||
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/se.o objects/cm.o objects/dbg.o \
|
||||
objects/nt.o objects/cc.o objects/ldr.o \
|
||||
$(TARGET).coff
|
||||
|
||||
objects/se.o objects/cm.o objects/dbg.o objects/nt.o \
|
||||
objects/cc.o objects/kd.o objects/ldr.o \
|
||||
$(TARGET).coff
|
||||
|
||||
ifeq ($(DOSCLI),yes)
|
||||
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 \
|
||||
utils\export\export.exe $(TARGET).o $(TARGET).a junk.tmp \
|
||||
base.tmp temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
|
||||
kd\*.o utils\export\export.exe $(TARGET).o $(TARGET).a junk.tmp \
|
||||
base.tmp temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
|
||||
else
|
||||
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 \
|
||||
utils/export/export $(TARGET).o $(TARGET).a junk.tmp base.tmp \
|
||||
temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
|
||||
kd/*.o utils/export/export $(TARGET).o $(TARGET).a junk.tmp \
|
||||
base.tmp temp.exp $(TARGET).exe $(TARGET).sym $(TARGET).coff
|
||||
endif
|
||||
|
||||
$(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
|
||||
;
|
||||
|
@ -389,7 +389,7 @@ HalSetBusDataByOffset
|
|||
HalSetDisplayParameters
|
||||
;HalSetEnvironmentVariable
|
||||
;HalSetProfileInterval
|
||||
HalSetRealTimeClock
|
||||
;HalSetRealTimeClock
|
||||
;HalSetTimeIncrement
|
||||
;HalStartNextProcessor
|
||||
;HalStartProfileInterrupt
|
||||
|
@ -406,9 +406,9 @@ HalSetRealTimeClock
|
|||
;IoWritePartitionTable
|
||||
;KdComPortInUse
|
||||
;KdPortGetByte
|
||||
;KdPortInitialize
|
||||
KdPortInitialize
|
||||
;KdPortPollByte
|
||||
;KdPortPutByte
|
||||
KdPortPutByte
|
||||
;KdPortRestore
|
||||
;KdPortSave
|
||||
KeAcquireSpinLock
|
||||
|
@ -426,16 +426,16 @@ KeStallExecutionProcessor
|
|||
;KfLowerIrql
|
||||
;KfRaiseIrql
|
||||
;KfReleaseSpinLock
|
||||
;READ_PORT_BUFFER_UCHAR
|
||||
;READ_PORT_BUFFER_ULONG
|
||||
;READ_PORT_BUFFER_USHORT
|
||||
;READ_PORT_UCHAR
|
||||
;READ_PORT_ULONG
|
||||
;READ_PORT_USHORT
|
||||
;WRITE_PORT_BUFFER_UCHAR
|
||||
;WRITE_PORT_BUFFER_ULONG
|
||||
;WRITE_PORT_BUFFER_USHORT
|
||||
;WRITE_PORT_UCHAR
|
||||
;WRITE_PORT_ULONG
|
||||
;WRITE_PORT_USHORT
|
||||
READ_PORT_BUFFER_UCHAR
|
||||
READ_PORT_BUFFER_ULONG
|
||||
READ_PORT_BUFFER_USHORT
|
||||
READ_PORT_UCHAR
|
||||
READ_PORT_ULONG
|
||||
READ_PORT_USHORT
|
||||
WRITE_PORT_BUFFER_UCHAR
|
||||
WRITE_PORT_BUFFER_ULONG
|
||||
WRITE_PORT_BUFFER_USHORT
|
||||
WRITE_PORT_UCHAR
|
||||
WRITE_PORT_ULONG
|
||||
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
|
||||
;
|
||||
|
@ -389,7 +389,7 @@ HalSetBusDataByOffset
|
|||
HalSetDisplayParameters
|
||||
;HalSetEnvironmentVariable
|
||||
;HalSetProfileInterval
|
||||
HalSetRealTimeClock
|
||||
;HalSetRealTimeClock
|
||||
;HalSetTimeIncrement
|
||||
;HalStartNextProcessor
|
||||
;HalStartProfileInterrupt
|
||||
|
@ -404,11 +404,11 @@ HalSetRealTimeClock
|
|||
;IoReadPartitionTable
|
||||
;IoSetPartitionInformation
|
||||
;IoWritePartitionTable
|
||||
;KdComPortInUse
|
||||
KdComPortInUse
|
||||
;KdPortGetByte
|
||||
;KdPortInitialize
|
||||
KdPortInitialize=KdPortInitialize@12
|
||||
;KdPortPollByte
|
||||
;KdPortPutByte
|
||||
KdPortPutByte=KdPortPutByte@4
|
||||
;KdPortRestore
|
||||
;KdPortSave
|
||||
KeAcquireSpinLock
|
||||
|
@ -426,15 +426,15 @@ KeStallExecutionProcessor
|
|||
;KfLowerIrql
|
||||
;KfRaiseIrql
|
||||
;KfReleaseSpinLock
|
||||
;READ_PORT_BUFFER_UCHAR
|
||||
;READ_PORT_BUFFER_ULONG
|
||||
;READ_PORT_BUFFER_USHORT
|
||||
;READ_PORT_UCHAR
|
||||
;READ_PORT_ULONG
|
||||
;READ_PORT_USHORT
|
||||
;WRITE_PORT_BUFFER_UCHAR
|
||||
;WRITE_PORT_BUFFER_ULONG
|
||||
;WRITE_PORT_BUFFER_USHORT
|
||||
;WRITE_PORT_UCHAR
|
||||
;WRITE_PORT_ULONG
|
||||
;WRITE_PORT_USHORT
|
||||
READ_PORT_BUFFER_UCHAR
|
||||
READ_PORT_BUFFER_ULONG
|
||||
READ_PORT_BUFFER_USHORT
|
||||
READ_PORT_UCHAR
|
||||
READ_PORT_ULONG
|
||||
READ_PORT_USHORT
|
||||
WRITE_PORT_BUFFER_UCHAR
|
||||
WRITE_PORT_BUFFER_ULONG
|
||||
WRITE_PORT_BUFFER_USHORT
|
||||
WRITE_PORT_UCHAR
|
||||
WRITE_PORT_ULONG
|
||||
WRITE_PORT_USHORT
|
||||
|
|
Loading…
Reference in a new issue