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
@@ -72,13 +72,13 @@ static uint32_t open_self(uint32_t* out) {
|
||||
SYS_FILE_FLAG_NONE,
|
||||
&h);
|
||||
uint32_t s = SysOpenFile(&req);
|
||||
if (s == STATUS_SUCCESS) {
|
||||
if (s == NTLSTATUS_SUCCESS) {
|
||||
*out = h;
|
||||
print("pcache_smoke: using "); print(paths[i]); print("\n");
|
||||
return STATUS_SUCCESS;
|
||||
return NTLSTATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
return STATUS_NOT_FOUND;
|
||||
return NTLSTATUS_NOT_FOUND;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
@@ -86,52 +86,52 @@ int main(void) {
|
||||
|
||||
SYS_FILE_CACHE_STATS before, afterFirst, afterSecond, afterMap;
|
||||
uint32_t s = query_cache(&before);
|
||||
if (s != STATUS_SUCCESS) fail_status("query initial stats", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("query initial stats", s);
|
||||
|
||||
uint32_t file = 0;
|
||||
s = open_self(&file);
|
||||
if (s != STATUS_SUCCESS) fail_status("open test file", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("open test file", s);
|
||||
|
||||
size_t gotA = 0;
|
||||
memset(gA, 0xA5, sizeof(gA));
|
||||
SYS_FILE_IO_REQUEST readReqA = SysMakeFileIoRequest(file, gA, sizeof(gA), &gotA);
|
||||
s = SysReadFile(&readReqA);
|
||||
if (s != STATUS_SUCCESS) fail_status("first read", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("first read", s);
|
||||
if (gotA < 4096) fail("first read too short");
|
||||
print("pcache_smoke: first read OK\n");
|
||||
|
||||
s = query_cache(&afterFirst);
|
||||
if (s != STATUS_SUCCESS) fail_status("query after first read", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("query after first read", s);
|
||||
if (afterFirst.Loads <= before.Loads)
|
||||
fail("first read did not load file-cache pages");
|
||||
|
||||
s = SysSeekFile(file, 0);
|
||||
if (s != STATUS_SUCCESS) fail_status("seek", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("seek", s);
|
||||
|
||||
size_t gotB = 0;
|
||||
memset(gB, 0x5A, sizeof(gB));
|
||||
SYS_FILE_IO_REQUEST readReqB = SysMakeFileIoRequest(file, gB, sizeof(gB), &gotB);
|
||||
s = SysReadFile(&readReqB);
|
||||
if (s != STATUS_SUCCESS) fail_status("second read", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("second read", s);
|
||||
if (gotB != gotA) fail("second read length mismatch");
|
||||
if (memcmp(gA, gB, gotA) != 0) fail("second read data mismatch");
|
||||
print("pcache_smoke: second read OK\n");
|
||||
|
||||
s = query_cache(&afterSecond);
|
||||
if (s != STATUS_SUCCESS) fail_status("query after second read", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("query after second read", s);
|
||||
if (afterSecond.Hits <= afterFirst.Hits)
|
||||
fail("second read did not hit file cache");
|
||||
|
||||
uint32_t mapping = 0;
|
||||
s = SysCreateFileMapping(file, SYS_VM_READ, SYS_MAP_FLAG_NONE, sizeof(gA), &mapping);
|
||||
if (s != STATUS_SUCCESS) fail_status("create mapping", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("create mapping", s);
|
||||
SysCloseHandle(file);
|
||||
file = 0;
|
||||
|
||||
void* base = 0;
|
||||
s = SysMapFile(mapping, 0, sizeof(gA), SYS_MAP_ACCESS_READ, SYS_MAP_FLAG_NONE, &base);
|
||||
SysCloseHandle(mapping);
|
||||
if (s != STATUS_SUCCESS) fail_status("map file", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("map file", s);
|
||||
if (!base) fail("map returned null");
|
||||
|
||||
volatile uint8_t* view = (volatile uint8_t*)base;
|
||||
@@ -145,7 +145,7 @@ int main(void) {
|
||||
}
|
||||
|
||||
s = query_cache(&afterMap);
|
||||
if (s != STATUS_SUCCESS) fail_status("query after map", s);
|
||||
if (s != NTLSTATUS_SUCCESS) fail_status("query after map", s);
|
||||
if (afterMap.Hits <= afterSecond.Hits)
|
||||
fail("mmap faults did not hit already cached pages");
|
||||
|
||||
|
||||
Reference in new issue
Block a user