replace the VHD/diskpart disk image pipeline with a directory-based vvfat root, we'll see when it breaks, fix /O2, add an all_tests, generalize the fat32 driver into a fat 16+32 driver, change policy on volume drivers, collapse KCPU's fields into a single atomic KE_CPU_STATE state machine, move scheduler ticking to per-CPU LAPIC timers, gate verbose SMP topology logging behind selftest diagnostics and add SMP pool-checkpoint validation around AP admission, add checked intrusive list helpers behind a new KE_DEBUG_LIST_CHECKS flag, add ObInitializeObjectHeader/ObTryReferenceObject, add waitable display clock objects and a SYS_OPEN_DISPLAY_CLOCK syscall for vsync-style waits, refactor kernel input into a per-queue KE_INPUT_CONTEXT with its own key/mouse ring buffers and DPC-driven key repeat, add KeInputQueuePeekEvent/ReadEvent/WaitKey and a SYS_QUERY_GLOBAL_INPUT_STATE syscall, split the kernel pool allocator out of mm_virt, new video files!
This commit is contained in:
1 parent
485a6bbfe7
commit
8b254f84f4
74 files changed
+4488
-2503
No files matched your search
@@ -5,7 +5,7 @@ serial.sys
|
||||
ahci.sys
|
||||
ata.sys
|
||||
usb.sys
|
||||
fat32.sys
|
||||
fat.sys
|
||||
ntfs.sys
|
||||
|
||||
[runtime]
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,44 @@
|
||||
// FAT driver internals shared by mount, directory, and file I/O code.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <ntlite/ddi/io_driver.h>
|
||||
#include <ntlite/ddk/ddk.h>
|
||||
#include <ntlite/ddk/file.h>
|
||||
#include <ntlite/ddk/memory.h>
|
||||
#include <ntlite/ddk/debug.h>
|
||||
#include <ntlite/ddk/irp.h>
|
||||
#include <ntlite/ddk/semaphore.h>
|
||||
#include <ntlite/ddk/thread.h>
|
||||
#include <ntlite/ddk/scheduler.h>
|
||||
#include <ntlite/ddk/time.h>
|
||||
#include <ntlite/ddk/mutex.h>
|
||||
#include <ntlite/ddk/irql.h>
|
||||
|
||||
typedef struct FAT_VOL_S FAT_VOL;
|
||||
|
||||
KSTATUS FatOpen(IO_FILESYSTEM *fs, SYS_STRING_VIEW path, void **fileCtx);
|
||||
void FatClose(IO_FILESYSTEM *fs, void *fileCtx);
|
||||
KSTATUS FatRead(IO_FILESYSTEM *fs, void *fileCtx, uint64_t offset, void *buf, size_t size, size_t *bytesRead);
|
||||
KSTATUS FatWrite(IO_FILESYSTEM *fs, void *fileCtx, uint64_t offset, const void *buf, size_t size, size_t *bytesWritten);
|
||||
KSTATUS FatReadAsync(IO_FILESYSTEM *fs, void *fileCtx, uint64_t offset, void *buf, size_t size, IO_FS_ASYNC_COMPLETE complete, void *completeContext);
|
||||
KSTATUS FatWriteAsync(IO_FILESYSTEM *fs, void *fileCtx, uint64_t offset, const void *buf, size_t size, IO_FS_ASYNC_COMPLETE complete, void *completeContext);
|
||||
KSTATUS FatCreate(IO_FILESYSTEM *fs, SYS_STRING_VIEW path, void **fileCtx);
|
||||
KSTATUS FatCreateDir(IO_FILESYSTEM *fs, SYS_STRING_VIEW path);
|
||||
KSTATUS FatRemoveDir(IO_FILESYSTEM *fs, SYS_STRING_VIEW path);
|
||||
KSTATUS FatDelete(IO_FILESYSTEM *fs, SYS_STRING_VIEW path);
|
||||
KSTATUS FatTruncate(IO_FILESYSTEM *fs, void *fileCtx, uint64_t newSize, uint32_t fileFlags);
|
||||
uint64_t FatGetSize(IO_FILESYSTEM *fs, void *fileCtx);
|
||||
KSTATUS FatQueryInfo(IO_FILESYSTEM *fs, void *fileCtx, SYS_FILE_STAT *out);
|
||||
KSTATUS FatStat(IO_FILESYSTEM *fs, SYS_STRING_VIEW path, SYS_FILE_STAT *out);
|
||||
KSTATUS FatQueryIdentity(IO_FILESYSTEM *fs, void *fileCtx, IO_FILE_IDENTITY *out);
|
||||
KSTATUS FatOpenDir(IO_FILESYSTEM *fs, SYS_STRING_VIEW dirPath, void **dirCtx);
|
||||
KSTATUS FatReadDir(IO_FILESYSTEM *fs, void *dirCtx, KDIR_ENTRY *out);
|
||||
void FatCloseDir(IO_FILESYSTEM *fs, void *dirCtx);
|
||||
void FatQueryStats(IO_FILESYSTEM *fs, IO_FILESYSTEM_STATS *out);
|
||||
|
||||
void FatInitVtable(IO_FILESYSTEM* fs, FAT_VOL* vol);
|
||||
@@ -0,0 +1,119 @@
|
||||
// FAT on-disk layout definitions shared by the FAT driver.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef struct {
|
||||
uint8_t Jump[3];
|
||||
char OemId[8];
|
||||
uint16_t BytesPerSector;
|
||||
uint8_t SectorsPerCluster;
|
||||
uint16_t ReservedSectors;
|
||||
uint8_t NumFats;
|
||||
uint16_t RootEntryCount;
|
||||
uint16_t TotalSectors16;
|
||||
uint8_t MediaType;
|
||||
uint16_t FatSize16;
|
||||
uint16_t SectorsPerTrack;
|
||||
uint16_t NumHeads;
|
||||
uint32_t HiddenSectors;
|
||||
uint32_t TotalSectors32;
|
||||
uint32_t FatSize32;
|
||||
uint16_t ExtFlags;
|
||||
uint16_t FsVersion;
|
||||
uint32_t RootCluster;
|
||||
uint16_t FsInfoSector;
|
||||
uint16_t BackupBootSector;
|
||||
uint8_t Reserved[12];
|
||||
uint8_t DriveNumber;
|
||||
uint8_t Reserved1;
|
||||
uint8_t BootSignature;
|
||||
uint32_t VolumeId;
|
||||
char VolumeLabel[11];
|
||||
char FsType[8];
|
||||
} BPB;
|
||||
|
||||
typedef struct {
|
||||
char Name[8];
|
||||
char Ext[3];
|
||||
uint8_t Attr;
|
||||
uint8_t Reserved;
|
||||
uint8_t CrtTimeTenth;
|
||||
uint16_t CrtTime;
|
||||
uint16_t CrtDate;
|
||||
uint16_t LastAccDate;
|
||||
uint16_t FirstClusterHi;
|
||||
uint16_t WrtTime;
|
||||
uint16_t WrtDate;
|
||||
uint16_t FirstClusterLo;
|
||||
uint32_t FileSize;
|
||||
} DIRENT;
|
||||
|
||||
typedef struct {
|
||||
uint8_t Order;
|
||||
uint16_t Name1[5];
|
||||
uint8_t Attr;
|
||||
uint8_t Type;
|
||||
uint8_t Checksum;
|
||||
uint16_t Name2[6];
|
||||
uint16_t FirstCluster;
|
||||
uint16_t Name3[2];
|
||||
} LFN_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
uint32_t Data1;
|
||||
uint16_t Data2;
|
||||
uint16_t Data3;
|
||||
uint8_t Data4[8];
|
||||
} EFI_GUID;
|
||||
|
||||
typedef struct {
|
||||
char Signature[8];
|
||||
uint32_t Revision;
|
||||
uint32_t HeaderSize;
|
||||
uint32_t HeaderCRC32;
|
||||
uint32_t Reserved;
|
||||
uint64_t MyLBA;
|
||||
uint64_t AlternateLBA;
|
||||
uint64_t FirstUsableLBA;
|
||||
uint64_t LastUsableLBA;
|
||||
EFI_GUID DiskGUID;
|
||||
uint64_t PartitionEntryLBA;
|
||||
uint32_t NumberOfPartitionEntries;
|
||||
uint32_t SizeOfPartitionEntry;
|
||||
uint32_t PartitionEntryArrayCRC32;
|
||||
} GPT_HEADER;
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID PartitionTypeGUID;
|
||||
EFI_GUID UniquePartitionGUID;
|
||||
uint64_t StartingLBA;
|
||||
uint64_t EndingLBA;
|
||||
uint64_t Attributes;
|
||||
uint16_t PartitionName[36];
|
||||
} GPT_ENTRY;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#define ATTR_VOLUME_ID 0x08
|
||||
#define ATTR_DIRECTORY 0x10
|
||||
#define ATTR_ARCHIVE 0x20
|
||||
#define ATTR_LFN 0x0F
|
||||
#define FAT_NTRES_BASE_LOWER 0x08u
|
||||
#define FAT_NTRES_EXT_LOWER 0x10u
|
||||
#define FAT_FREE 0x00000000u
|
||||
#define FAT16_EOC 0x0000FFF8u
|
||||
#define FAT16_EOC_MARK 0x0000FFFFu
|
||||
#define FAT32_EOC 0x0FFFFFF8u
|
||||
#define FAT32_EOC_MARK 0x0FFFFFFFu
|
||||
#define FAT_FIXED_ROOT_CLUSTER 0xFFFFFFFEu
|
||||
|
||||
typedef enum FAT_VARIANT {
|
||||
FatVariantUnsupported = 0,
|
||||
FatVariant12,
|
||||
FatVariant16,
|
||||
FatVariant32,
|
||||
} FAT_VARIANT;
|
||||
@@ -0,0 +1,28 @@
|
||||
// FAT mount logic. This file owns volume probing, BPB validation, and mount-table insertion.
|
||||
|
||||
#include "fat.h"
|
||||
|
||||
// Initializes vtable.
|
||||
void FatInitVtable(IO_FILESYSTEM* fs, FAT_VOL* vol) {
|
||||
memset(fs, 0, sizeof(*fs));
|
||||
fs->Open = FatOpen;
|
||||
fs->Read = FatRead;
|
||||
fs->Write = FatWrite;
|
||||
fs->ReadAsync = FatReadAsync;
|
||||
fs->WriteAsync = FatWriteAsync;
|
||||
fs->Create = FatCreate;
|
||||
fs->Delete = FatDelete;
|
||||
fs->CreateDir = FatCreateDir;
|
||||
fs->RemoveDir = FatRemoveDir;
|
||||
fs->Truncate = FatTruncate;
|
||||
fs->GetSize = FatGetSize;
|
||||
fs->QueryInfo = FatQueryInfo;
|
||||
fs->Stat = FatStat;
|
||||
fs->QueryIdentity = FatQueryIdentity;
|
||||
fs->Close = FatClose;
|
||||
fs->DriverCtx = vol;
|
||||
fs->OpenDir = FatOpenDir;
|
||||
fs->ReadDir = FatReadDir;
|
||||
fs->CloseDir = FatCloseDir;
|
||||
fs->QueryStats = FatQueryStats;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// FAT32 driver internals shared by mount, directory, and file I/O code.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <ntlite/ddi/io_driver.h>
|
||||
#include <ntlite/ddk/ddk.h>
|
||||
#include <ntlite/ddk/file.h>
|
||||
#include <ntlite/ddk/memory.h>
|
||||
#include <ntlite/ddk/debug.h>
|
||||
#include <ntlite/ddk/irp.h>
|
||||
#include <ntlite/ddk/semaphore.h>
|
||||
#include <ntlite/ddk/thread.h>
|
||||
#include <ntlite/ddk/scheduler.h>
|
||||
#include <ntlite/ddk/time.h>
|
||||
#include <ntlite/ddk/mutex.h>
|
||||
#include <ntlite/ddk/irql.h>
|
||||
|
||||
typedef struct FAT32_VOL_S FAT32_VOL;
|
||||
|
||||
KSTATUS Fat32Open(IO_FILESYSTEM *fs, SYS_STRING_VIEW path, void **fileCtx);
|
||||
void Fat32Close(IO_FILESYSTEM *fs, void *fileCtx);
|
||||
KSTATUS Fat32Read(IO_FILESYSTEM *fs, void *fileCtx, uint64_t offset, void *buf, size_t size, size_t *bytesRead);
|
||||
KSTATUS Fat32Write(IO_FILESYSTEM *fs, void *fileCtx, uint64_t offset, const void *buf, size_t size, size_t *bytesWritten);
|
||||
KSTATUS Fat32ReadAsync(IO_FILESYSTEM *fs, void *fileCtx, uint64_t offset, void *buf, size_t size, IO_FS_ASYNC_COMPLETE complete, void *completeContext);
|
||||
KSTATUS Fat32WriteAsync(IO_FILESYSTEM *fs, void *fileCtx, uint64_t offset, const void *buf, size_t size, IO_FS_ASYNC_COMPLETE complete, void *completeContext);
|
||||
KSTATUS Fat32Create(IO_FILESYSTEM *fs, SYS_STRING_VIEW path, void **fileCtx);
|
||||
KSTATUS Fat32CreateDir(IO_FILESYSTEM *fs, SYS_STRING_VIEW path);
|
||||
KSTATUS Fat32RemoveDir(IO_FILESYSTEM *fs, SYS_STRING_VIEW path);
|
||||
KSTATUS Fat32Delete(IO_FILESYSTEM *fs, SYS_STRING_VIEW path);
|
||||
KSTATUS Fat32Truncate(IO_FILESYSTEM *fs, void *fileCtx, uint64_t newSize, uint32_t fileFlags);
|
||||
uint64_t Fat32GetSize(IO_FILESYSTEM *fs, void *fileCtx);
|
||||
KSTATUS Fat32QueryInfo(IO_FILESYSTEM *fs, void *fileCtx, SYS_FILE_STAT *out);
|
||||
KSTATUS Fat32Stat(IO_FILESYSTEM *fs, SYS_STRING_VIEW path, SYS_FILE_STAT *out);
|
||||
KSTATUS Fat32QueryIdentity(IO_FILESYSTEM *fs, void *fileCtx, IO_FILE_IDENTITY *out);
|
||||
KSTATUS Fat32OpenDir(IO_FILESYSTEM *fs, SYS_STRING_VIEW dirPath, void **dirCtx);
|
||||
KSTATUS Fat32ReadDir(IO_FILESYSTEM *fs, void *dirCtx, KDIR_ENTRY *out);
|
||||
void Fat32CloseDir(IO_FILESYSTEM *fs, void *dirCtx);
|
||||
void Fat32QueryStats(IO_FILESYSTEM *fs, IO_FILESYSTEM_STATS *out);
|
||||
|
||||
void Fat32InitVtable(IO_FILESYSTEM* fs, FAT32_VOL* vol);
|
||||
@@ -1,28 +0,0 @@
|
||||
// FAT32 mount logic. This file owns volume probing, BPB validation, and mount-table insertion.
|
||||
|
||||
#include "fat32.h"
|
||||
|
||||
// Initializes vtable.
|
||||
void Fat32InitVtable(IO_FILESYSTEM* fs, FAT32_VOL* vol) {
|
||||
memset(fs, 0, sizeof(*fs));
|
||||
fs->Open = Fat32Open;
|
||||
fs->Read = Fat32Read;
|
||||
fs->Write = Fat32Write;
|
||||
fs->ReadAsync = Fat32ReadAsync;
|
||||
fs->WriteAsync = Fat32WriteAsync;
|
||||
fs->Create = Fat32Create;
|
||||
fs->Delete = Fat32Delete;
|
||||
fs->CreateDir = Fat32CreateDir;
|
||||
fs->RemoveDir = Fat32RemoveDir;
|
||||
fs->Truncate = Fat32Truncate;
|
||||
fs->GetSize = Fat32GetSize;
|
||||
fs->QueryInfo = Fat32QueryInfo;
|
||||
fs->Stat = Fat32Stat;
|
||||
fs->QueryIdentity = Fat32QueryIdentity;
|
||||
fs->Close = Fat32Close;
|
||||
fs->DriverCtx = vol;
|
||||
fs->OpenDir = Fat32OpenDir;
|
||||
fs->ReadDir = Fat32ReadDir;
|
||||
fs->CloseDir = Fat32CloseDir;
|
||||
fs->QueryStats = Fat32QueryStats;
|
||||
}
|
||||
@@ -1701,15 +1701,23 @@ KSTATUS DriverEntry(const NTL_DDK* ddk, NTL_DRIVER_INIT* init) {
|
||||
memset(gDiskScanned, 0, sizeof(gDiskScanned));
|
||||
gMountedCount = 0;
|
||||
|
||||
KSTATUS s = IoRegisterDiskChangeCallback(NtfsDiskChange, (void*)0);
|
||||
if (!KSUCCESS(s)) DbgPrint("NTFS: disk-change callback registration failed st=0x%x\n", s);
|
||||
s = IoEnumerateDiskDevices(NtfsDiskArrival, (void*)0);
|
||||
if (!KSUCCESS(s)) DbgPrint("NTFS: initial disk enumeration failed st=0x%x\n", s);
|
||||
KSTATUS cbStatus = IoRegisterDiskChangeCallback(NtfsDiskChange, (void*)0);
|
||||
bool callbackRegistered = KSUCCESS(cbStatus);
|
||||
if (!callbackRegistered)
|
||||
DbgPrint("NTFS: disk-change callback registration failed st=0x%x\n", cbStatus);
|
||||
|
||||
if (!gMountedCount) {
|
||||
DbgPrint("NTFS: no mountable NTFS volumes found.\n");
|
||||
return NTLSTATUS_NOT_SUPPORTED;
|
||||
KSTATUS enumStatus = IoEnumerateDiskDevices(NtfsDiskArrival, (void*)0);
|
||||
if (!KSUCCESS(enumStatus))
|
||||
DbgPrint("NTFS: initial disk enumeration failed st=0x%x\n", enumStatus);
|
||||
|
||||
if (!gMountedCount && !callbackRegistered) {
|
||||
DbgPrint("NTFS: no mountable NTFS volumes found and disk-change callback unavailable.\n");
|
||||
return cbStatus;
|
||||
}
|
||||
|
||||
if (!gMountedCount)
|
||||
DbgPrint("NTFS: no mountable NTFS volumes found; driver resident for disk changes.\n");
|
||||
|
||||
DbgPrint("NTFS: Init complete; mounted %u volume(s).\n", gMountedCount);
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
Reference in new issue
Block a user