*** empty log message ***

svn path=/trunk/; revision=129
This commit is contained in:
David Welch 1998-12-19 19:26:02 +00:00
parent 5d1ddcb775
commit a9ce8c6379
10 changed files with 123 additions and 82 deletions

View file

@ -377,7 +377,7 @@ static BYTE VirtualToAscii(WORD keyCode,BOOL isDown)
case VK_SPACE:
return ' ';
case VK_RETURN:
return 13;
return '\n';
case VK_BACK:
return 8;
case VK_TAB:
@ -689,6 +689,8 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
PDEVICE_OBJECT DeviceObject;
ANSI_STRING adevice_name;
UNICODE_STRING device_name;
ANSI_STRING asymlink_name;
UNICODE_STRING symlink_name;
DbgPrint("Keyboard Driver 0.0.4\n");
InitializeKeyboard();
@ -704,6 +706,10 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
TRUE,&DeviceObject);
DeviceObject->Flags = DO_BUFFERED_IO;
RtlInitAnsiString(&asymlink_name,"\\??\\Keyboard");
RtlAnsiStringToUnicodeString(&symlink_name,&asymlink_name,TRUE);
IoCreateSymbolicLink(&symlink_name,&device_name);
return(STATUS_SUCCESS);
}

View file

@ -164,6 +164,24 @@ NTSTATUS MinixClose(PDEVICE_OBJECT DeviceObject, PIRP Irp)
return(STATUS_SUCCESS);
}
NTSTATUS MinixDirectoryControl(PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
PFILE_OBJECT FileObject = Stack->FileObject;
if (Stack->MinorFunction != IRP_MN_QUERY_DIRECTORY)
{
return(STATUS_NOT_IMPLEMENTED);
}
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return(STATUS_SUCCESS);
}
NTSTATUS MinixCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);

View file

