implement user mode catchable exceptions, refactor system status codes to use NTLSTATUS_ prefix, update build scripts to use shared literal macros for linker arguments, update named queue lifetime cleanup to include KeNamedQueueUnpublishHandle.
This commit is contained in:
1 parent
1f5477cf66
commit
b7fcfce6f7
140 files changed
+7649
-3943
No files matched your search
@@ -87,14 +87,14 @@ static uint32_t create_temp(uint32_t* fileOut, const char** pathOut) {
|
||||
SYS_FILE_FLAG_NONE,
|
||||
&h);
|
||||
uint32_t s = SysOpenFile(&req);
|
||||
if (s == STATUS_SUCCESS) {
|
||||
if (s == NTLSTATUS_SUCCESS) {
|
||||
*fileOut = h;
|
||||
if (pathOut) *pathOut = paths[i];
|
||||
return STATUS_SUCCESS;
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return STATUS_NOT_FOUND;
|
||||
return NTLSTATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
static void fill_pattern(void) {
|
||||
@@ -107,7 +107,7 @@ static uint32_t validate_mapping(const uint8_t* base) {
|
||||
if (base[i] != gPattern[i])
|
||||
return 0x10000000u | (uint32_t)(i & 0x0FFFFFFFu);
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void thread_main(uintptr_t arg) {
|
||||
@@ -118,8 +118,8 @@ static void thread_main(uintptr_t arg) {
|
||||
void* base = 0;
|
||||
uint32_t s = SysMapFile(ctx->Mapping, 0, TEST_SIZE,
|
||||
SYS_MAP_ACCESS_READ, SYS_MAP_FLAG_NONE, &base);
|
||||
if (s != STATUS_SUCCESS || !base) {
|
||||
ctx->Status = s ? s : STATUS_INVALID_PARAMETER;
|
||||
if (s != NTLSTATUS_SUCCESS || !base) {
|
||||
ctx->Status = s ? s : NTLSTATUS_INVALID_PARAMETER;
|
||||
SysExitThread(1);
|
||||
}
|
||||
|
||||
@@ -130,18 +130,18 @@ static void thread_main(uintptr_t arg) {
|
||||
|
||||
s = validate_mapping((const uint8_t*)base);
|
||||
uint32_t fs = SysFreeVm(base);
|
||||
if (s != STATUS_SUCCESS) {
|
||||
if (s != NTLSTATUS_SUCCESS) {
|
||||
ctx->Status = s;
|
||||
SysExitThread(1);
|
||||
}
|
||||
if (fs != STATUS_SUCCESS) {
|
||||
if (fs != NTLSTATUS_SUCCESS) {
|
||||
ctx->Status = fs;
|
||||
SysExitThread(1);
|
||||
}
|
||||
ctx->IterationsDone++;
|
||||
}
|
||||
|
||||
ctx->Status = STATUS_SUCCESS;
|
||||
ctx->Status = NTLSTATUS_SUCCESS;
|
||||
SysExitThread(0);
|
||||
}
|
||||
|
||||
@@ -152,21 +152,21 @@ int main(void) {
|
||||
uint32_t file = 0;
|
||||
const char* path = 0;
|
||||
uint32_t s = create_temp(&file, &path);
|
||||
if (s != STATUS_SUCCESS) fail_status("create temp", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("create temp", s);
|
||||
|
||||
size_t written = 0;
|
||||
SYS_FILE_IO_REQUEST writeReq = SysMakeFileIoRequest(file, gPattern, sizeof(gPattern), &written);
|
||||
s = SysWriteFile(&writeReq);
|
||||
if (s != STATUS_SUCCESS) fail_status("write pattern", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("write pattern", s);
|
||||
if (written != sizeof(gPattern)) fail("short write");
|
||||
|
||||
uint32_t mapping = 0;
|
||||
s = SysCreateFileMapping(file, SYS_VM_READ, SYS_MAP_FLAG_NONE, TEST_SIZE, &mapping);
|
||||
if (s != STATUS_SUCCESS) fail_status("create mapping", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("create mapping", s);
|
||||
|
||||
SYS_FILE_CACHE_STATS before;
|
||||
SYS_FILE_CACHE_STATS after;
|
||||
if (query_cache(&before) != STATUS_SUCCESS) fail("initial stats query failed");
|
||||
if (query_cache(&before) != NTLSTATUS_SUCCESS) fail("initial stats query failed");
|
||||
|
||||
uint32_t handles[THREAD_COUNT];
|
||||
uint32_t tids[THREAD_COUNT];
|
||||
@@ -177,7 +177,7 @@ int main(void) {
|
||||
for (uint32_t i = 0; i < THREAD_COUNT; ++i) {
|
||||
gThreads[i].Index = i;
|
||||
gThreads[i].Mapping = mapping;
|
||||
gThreads[i].Status = STATUS_PENDING;
|
||||
gThreads[i].Status = NTLSTATUS_PENDING;
|
||||
SYS_CREATE_THREAD_REQUEST req = {
|
||||
(uintptr_t)thread_main,
|
||||
(uintptr_t)&gThreads[i],
|
||||
@@ -187,17 +187,17 @@ int main(void) {
|
||||
&tids[i]
|
||||
};
|
||||
s = SysCreateThread(&req);
|
||||
if (s != STATUS_SUCCESS) fail_status("create thread", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("create thread", s);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < THREAD_COUNT; ++i) {
|
||||
s = SysWait(handles[i], SYS_WAIT_FLAG_NONE);
|
||||
if (s != STATUS_SUCCESS) fail_status("wait thread", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("wait thread", s);
|
||||
SysCloseHandle(handles[i]);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < THREAD_COUNT; ++i) {
|
||||
if (gThreads[i].Status != STATUS_SUCCESS) {
|
||||
if (gThreads[i].Status != NTLSTATUS_SUCCESS) {
|
||||
print("pcache_multithread: worker ");
|
||||
print_u64(i);
|
||||
print(" status=");
|
||||
@@ -210,8 +210,9 @@ int main(void) {
|
||||
if (gThreads[i].IterationsDone != ITERATIONS) fail("worker iteration count mismatch");
|
||||
}
|
||||
|
||||
if (query_cache(&after) != STATUS_SUCCESS) fail("final stats query failed");
|
||||
if (after.Loads <= before.Loads) fail("concurrent mmap did not load cache pages");
|
||||
if (query_cache(&after) != NTLSTATUS_SUCCESS) fail("final stats query failed");
|
||||
if (after.Loads <= before.Loads && after.Hits <= before.Hits)
|
||||
fail("concurrent mmap did not touch cache pages");
|
||||
if (after.Hits <= before.Hits) fail("concurrent mmap did not reuse cache pages");
|
||||
|
||||
SysCloseHandle(mapping);
|
||||
|
||||
Reference in new issue
Block a user