isolate POSIX builds from the host UCRT, wire lwext4 and ntfs-3g as ext4.sys and ntfs.sys, split the FAT driver into directory/file/async/driver/mount units, add posixsrv and dwm plus input/console/desktop syscall clients and a pile of new smoke targets, rename serial.sys to cereal.sys, name HDA/USB/lwIP/AHCI workers, harden ATA probing/reset/removal around actual hardware deadlines, absent-channel detection, diagnostics and explicit worker lifetime, redo ACPI S5 shutdown around GAS/MMIO and HW-reduced firmware, scan SSDTs for _S5 and deal with Intel SMI sleep trapping, make serial and SMP timeouts use real monotonic deadlines, add thread names and fix terminal thread teardown, scheduler and APC prepare/commit races, make advisory file locks queryable and preserve split ranges and add mutable file append state, add shared-memory pipes with kernel-assisted wait/wake, introduce capability-scoped input and display managers, split surface map rights into read/write, add explicit unmap and replace present with commit/generation/damage tracking while keeping physical presentation under the display manager, decouple native exception classes from Win32 exception numbers and translate them in kernel32, add opaque process startup data, bump the resource protocol to v3 with namespace directories, symlinks and enumeration and service control to v2 with generic READY handle exports, add the new POSIX errno/status surface and rebuild fds around posixsrv-owned shared open descriptions, descriptor-local flags, exact inheritance snapshots, dup/fcntl/record locks and shared-ring pipes, add waitpid, POSIX credentials/groups/sessions/passwd/group lookups and move sockets onto stable open descriptions, port the shells and apps to the new console/input services and surface commit API, teach init to load services.ini and start/supervise RSSRV, DWM and generic services under restricted capabilities while publishing their endpoints through RSSRV, split RSSRV into namespace, volume, display, session, input, console and resource components and make /SystemRoot a real symlink to the independently published system volume, shift the syscall table again, expand lock/resource/surface/POSIX/service/thread smoke coverage, make docs scream ASK QUESTIONS and DISCUSS at LLMs, replace MIT No Attribution with WTFPL+.
This commit is contained in:
1 parent
3dacbd32c8
commit
73abd6f90d
441 files changed
+187073
-6549
No files matched your search
+44
-13
@@ -433,12 +433,14 @@ static PROCESS* KiLaunchUserProcess(const char* filePath, const char* args) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Bootstrap init receives read-only system-volume authority, separate namespace-seeding
|
||||
// authority, and the volume-manager capability used to supervise RSSRV publication.
|
||||
// The bootstrap service manager receives only the capabilities required to construct
|
||||
// the initial user-mode resource plane. Its PID is deliberately not part of this ABI.
|
||||
IO_VOLUME* systemVolume = (IO_VOLUME*)0;
|
||||
SYS_HANDLE systemVolumeHandle = SYS_HANDLE_INVALID;
|
||||
SYS_HANDLE namespaceVolumeHandle = SYS_HANDLE_INVALID;
|
||||
SYS_HANDLE volumeManagerHandle = SYS_HANDLE_INVALID;
|
||||
SYS_HANDLE inputManagerHandle = SYS_HANDLE_INVALID;
|
||||
SYS_HANDLE displayManagerHandle = SYS_HANDLE_INVALID;
|
||||
s = KeReferenceSystemRootVolume(&systemVolume);
|
||||
if (KSUCCESS(s)) {
|
||||
s = KeCreateHandle(proc, &systemVolume->Header,
|
||||
@@ -464,18 +466,46 @@ static PROCESS* KiLaunchUserProcess(const char* filePath, const char* args) {
|
||||
ObDereferenceObject(&volumeManager->Header);
|
||||
}
|
||||
}
|
||||
if (KSUCCESS(s)) {
|
||||
KE_INPUT_MANAGER* inputManager = (KE_INPUT_MANAGER*)0;
|
||||
s = KeInputReferenceManager(&inputManager);
|
||||
if (KSUCCESS(s)) {
|
||||
s = KeCreateHandle(proc, &inputManager->Header,
|
||||
SYS_RIGHT_DUPLICATE | SYS_RIGHT_TRANSFER | SYS_RIGHT_QUERY |
|
||||
SYS_INPUT_MANAGER_RIGHT_READ | SYS_INPUT_MANAGER_RIGHT_CONFIGURE,
|
||||
&inputManagerHandle);
|
||||
ObDereferenceObject(&inputManager->Header);
|
||||
}
|
||||
}
|
||||
if (KSUCCESS(s)) {
|
||||
KE_DISPLAY_MANAGER* displayManager = (KE_DISPLAY_MANAGER*)0;
|
||||
s = KeDisplayReferenceManager(&displayManager);
|
||||
if (KSUCCESS(s)) {
|
||||
// Init must be able to attenuate this manager again when RSSRV publishes
|
||||
// narrower display capabilities such as /Device/Display0.
|
||||
s = KeCreateHandle(proc, &displayManager->Header,
|
||||
SYS_RIGHT_DUPLICATE | SYS_RIGHT_DERIVE | SYS_RIGHT_TRANSFER | SYS_RIGHT_QUERY |
|
||||
SYS_DISPLAY_MANAGER_RIGHT_ENUMERATE | SYS_DISPLAY_MANAGER_RIGHT_MODESET |
|
||||
SYS_DISPLAY_MANAGER_RIGHT_PRESENT | SYS_DISPLAY_MANAGER_RIGHT_CURSOR |
|
||||
SYS_DISPLAY_MANAGER_RIGHT_CONSOLE,
|
||||
&displayManagerHandle);
|
||||
ObDereferenceObject(&displayManager->Header);
|
||||
}
|
||||
}
|
||||
if (!KSUCCESS(s)) {
|
||||
DbgPrint("KiLaunchUserProcess: Failed to create bootstrap startup capabilities. Status: %d\n", s);
|
||||
IoCloseFile(f);
|
||||
ObDereferenceObject(&proc->Header);
|
||||
return 0;
|
||||
}
|
||||
SYS_STARTUP_CAPABILITY startupCapabilities[3] = {
|
||||
SYS_STARTUP_CAPABILITY startupCapabilities[5] = {
|
||||
{ SYS_STARTUP_CAP_SYSTEM_VOLUME, systemVolumeHandle },
|
||||
{ SYS_STARTUP_CAP_SYSTEM_VOLUME_NAMESPACE, namespaceVolumeHandle },
|
||||
{ SYS_STARTUP_CAP_VOLUME_MANAGER, volumeManagerHandle },
|
||||
{ SYS_STARTUP_CAP_INPUT_MANAGER, inputManagerHandle },
|
||||
{ SYS_STARTUP_CAP_DISPLAY_MANAGER, displayManagerHandle },
|
||||
};
|
||||
s = KeSetProcessStartupCapabilities(proc, startupCapabilities, 3);
|
||||
s = KeSetProcessStartupCapabilities(proc, startupCapabilities, 5);
|
||||
if (!KSUCCESS(s)) {
|
||||
DbgPrint("KiLaunchUserProcess: Failed to install startup capabilities. Status: %d\n", s);
|
||||
IoCloseFile(f);
|
||||
@@ -513,7 +543,8 @@ static PROCESS* KiLaunchUserProcess(const char* filePath, const char* args) {
|
||||
uintptr_t entryPoint = LdrGetEntryPoint(imageBase);
|
||||
|
||||
// Create the main thread last. KeCreateThread queues it before returning.
|
||||
const KE_THREAD_CREATE_PARAMETERS threadParameters = KE_THREAD_CREATE_NORMAL(PriorityNormal);
|
||||
const KE_THREAD_CREATE_PARAMETERS threadParameters =
|
||||
KE_THREAD_CREATE_NAMED_NORMAL(PriorityNormal, proc->Name);
|
||||
s = KeCreateThread(proc, (uintptr_t)entryPoint, 0, &threadParameters, &thread);
|
||||
if (!KSUCCESS(s)) {
|
||||
DbgPrint("KiLaunchUserProcess: Failed to create thread. Status: %d\n", s);
|
||||
@@ -549,20 +580,20 @@ void SystemInitThread(void* arg) {
|
||||
if (args->BootConfig.Debug & KE_DEBUG_SELFTEST)
|
||||
KiRunKernelSelfTests(args->Hal);
|
||||
|
||||
// Launch User-Mode init.exe.
|
||||
PROCESS* shellProc = KiLaunchUserProcess("system/init.exe", args->BootConfig.CommandLine);
|
||||
if (!shellProc) {
|
||||
// Launch the bootstrap service manager. Its allocated PID is not a system contract.
|
||||
PROCESS* initProcess = KiLaunchUserProcess("system/init.exe", args->BootConfig.CommandLine);
|
||||
if (!initProcess) {
|
||||
DbgPrint("SystemInitThread: Failed to start system/init.exe.\n");
|
||||
KePanic(KE_PANIC_CODE_INIT, "SystemInitThread: Failed to start system/init.exe.\n");
|
||||
}
|
||||
|
||||
KeWaitForEvent(shellProc->ExitEvent, 0);
|
||||
int exitCode = shellProc->ExitCode;
|
||||
KeWaitForEvent(initProcess->ExitEvent, 0);
|
||||
int exitCode = initProcess->ExitCode;
|
||||
if (exitCode != 0) {
|
||||
KePanic(KE_PANIC_CODE_INIT, "SystemInitThread: init.exe exited with code %d.\n", exitCode);
|
||||
}
|
||||
DbgPrint("SystemInitThread: init.exe exited with code %d.\n", exitCode);
|
||||
ObDereferenceObject(&shellProc->Header);
|
||||
ObDereferenceObject(&initProcess->Header);
|
||||
|
||||
if (args->BootConfig.Debug & (KE_DEBUG_CONSOLE | KE_DEBUG_FILE_LOG)) {
|
||||
KSTATUS logStatus = KeFlushDebugLogToSystemRoot("kernel.log");
|
||||
@@ -805,7 +836,8 @@ extern void KernelMain(BOOT_INFO* bootInfo) {
|
||||
|
||||
// Spawn the Initialization Thread. No creator reference is needed; the
|
||||
// scheduler owns the live thread lifetime.
|
||||
const KE_THREAD_CREATE_PARAMETERS initThreadParameters = KE_THREAD_CREATE_NORMAL(PriorityNormal);
|
||||
const KE_THREAD_CREATE_PARAMETERS initThreadParameters =
|
||||
KE_THREAD_CREATE_NAMED_NORMAL(PriorityNormal, "system-init");
|
||||
KSTATUS st = KeCreateKernelThread((uintptr_t)SystemInitThread,
|
||||
(uintptr_t)initArgs,
|
||||
&initThreadParameters, (THREAD**)0);
|
||||
@@ -813,7 +845,6 @@ extern void KernelMain(BOOT_INFO* bootInfo) {
|
||||
if (!KSUCCESS(st)) {
|
||||
KePanic(KE_PANIC_CODE_INIT, "KernelMain: Failed to create SystemInitThread (status 0x%x)\n", st);
|
||||
}
|
||||
|
||||
DbgPrint("KernelMain: Handing over to scheduler...\n");
|
||||
|
||||
// The bootstrap CPU becomes the scheduler idle context once interrupts are enabled.
|
||||
|
||||
Reference in new issue
Block a user