@ -445,6 +445,8 @@ NTSTATUS DriverEntry(PDRIVER_OBJECT _DriverObject,
DriverObject->MajorFunction[IRP_MJ_WRITE] = MinixWrite;
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
MinixFileSystemControl;
DriverObject->MajorFunction[IRP_MJ_DIRECTORY_CONTROL] =
MinixDirectoryControl;
DriverObject->DriverUnload = NULL;
IoRegisterFileSystem(DeviceObject);

View file

@ -58,8 +58,6 @@ ULONG Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
ULONG FATsector;
ULONG FATeis;
PUSHORT Block;
Block = ExAllocatePool(NonPagedPool,BLOCKSIZE);
FATsector=CurrentCluster/(512/sizeof(USHORT));
FATeis=CurrentCluster-(FATsector*256);
@ -67,8 +65,8 @@ ULONG Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
// VFATReadSectors(DeviceExt->StorageDevice,DeviceExt->FATStart+FATsector, 1,
// (UCHAR *)Block);
memcpy(Block,DeviceExt->FAT+FATsector*BLOCKSIZE, BLOCKSIZE);
Block = (PUSHORT)(DeviceExt->FAT + (FATsector * BLOCKSIZE));
CurrentCluster = Block[FATeis];
@ -76,9 +74,7 @@ ULONG Fat16GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
{
CurrentCluster = 0;
}
ExFreePool(Block);
DPRINT("Returning %x\n",CurrentCluster);
return(CurrentCluster);
@ -91,14 +87,13 @@ ULONG Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
ULONG FATOffset;
ULONG Entry;
CBlock = ExAllocatePool(NonPagedPool,1024);
FATsector = (CurrentCluster * 12) / (512 * 8);
// VFATReadSectors(DeviceExt->StorageDevice,DeviceExt->FATStart
// +FATsector,1,CBlock);
memcpy(CBlock,DeviceExt->FAT+FATsector*BLOCKSIZE, BLOCKSIZE);
CBlock = (unsigned char *)(DeviceExt->FAT + (FATsector * BLOCKSIZE));
FATOffset = (CurrentCluster * 12) % (512 * 8);
@ -123,8 +118,6 @@ ULONG Fat12GetNextCluster(PDEVICE_EXTENSION DeviceExt, ULONG CurrentCluster)
}
CurrentCluster = Entry;
ExFreePool(CBlock);
DPRINT("Returning %x\n",CurrentCluster);
@ -571,7 +564,8 @@ void VFATLoadCluster(PDEVICE_EXTENSION DeviceExt, PVOID Buffer, ULONG Cluster)
}
NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
PVOID Buffer, ULONG Length, ULONG ReadOffset)
PVOID Buffer, ULONG Length, ULONG ReadOffset,
PULONG LengthRead)
/*
* FUNCTION: Reads data from a file
*/
@ -591,6 +585,16 @@ NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
Fcb = FileObject->FsContext;
CurrentCluster = Fcb->entry.FirstCluster;
if (ReadOffset >= Fcb->entry.FileSize)
{
return(STATUS_END_OF_FILE);
}
if ((ReadOffset + Length) > Fcb->entry.FileSize)
{
Length = Fcb->entry.FileSize - ReadOffset;
}
*LengthRead = 0;
DPRINT("DeviceExt->BytesPerCluster %x\n",DeviceExt->BytesPerCluster);
Temp = ExAllocatePool(NonPagedPool,DeviceExt->BytesPerCluster);
@ -611,6 +615,7 @@ NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
memcpy(Buffer, Temp + ReadOffset % DeviceExt->BytesPerCluster,
TempLength);
(*LengthRead) = (*LengthRead) + TempLength;
Length = Length - TempLength;
Buffer = Buffer + TempLength;
}
@ -622,18 +627,22 @@ NTSTATUS FsdReadFile(PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
if (CurrentCluster == 0)
{
ExFreePool(Temp);
return(STATUS_SUCCESS);
}
(*LengthRead) = (*LengthRead) + DeviceExt->BytesPerCluster;
Buffer = Buffer + DeviceExt->BytesPerCluster;
Length = Length - DeviceExt->BytesPerCluster;
}
CHECKPOINT;
if (Length > 0)
{
(*LengthRead) = (*LengthRead) + Length;
VFATLoadCluster(DeviceExt, Temp, CurrentCluster);
memcpy(Buffer, Temp, Length);
}
ExFreePool(Temp);
return(STATUS_SUCCESS);
}
@ -692,6 +701,7 @@ NTSTATUS FsdRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
PFILE_OBJECT FileObject = Stack->FileObject;
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
NTSTATUS Status;
ULONG LengthRead;
DPRINT("FsdRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
@ -699,10 +709,12 @@ NTSTATUS FsdRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
Offset = Stack->Parameters.Read.ByteOffset.LowPart;
Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset);
Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset,
&LengthRead);
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = Length;
Irp->IoStatus.Information = LengthRead;
IoCompleteRequest(Irp,IO_NO_INCREMENT);
return(Status);

View file

@ -49,7 +49,7 @@ void dprintf(char* fmt, ...)
va_start(va_args,fmt);
vsprintf(buffer,fmt,va_args);
OutputDebugString(buffer);
OutputDebugStringA(buffer);
va_end(fmt);
}

View file

@ -4,7 +4,9 @@ SYNCH_OBJECTS = synch/critical.o synch/event.o synch/wait.o
MISC_OBJECTS = misc/error.o misc/atom.o misc/handle.o misc/env.o misc/dllmain.o
FILE_OBJECTS = file/file.o file/curdir.o file/lfile.o file/dir.o file/iocompl.o file/volume.o file/deviceio.o file/dosdev.o
FILE_OBJECTS = file/file.o file/curdir.o file/lfile.o file/dir.o \
file/iocompl.o file/volume.o file/deviceio.o file/dosdev.o \
file/create.o
MEM_OBJECTS = mem/virtual.o mem/heap.o mem/utils.o
@ -14,7 +16,7 @@ PROCESS_OBJECTS = process/proc.o
STRING_OBJECTS = string/lstring.o
INTERNAL_OBJECTS = internal/dprintf.o internal/vsprintf.o
INTERNAL_OBJECTS = internal/dprintf.o
EXCEPT_OBJECTS = except/except.o

