Connected standard input/output to the console

Removed from superfluous assertions
Changed the ide read and write commands to work with bochs
Corrected bug in the csrss server

svn path=/trunk/; revision=1089
This commit is contained in:
David Welch 2000-03-24 22:25:39 +00:00
parent 0bd4cf0cbf
commit 79eff41abb
9 changed files with 129 additions and 75 deletions

View file

@ -1,4 +1,4 @@
/* $Id: ide.c,v 1.26 2000/01/06 00:26:16 dwelch Exp $ /* $Id: ide.c,v 1.27 2000/03/24 22:25:39 dwelch Exp $
* *
* IDE.C - IDE Disk driver * IDE.C - IDE Disk driver
* written by Rex Jolliff * written by Rex Jolliff
@ -826,7 +826,8 @@ IDEGetPartitionTable(IN int CommandPort,
CylinderLow, CylinderLow,
CylinderHigh, CylinderHigh,
DrvHead, DrvHead,
IDE_CMD_READ_RETRY, // IDE_CMD_READ_RETRY,
IDE_CMD_READ,
SectorBuf); SectorBuf);
if (RC != 0) if (RC != 0)
{ {
@ -1456,7 +1457,8 @@ IDEStartController(IN OUT PVOID Context)
CylinderHigh = StartingSector >> 8; CylinderHigh = StartingSector >> 8;
} }
Command = DeviceExtension->Operation == IRP_MJ_READ ? Command = DeviceExtension->Operation == IRP_MJ_READ ?
IDE_CMD_READ_RETRY : IDE_CMD_WRITE_RETRY; // IDE_CMD_READ_RETRY : IDE_CMD_WRITE_RETRY;
IDE_CMD_READ : IDE_CMD_WRITE;
if (DrvHead & IDE_DH_LBA) if (DrvHead & IDE_DH_LBA)
{ {
DPRINT("%s:DRV=%d:LBA=1:BLK=%08d:SC=%02x:CM=%02x\n", DPRINT("%s:DRV=%d:LBA=1:BLK=%08d:SC=%02x:CM=%02x\n",

View file

@ -1,7 +1,9 @@
#!/bin/sh #!/bin/sh
echo "Installing to floppy."
mount -t vfat /bochs/1.44a /mnt/floppy -o loop,rw mount -t vfat /bochs/1.44a /mnt/floppy -o loop,rw
./install-system.sh /mnt/floppy ./install-system.sh /mnt/floppy
umount /mnt/floppy umount /mnt/floppy
echo "Installing to disk."
mount -t vfat /bochs/10M.vga /mnt/floppy -o loop,rw mount -t vfat /bochs/10M.vga /mnt/floppy -o loop,rw
./install.sh /mnt/floppy ./install.sh /mnt/floppy
umount /mnt/floppy umount /mnt/floppy

View file

@ -24,12 +24,6 @@
#define NDEBUG #define NDEBUG
#include <kernel32/kernel32.h> #include <kernel32/kernel32.h>
/* GLOBALS ******************************************************************/
static HANDLE StdInput = INVALID_HANDLE_VALUE;
static HANDLE StdOutput = INVALID_HANDLE_VALUE;
static HANDLE StdError = INVALID_HANDLE_VALUE;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
WINBOOL STDCALL CloseConsoleHandle(HANDLE Handle) WINBOOL STDCALL CloseConsoleHandle(HANDLE Handle)
@ -51,14 +45,17 @@ BOOLEAN IsConsoleHandle(HANDLE Handle)
*/ */
HANDLE STDCALL GetStdHandle(DWORD nStdHandle) HANDLE STDCALL GetStdHandle(DWORD nStdHandle)
{ {
PRTL_USER_PROCESS_PARAMETERS Ppb;
DPRINT("GetStdHandle(nStdHandle %d)\n",nStdHandle); DPRINT("GetStdHandle(nStdHandle %d)\n",nStdHandle);
SetLastError(ERROR_SUCCESS); /* OK */ SetLastError(ERROR_SUCCESS); /* OK */
Ppb = NtCurrentPeb()->ProcessParameters;
switch (nStdHandle) switch (nStdHandle)
{ {
case STD_INPUT_HANDLE: return StdInput; case STD_INPUT_HANDLE: return Ppb->InputHandle;
case STD_OUTPUT_HANDLE: return StdOutput; case STD_OUTPUT_HANDLE: return Ppb->OutputHandle;
case STD_ERROR_HANDLE: return StdError; case STD_ERROR_HANDLE: return Ppb->ErrorHandle;
} }
SetLastError(0); /* FIXME: What error code? */ SetLastError(0); /* FIXME: What error code? */
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
@ -71,6 +68,10 @@ HANDLE STDCALL GetStdHandle(DWORD nStdHandle)
WINBASEAPI BOOL WINAPI SetStdHandle(DWORD nStdHandle, WINBASEAPI BOOL WINAPI SetStdHandle(DWORD nStdHandle,
HANDLE hHandle) HANDLE hHandle)
{ {
PRTL_USER_PROCESS_PARAMETERS Ppb;
Ppb = NtCurrentPeb()->ProcessParameters;
/* More checking needed? */ /* More checking needed? */
if (hHandle == INVALID_HANDLE_VALUE) if (hHandle == INVALID_HANDLE_VALUE)
{ {
@ -82,13 +83,13 @@ WINBASEAPI BOOL WINAPI SetStdHandle(DWORD nStdHandle,
switch (nStdHandle) switch (nStdHandle)
{ {
case STD_INPUT_HANDLE: case STD_INPUT_HANDLE:
StdInput = hHandle; Ppb->InputHandle = hHandle;
return TRUE; return TRUE;
case STD_OUTPUT_HANDLE: case STD_OUTPUT_HANDLE:
StdOutput = hHandle; Ppb->OutputHandle = hHandle;
return TRUE; return TRUE;
case STD_ERROR_HANDLE: case STD_ERROR_HANDLE:
StdError = hHandle; Ppb->ErrorHandle = hHandle;
return TRUE; return TRUE;
} }
SetLastError(0); /* FIXME: What error code? */ SetLastError(0); /* FIXME: What error code? */

View file

@ -1,4 +1,4 @@
/* $Id: create.c,v 1.25 2000/03/22 18:35:48 dwelch Exp $ /* $Id: create.c,v 1.26 2000/03/24 22:25:37 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -246,6 +246,7 @@ HANDLE KlMapFile(LPCWSTR lpApplicationName,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Failed to open file\n");
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return(NULL); return(NULL);
} }
@ -261,6 +262,7 @@ HANDLE KlMapFile(LPCWSTR lpApplicationName,
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT("Failed to create section\n");
SetLastError(RtlNtStatusToDosError(Status)); SetLastError(RtlNtStatusToDosError(Status));
return(NULL); return(NULL);
} }
@ -419,7 +421,7 @@ WINBOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName,
} }
if (e != NULL) if (e != NULL)
{ {
*e = 0; *e = '.';
} }
/* /*
@ -515,7 +517,10 @@ WINBOOL STDCALL CreateProcessW(LPCWSTR lpApplicationName,
*/ */
DPRINT("Creating peb\n"); DPRINT("Creating peb\n");
Ppb->ConsoleHandle = ConsoleHandle; Ppb->ConsoleHandle = ConsoleHandle;
Ppb->InputHandle = ConsoleHandle;
Ppb->OutputHandle = ConsoleHandle;
Ppb->ErrorHandle = ConsoleHandle;
KlInitPeb(hProcess, Ppb); KlInitPeb(hProcess, Ppb);
RtlDestroyProcessParameters (Ppb); RtlDestroyProcessParameters (Ppb);

View file

@ -208,7 +208,7 @@ NtCreateFile (
KEVENT Event; KEVENT Event;
PIO_STACK_LOCATION StackLoc; PIO_STACK_LOCATION StackLoc;
DPRINT("NtCreateFile(FileHandle %x, DesiredAccess %x, " DPRINT1("NtCreateFile(FileHandle %x, DesiredAccess %x, "
"ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
FileHandle,DesiredAccess,ObjectAttributes, FileHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes->ObjectName->Buffer); ObjectAttributes->ObjectName->Buffer);

View file

@ -1,4 +1,4 @@
/* $Id: kdebug.c,v 1.8 2000/03/04 22:02:13 ekohl Exp $ /* $Id: kdebug.c,v 1.9 2000/03/24 22:25:38 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -26,13 +26,9 @@
/* TYPEDEFS ****************************************************************/ /* TYPEDEFS ****************************************************************/
typedef enum #define ScreenDebug (0x1)
{ #define SerialDebug (0x2)
ScreenDebug, #define BochsDebug (0x4)
SerialDebug,
BochsDebug
} DEBUGTYPE;
/* VARIABLES ***************************************************************/ /* VARIABLES ***************************************************************/
@ -47,7 +43,7 @@ KdDebuggerNotPresent = TRUE; /* EXPORTED */
static BOOLEAN KdpBreakPending = FALSE; static BOOLEAN KdpBreakPending = FALSE;
static BOOLEAN KdpBreakRecieved = FALSE; static BOOLEAN KdpBreakRecieved = FALSE;
static DEBUGTYPE KdpDebugType = ScreenDebug; static ULONG KdpDebugType = ScreenDebug | BochsDebug;
/* PRIVATE FUNCTIONS ********************************************************/ /* PRIVATE FUNCTIONS ********************************************************/
@ -99,13 +95,13 @@ KdInitSystem (
{ {
p2 += 6; p2 += 6;
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = ScreenDebug; KdpDebugType |= ScreenDebug;
} }
else if (!_strnicmp (p2, "BOCHS", 5)) else if (!_strnicmp (p2, "BOCHS", 5))
{ {
p2 += 5; p2 += 5;
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = BochsDebug; KdpDebugType |= BochsDebug;
} }
else if (!_strnicmp (p2, "COM", 3)) else if (!_strnicmp (p2, "COM", 3))
{ {
@ -114,7 +110,7 @@ KdInitSystem (
if (Value > 0 && Value < 5) if (Value > 0 && Value < 5)
{ {
KdDebuggerEnabled = TRUE; KdDebuggerEnabled = TRUE;
KdpDebugType = SerialDebug; KdpDebugType |= SerialDebug;
PortInfo.ComPort = Value; PortInfo.ComPort = Value;
} }
} }
@ -208,15 +204,15 @@ KdInitSystem (
/* print some information */ /* print some information */
if (KdDebuggerEnabled == TRUE) if (KdDebuggerEnabled == TRUE)
{ {
if (KdpDebugType == ScreenDebug) if (KdpDebugType & ScreenDebug)
{ {
PrintString ("\n Screen debugging enabled\n\n"); PrintString ("\n Screen debugging enabled\n\n");
} }
else if (KdpDebugType == BochsDebug) if (KdpDebugType & BochsDebug)
{ {
PrintString ("\n Bochs debugging enabled\n\n"); PrintString ("\n Bochs debugging enabled\n\n");
} }
else if (KdpDebugType == SerialDebug) if (KdpDebugType & SerialDebug)
{ {
PrintString ("\n Serial debugging enabled: COM%ld %ld Baud\n\n", PrintString ("\n Serial debugging enabled: COM%ld %ld Baud\n\n",
PortInfo.ComPort, PortInfo.BaudRate); PortInfo.ComPort, PortInfo.BaudRate);
@ -236,41 +232,40 @@ KdInitSystem (
} }
ULONG ULONG KdpPrintString (PANSI_STRING String)
KdpPrintString (PANSI_STRING String)
{ {
PCH pch = String->Buffer; PCH pch = String->Buffer;
if (KdpDebugType == ScreenDebug) if (KdpDebugType & ScreenDebug)
{ {
HalDisplayString (String->Buffer); HalDisplayString (String->Buffer);
}
if (KdpDebugType & SerialDebug)
{
while (*pch != 0)
{
if (*pch == '\n')
{
KdPortPutByte ('\r');
}
KdPortPutByte (*pch);
pch++;
}
} }
else if (KdpDebugType == SerialDebug) if (KdpDebugType & BochsDebug)
{ {
while (*pch != 0) while (*pch != 0)
{ {
if (*pch == '\n') if (*pch == '\n')
{ {
KdPortPutByte ('\r'); WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r');
} }
KdPortPutByte (*pch); WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, *pch);
pch++; pch++;
} }
} }
else if (KdpDebugType == BochsDebug)
{ return (ULONG)String->Length;
while (*pch != 0)
{
if (*pch == '\n')
{
WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, '\r');
}
WRITE_PORT_UCHAR((PUCHAR)BOCHS_LOGGER_PORT, *pch);
pch++;
}
}
return (ULONG)String->Length;
} }
/* PUBLIC FUNCTIONS *********************************************************/ /* PUBLIC FUNCTIONS *********************************************************/

View file

@ -1,4 +1,4 @@
# $Id: makefile_rex,v 1.62 2000/03/19 09:14:49 ea Exp $ # $Id: makefile_rex,v 1.63 2000/03/24 22:25:37 dwelch Exp $
# #
# ReactOS Operating System # ReactOS Operating System
# #
@ -8,7 +8,7 @@ TARGET=ntoskrnl
BASE_CFLAGS = -I../include -D__NTOSKRNL__ BASE_CFLAGS = -I../include -D__NTOSKRNL__
all: objects $(TARGET).exe all: objects $(TARGET).exe $(TARGET).nostrip.exe
# #
# Defines $(HAL_OBJECTS) # Defines $(HAL_OBJECTS)
@ -168,10 +168,54 @@ CLEAN_FILES = objects/*.o cc/*.o cm/*.o dbg/*.o ex/*.o hal/x86/*.o io/*.o \
endif endif
$(TARGET).nostrip.exe: $(OBJECTS) $(TARGET).def
$(LD) \
-r $(OBJECTS) \
-o $(TARGET).o
$(DLLTOOL) \
--dllname $(TARGET).exe \
--def $(TARGET).def \
--kill-at \
--output-lib $(TARGET).a
$(CC) \
$(TARGET).o \
-Wl,-d -specs=../specs \
-mdll \
-o junk.tmp \
-Wl,--image-base,0xc0000000 \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,--defsym,_edata=__data_end__ \
-Wl,--defsym,_end=__bss_end__ \
-Wl,--defsym,_etext=etext \
-Wl,--base-file,base.tmp
- $(RM) junk.tmp
$(DLLTOOL) \
--dllname $(TARGET).exe \
--base-file base.tmp \
--output-exp temp.exp \
--def $(TARGET).edf \
--kill-at
- $(RM) base.tmp
$(CC) \
$(TARGET).o \
-Wl,-d -specs=../specs \
-mdll \
-o $(TARGET).nostrip.exe \
-Wl,--image-base,0xc0000000 \
-Wl,--file-alignment,0x1000 \
-Wl,--section-alignment,0x1000 \
-Wl,--defsym,_end=__bss_end__ \
-Wl,--defsym,_edata=__data_end__ \
-Wl,--defsym,_etext=etext \
-Wl,temp.exp
- $(RM) temp.exp
$(TARGET).exe: $(OBJECTS) $(TARGET).def $(TARGET).exe: $(OBJECTS) $(TARGET).def
$(LD) \ $(LD) \
-r $(OBJECTS) \ -r $(OBJECTS) \
-o $(TARGET).o -o $(TARGET).o
$(STRIP) --strip-debug $(TARGET).o
$(DLLTOOL) \ $(DLLTOOL) \
--dllname $(TARGET).exe \ --dllname $(TARGET).exe \
--def $(TARGET).def \ --def $(TARGET).def \
@ -212,6 +256,7 @@ $(TARGET).exe: $(OBJECTS) $(TARGET).def
- $(RM) temp.exp - $(RM) temp.exp
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym $(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
$(TARGET).o: $(OBJECTS) $(TARGET).o: $(OBJECTS)
$(LD) \ $(LD) \
-r $(OBJECTS) \ -r $(OBJECTS) \
@ -256,7 +301,7 @@ ex/napi.o: ex/napi.c ../include/ntdll/napi.h
ke/main.o: ke/main.c ../include/reactos/buildno.h ke/main.o: ke/main.c ../include/reactos/buildno.h
#WITH_DEBUGGING = yes WITH_DEBUGGING = yes
WIN32_LEAN_AND_MEAN = yes WIN32_LEAN_AND_MEAN = yes
WARNINGS_ARE_ERRORS = yes WARNINGS_ARE_ERRORS = yes
include ../rules.mak include ../rules.mak

View file

@ -295,6 +295,9 @@ static VOID MmInsertMemoryAreaWithoutLock(PEPROCESS Process,
DPRINT("marea->Length %x\n",marea->Length); DPRINT("marea->Length %x\n",marea->Length);
ListHead=MmGetRelatedListHead(Process,marea->BaseAddress); ListHead=MmGetRelatedListHead(Process,marea->BaseAddress);
// MmDumpMemoryAreas(ListHead);
current_entry = ListHead->Flink; current_entry = ListHead->Flink;
CHECKPOINT; CHECKPOINT;
if (IsListEmpty(ListHead)) if (IsListEmpty(ListHead))
@ -322,8 +325,8 @@ static VOID MmInsertMemoryAreaWithoutLock(PEPROCESS Process,
// CHECKPOINT; // CHECKPOINT;
current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry); current = CONTAINING_RECORD(current_entry,MEMORY_AREA,Entry);
next = CONTAINING_RECORD(current_entry->Flink,MEMORY_AREA,Entry); next = CONTAINING_RECORD(current_entry->Flink,MEMORY_AREA,Entry);
assert(current->BaseAddress != marea->BaseAddress); // assert(current->BaseAddress != marea->BaseAddress);
assert(next->BaseAddress != marea->BaseAddress); // assert(next->BaseAddress != marea->BaseAddress);
if (current->BaseAddress < marea->BaseAddress && if (current->BaseAddress < marea->BaseAddress &&
current->Entry.Flink==ListHead) current->Entry.Flink==ListHead)
{ {

View file

@ -1,4 +1,4 @@
/* $Id: handle.c,v 1.3 2000/03/22 18:36:00 dwelch Exp $ /* $Id: handle.c,v 1.4 2000/03/24 22:25:39 dwelch Exp $
* *
* reactos/subsys/csrss/api/handle.c * reactos/subsys/csrss/api/handle.c
* *
@ -20,7 +20,7 @@ NTSTATUS CsrGetObject(PCSRSS_PROCESS_DATA ProcessData,
HANDLE Handle, HANDLE Handle,
PVOID* Object) PVOID* Object)
{ {
*Object = ProcessData->HandleTable[(ULONG)Handle]; *Object = ProcessData->HandleTable[((ULONG)Handle) - 1];
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
@ -56,8 +56,9 @@ NTSTATUS CsrInsertObject(PCSRSS_PROCESS_DATA ProcessData,
RtlCopyMemory(NewBlock, RtlCopyMemory(NewBlock,
ProcessData->HandleTable, ProcessData->HandleTable,
ProcessData->HandleTableSize * sizeof(HANDLE)); ProcessData->HandleTableSize * sizeof(HANDLE));
ProcessData->HandleTable = NewBlock;
ProcessData->HandleTable[i] = Object; ProcessData->HandleTable[i] = Object;
*Handle = (HANDLE)((i << 8) | 0x3); *Handle = (HANDLE)(((i + 1) << 8) | 0x3);
ProcessData->HandleTableSize = ProcessData->HandleTableSize + 64; ProcessData->HandleTableSize = ProcessData->HandleTableSize + 64;
return(STATUS_SUCCESS); return(STATUS_SUCCESS);