redo boot around an explicit system volume and fixed kernel/HAL images, redo volumes and filesystem paths around capabilities instead of drive numbers and kernel CWD state, add a capability/security model with derived and revocable handles and security contexts, add port IPC and rssrv to manage the userspace resource namespace and publish the system volume, move process, dll and path loading to userspace and add process builder syscalls, init now supervises rssrv and the session process, redo the syscall ABI around request structs and four arguments, add a volume manager and proper partition arrival/removal handling so FAT and NTFS mount dynamically, clean up the HAL/DDK boundary so drivers don't depend on HAL internals, save fpu state properly now, the serial driver doesn't hang on a missing port, fix AHCI startup races, fix timeout accounting, fix shared mmap writeback, more smoke tests

This commit is contained in:
maksw committed 2026-08-20 12:33:17 +02:00
1 parent 4add6789ba
commit f882d339fb
232 files changed
+20934 -8898

No files matched your search

@@ -5,6 +5,8 @@
#include <stddef.h>
#include <string.h>
#include <ntlite/syscall.h>
#include <ntlite/path.h>
#include <ntlite/process_loader.h>
#define LOCK_OFFSET 0u
#define LOCK_LENGTH 128u
@@ -14,7 +16,7 @@
// Prints one NUL-terminated string to the kernel console.
static void print(const char* s) {
SYS_WRITE_CONSOLE_REQUEST req = { SysSvFromCstr(s) };
SYS_WRITE_CONSOLE_REQUEST req = { sizeof(SYS_WRITE_CONSOLE_REQUEST), SysSvFromCstr(s) };
SysWriteConsole(&req);
}
@@ -32,7 +34,7 @@ static void print_u64(uint64_t v) {
}
while (i--) {
char c = buf[i];
SYS_WRITE_CONSOLE_REQUEST req = { SysSvFromParts(&c, 1) };
SYS_WRITE_CONSOLE_REQUEST req = { sizeof(SYS_WRITE_CONSOLE_REQUEST), SysSvFromParts(&c, 1) };
SysWriteConsole(&req);
}
}
@@ -62,19 +64,17 @@ static void fail(const char* what) {
// Deletes one path if it already exists.
static void delete_path(const char* path) {
SYS_PATH_REQUEST req = { SysSvFromCstr(path) };
(void)SysDeleteFile(&req);
(void)NtlDeleteFile(SysSvFromCstr(path));
}
// Opens one path with lock rights.
static uint32_t open_existing_lockable(const char* path, uint32_t* fileOut) {
uint32_t h = 0;
SYS_OPEN_FILE_REQUEST req = SysMakeOpenFileRequest(SysSvFromCstr(path),
SYS_FILE_ACCESS_QUERY | SYS_FILE_ACCESS_LOCK,
SYS_FILE_OPEN_EXISTING,
SYS_FILE_FLAG_NONE,
&h);
uint32_t s = SysOpenFile(&req);
uint32_t s = NtlOpenFile(SysSvFromCstr(path),
SYS_FILE_ACCESS_QUERY | SYS_FILE_ACCESS_LOCK,
SYS_FILE_OPEN_EXISTING,
SYS_FILE_FLAG_NONE,
&h);
if (s == NTLSTATUS_SUCCESS)
*fileOut = h;
return s;
@@ -84,20 +84,16 @@ static uint32_t open_existing_lockable(const char* path, uint32_t* fileOut) {
static uint32_t create_temp_file(uint32_t* fileOut, const char** pathOut) {
static const char* paths[] = {
"file_lock_smoke.tmp",
"/file_lock_smoke.tmp",
"1:/file_lock_smoke.tmp",
"0:/file_lock_smoke.tmp",
};
for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
uint32_t h = 0;
delete_path(paths[i]);
SYS_OPEN_FILE_REQUEST req = SysMakeOpenFileRequest(SysSvFromCstr(paths[i]),
SYS_FILE_ACCESS_READ | SYS_FILE_ACCESS_WRITE | SYS_FILE_ACCESS_QUERY | SYS_FILE_ACCESS_LOCK,
SYS_FILE_CREATE_NEW,
SYS_FILE_FLAG_NONE,
&h);
uint32_t s = SysOpenFile(&req);
uint32_t s = NtlOpenFile(SysSvFromCstr(paths[i]),
SYS_FILE_ACCESS_READ | SYS_FILE_ACCESS_WRITE | SYS_FILE_ACCESS_QUERY | SYS_FILE_ACCESS_LOCK,
SYS_FILE_CREATE_NEW,
SYS_FILE_FLAG_NONE,
&h);
if (s == NTLSTATUS_SUCCESS) {
*fileOut = h;
*pathOut = paths[i];
@@ -245,12 +241,16 @@ static void run_child_expect_success(const char* mode, const char* path) {
build_child_command(command, sizeof(command), mode, path);
uint32_t child = 0;
SYS_CREATE_PROCESS_REQUEST req = {
peb->ImagePath,
SysSvFromCstr(command),
&child,
};
uint32_t s = SysCreateProcess(&req);
NTL_CREATE_SYSTEM_PROCESS_REQUEST req;
memset(&req, 0, sizeof(req));
req.Size = sizeof(req);
req.Flags = NTL_PROCESS_LOAD_FLAG_NONE;
req.Path = peb->ImagePath;
req.CommandLine = SysSvFromCstr(command);
req.SecurityContext = SYS_SECURITY_CONTEXT_CURRENT;
req.ResolveModuleName = NtlResolveSystemModuleName;
req.ProcessHandleOut = &child;
uint32_t s = NtlCreateSystemProcess(&req);
if (s != NTLSTATUS_SUCCESS) fail_status("create child", s);
s = SysWait(child, SYS_WAIT_FLAG_NONE);
@@ -348,8 +348,16 @@ int main(void) {
char command[CHILD_PREFIX_MAX + CHILD_PATH_MAX];
build_child_command(command, sizeof(command), "excl-wait", path);
uint32_t child = 0;
SYS_CREATE_PROCESS_REQUEST createReq = { selfPeb->ImagePath, SysSvFromCstr(command), &child };
s = SysCreateProcess(&createReq);
NTL_CREATE_SYSTEM_PROCESS_REQUEST createReq;
memset(&createReq, 0, sizeof(createReq));
createReq.Size = sizeof(createReq);
createReq.Flags = NTL_PROCESS_LOAD_FLAG_NONE;
createReq.Path = selfPeb->ImagePath;
createReq.CommandLine = SysSvFromCstr(command);
createReq.SecurityContext = SYS_SECURITY_CONTEXT_CURRENT;
createReq.ResolveModuleName = NtlResolveSystemModuleName;
createReq.ProcessHandleOut = &child;
s = NtlCreateSystemProcess(&createReq);
if (s != NTLSTATUS_SUCCESS) fail_status("create blocking child", s);
SysSleep(30);
s = unlock_range(file, LOCK_OFFSET, LOCK_LENGTH);