View file

@ -1,6 +1,6 @@
all: ntdll.a
OBJECTS = napi.o
OBJECTS = napi.o stubs/stubs.o string/wstring.o stdio/vsprintf.o
ntdll.a: $(OBJECTS)
$(AR) vcsr ntdll.a $(OBJECTS)

View file

@ -31,7 +31,7 @@ LOADERS = dos
# Select the device drivers and filesystems you want
#
KERNEL_SERVICES = parallel keyboard null mouse serial sound ide test sdisk \
minix vfat
minix vfat ext2fs
APPS = hello shell
@ -104,6 +104,9 @@ serial: dummy
sound: dummy
make -C services/dd/sound
ext2fs: dummy
make -C services/fs/ext2fs
#
# Kernel loaders
#

View file

@ -1,20 +1,29 @@
all: kimage
CC_OBJECTS = cc/cacheman.o cc/block.o
CM_OBJECTS = cm/registry.o
DBG_OBJECTS = dbg/brkpoint.o
EX_OBJECTS = ex/work.o ex/fmutex.o ex/resource.o ex/time.o ex/interlck.o \
ex/callback.o ex/napi.o ex/power.o ex/sysinfo.o ex/locale.o \
ex/stamp.o
#
# Defines $(HAL_OBJECTS)
#
include hal/x86/sources
NT_OBJECTS = nt/port.o nt/channel.o nt/ntevent.o nt/nttimer.o nt/atom.o \
nt/evtpair.o nt/ntsem.o nt/mutant.o nt/misc.o nt/plugplay.o \
nt/profile.o
RTL_OBJECTS = rtl/vsprintf.o rtl/lookas.o rtl/unicode.o rtl/strtok.o \
rtl/time.o rtl/unalign.o rtl/mem.o rtl/largeint.o rtl/ctype.o \
rtl/list.o rtl/slist.o rtl/interlck.o rtl/return.o \
rtl/wstring.o
KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o ke/exports.o \
ke/module.o ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \
ke/sem.o ke/critical.o ke/event.o ke/apc.o ke/bug.o \
ke/mutex.o ke/kernel.o ke/ldt.o ke/apchelp.o
MM_OBJECTS = mm/mm.o mm/freelist.o mm/pool.o mm/virtual.o \
mm/mdl.o mm/zone.o mm/special.o mm/paging.o \
mm/section.o mm/marea.o mm/ppool.o mm/npool.o
IO_OBJECTS = io/iomgr.o io/create.o io/irp.o io/device.o io/rw.o \
io/queue.o io/drvlck.o io/timer.o io/share.o io/errlog.o \
io/shutdown.o io/fdisk.o io/cancel.o io/error.o io/arc.o \
@ -23,46 +32,26 @@ IO_OBJECTS = io/iomgr.o io/create.o io/irp.o io/device.o io/rw.o \
io/fs.o io/vpb.o io/buildirp.o io/flush.o io/dir.o io/iocomp.o \
io/mailslot.o io/npipe.o io/lock.o io/page.o io/cleanup.o
KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o ke/exports.o \
ke/module.o ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \
ke/sem.o ke/critical.o ke/event.o ke/apc.o ke/bug.o \
ke/mutex.o ke/kernel.o ke/ldt.o ke/apchelp.o
LDR_OBJECTS = ldr/loader.o
MM_OBJECTS = mm/mm.o mm/freelist.o mm/pool.o mm/virtual.o \
mm/mdl.o mm/zone.o mm/special.o mm/paging.o \
mm/section.o mm/marea.o mm/ppool.o mm/npool.o
NT_OBJECTS = nt/port.o nt/channel.o nt/ntevent.o nt/nttimer.o nt/atom.o \
nt/evtpair.o nt/ntsem.o nt/mutant.o nt/misc.o nt/plugplay.o \
nt/profile.o
OB_OBJECTS = ob/object.o ob/handle.o ob/namespc.o
PS_OBJECTS = ps/psmgr.o ps/thread.o ps/process.o ps/idle.o ps/kill.o \
ps/tinfo.o
RTL_OBJECTS = rtl/vsprintf.o rtl/lookas.o rtl/unicode.o rtl/strtok.o \
rtl/time.o rtl/unalign.o rtl/mem.o rtl/largeint.o rtl/ctype.o \
rtl/list.o rtl/slist.o rtl/interlck.o rtl/return.o \
rtl/wstring.o
EX_OBJECTS = ex/work.o ex/fmutex.o ex/resource.o ex/time.o ex/interlck.o \
ex/callback.o ex/napi.o ex/power.o ex/sysinfo.o ex/locale.o \
ex/stamp.o
SE_OBJECTS = se/semgr.o
CM_OBJECTS = cm/registry.o
TST_OBJECTS = tst/test.o tst/sshell.o tst/readline.o
objects/cc.o: $(CC_OBJECTS)
$(LD) -r $(CC_OBJECTS) -o objects/cc.o
DBG_OBJECTS = dbg/brkpoint.o
objects/cm.o: $(CM_OBJECTS)
$(LD) -r $(CM_OBJECTS) -o objects/cm.o
LDR_OBJECTS = ldr/loader.o
objects/dbg.o: $(DBG_OBJECTS)
$(LD) -r $(DBG_OBJECTS) -o objects/dbg.o
objects/ex.o: $(EX_OBJECTS)
$(LD) -r $(EX_OBJECTS) -o objects/ex.o
CC_OBJECTS = cc/cacheman.o cc/block.o
objects/hal.o: $(HAL_OBJECTS)
$(LD) -r $(HAL_OBJECTS) -o objects/hal.o
@ -70,37 +59,47 @@ objects/hal.o: $(HAL_OBJECTS)
objects/io.o: $(IO_OBJECTS)
$(LD) -r $(IO_OBJECTS) -o objects/io.o
objects/ldr.o: $(LDR_OBJECTS)
$(LD) -r $(LDR_OBJECTS) -o objects/ldr.o
objects/ke.o: $(KE_OBJECTS)
$(LD) -r $(KE_OBJECTS) -o objects/ke.o
objects/rtl.o: $(RTL_OBJECTS)
$(LD) -r $(RTL_OBJECTS) -o objects/rtl.o
objects/mm.o: $(MM_OBJECTS)
$(LD) -r $(MM_OBJECTS) -o objects/mm.o
objects/nt.o: $(NT_OBJECTS)
$(LD) -r $(NT_OBJECTS) -o objects/nt.o
objects/ob.o: $(OB_OBJECTS)
$(LD) -r $(OB_OBJECTS) -o objects/ob.o
objects/ps.o: $(PS_OBJECTS)
$(LD) -r $(PS_OBJECTS) -o objects/ps.o
objects/rtl.o: $(RTL_OBJECTS)
$(LD) -r $(RTL_OBJECTS) -o objects/rtl.o
objects/ex.o: $(EX_OBJECTS)
$(LD) -r $(EX_OBJECTS) -o objects/ex.o
objects/se.o: $(SE_OBJECTS)
$(LD) -r $(SE_OBJECTS) -o objects/se.o
objects/cm.o: $(CM_OBJECTS)
$(LD) -r $(CM_OBJECTS) -o objects/cm.o
objects/tst.o: $(TST_OBJECTS)
$(LD) -r $(TST_OBJECTS) -o objects/tst.o
OBJECTS = objects/cc.o objects/cm.o objects/dbg.o objects/ex.o \
objects/hal.o objects/io.o objects/ke.o objects/ldr.o \
objects/mm.o objects/nt.o objects/ob.o objects/ps.o objects/rtl.o \
objects/se.o objects/tst.o
objects/dbg.o: $(DBG_OBJECTS)
$(LD) -r $(DBG_OBJECTS) -o objects/dbg.o
objects/nt.o: $(NT_OBJECTS)
$(LD) -r $(NT_OBJECTS) -o objects/nt.o
objects/cc.o: $(CC_OBJECTS)
$(LD) -r $(CC_OBJECTS) -o objects/cc.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/se.o objects/cm.o objects/tst.o objects/dbg.o\
objects/nt.o objects/cc.o
utils/export/export$(EXE_POSTFIX): utils/export/export.c
$(NATIVE_CC) -g utils/export/export.c -o utils/export/export$(EXE_POSTFIX)
@ -110,7 +109,7 @@ ke/exports.o: exports.lst utils/export/export$(EXE_POSTFIX)
$(CC) $(CFLAGS) -c ke/exports.c -o ke/exports.o
kimage: $(OBJECTS)
$(LD) --defsym _end=end --defsym _etext=etext --oformat=$(KERNEL_BFD_TARGET) -Ttext c0000000 $(LDFLAGS) $(OBJECTS) $(LIBGCC) -o kimage
$(LD) --defsym _end=end --defsym _etext=etext $(KERNEL_BFD_TARGET) -Ttext c0000000 $(LDFLAGS) $(OBJECTS) $(LIBGCC) -o kimage
$(NM) --numeric-sort kimage > kernel.sym
$(OBJCOPY) -S --gap-fill=0 -O binary kimage kimage.bin
@ -125,7 +124,4 @@ ex/napi.o: ex/napi.c ../include/ntdll/napi.h
WITH_DEBUGGING = yes
WIN32_LEAN_AND_MEAN = yes
include ../rules.mak

View file

@ -10,7 +10,7 @@
ifeq ($(HOST),elf-linux)
NASM_FORMAT = elf
PREFIX =
KERNEL_BFD_TARGET = elf32-i386
KERNEL_BFD_TARGET = --oformat=elf32-i386
EXE_POSTFIX =
CP = cp
endif
@ -18,7 +18,7 @@ endif
ifeq ($(HOST),djgpp-linux)
NASM_FORMAT = coff
PREFIX = dos-
KERNEL_BFD_TARGET = coff-i386
KERNEL_BFD_TARGET = --oformat=coff-i386
EXE_POSTFIX =
CP = cp
LIBGCC = ./libgcc.a
@ -26,27 +26,30 @@ endif
ifeq ($(HOST),mingw32-linux)
NASM_FORMAT = win32
PREFIX = /opt/gnu/bin/i386-mingw32-
KERNEL_BFD_TARGET = pe-i386
PREFIX = i386-mingw32-
#KERNEL_BFD_TARGET = pe-i386
KERNEL_BFD_TARGET =
EXE_POSTFIX =
CP = cp
DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
LIBGCC = /opt/gnu/lib/gcc-lib/i386-mingw32/2.8.0/libgcc.a
LIBGCC = /usr/lib/gcc-lib/i386-mingw32/2.8.1/libgcc.a
NASM_CMD = nasm
endif
ifeq ($(HOST),djgpp-msdos)
NASM_FORMAT = coff
PREFIX =
KERNEL_BFD_TARGET = coff-go32
KERNEL_BFD_TARGET = --oformat=coff-go32
EXE_POSTFIX = .exe
CP = copy
LIBGCC = libgcc.a
NASM_CMD = nasm
endif
ifeq ($(HOST),mingw32-windows)
NASM_FORMAT = win32
PREFIX =
KERNEL_BFD_TARGET = pe-i386
KERNEL_BFD_TARGET = --oformat=pe-i386
EXE_POSTFIX = .exe
CP = copy
endif
@ -74,7 +77,6 @@ CFLAGS = -O2 -I../../../include -I../../include \
-I../include -fno-builtin $(LEAN_AND_MEAN_DEFINE) \
$(DEFINES) -Wall -Wstrict-prototypes $(DEBUGGING_CFLAGS)
CXXFLAGS = $(CFLAGS)
NASM_CMD = nasmw
NFLAGS = -i../../include/ -i../include/ -pinternal/asm.inc -f$(NASM_FORMAT) -d$(NASM_FORMAT)
LD = $(PREFIX)ld
NM = $(PREFIX)nm