diff --git a/src/kernel/service/memorySyscalls.c b/src/kernel/service/memorySyscalls.c index 432ef0c..a7c2ab2 100644 --- a/src/kernel/service/memorySyscalls.c +++ b/src/kernel/service/memorySyscalls.c @@ -26,6 +26,7 @@ uint32_t physicalPage = PAGE_ID(physical); reservePagesCount(kernelPhysicalPages, physicalPage, pageCount); for (uint32_t i = 0; i < pageCount; i++) { + // the program probably wants to interact with an external device, so set the volatile flag mapPage(&service->pagingInfo, ADDRESS(physicalPage + i), ADDRESS(virtualStart + i), true, true); } diff --git a/src/kernel/service/memorySyscalls.c b/src/kernel/service/memorySyscalls.c index 432ef0c..a7c2ab2 100644 --- a/src/kernel/service/memorySyscalls.c +++ b/src/kernel/service/memorySyscalls.c @@ -26,6 +26,7 @@ uint32_t physicalPage = PAGE_ID(physical); reservePagesCount(kernelPhysicalPages, physicalPage, pageCount); for (uint32_t i = 0; i < pageCount; i++) { + // the program probably wants to interact with an external device, so set the volatile flag mapPage(&service->pagingInfo, ADDRESS(physicalPage + i), ADDRESS(virtualStart + i), true, true); } diff --git a/src/kernel/service/service.c b/src/kernel/service/service.c index 41784cd..23b222b 100644 --- a/src/kernel/service/service.c +++ b/src/kernel/service/service.c @@ -34,7 +34,9 @@ service->pagingInfo.pageDirectory = malloc(0x1000); service->name = serviceName; service->nameHash = insertString(serviceName); + // TODO: better ids service->id = listCount(services); + // fire load event fireEvent(loadInitrdEvent, service->nameHash, 0); void *current = &functionsStart; if (hlib) { @@ -49,6 +51,8 @@ sharePage(&(service->pagingInfo), current, current); current += 0x1000; } + // reserve first few pages to hopefully catch NULL pointers correctly + reservePagesCount(&service->pagingInfo, 0, 0x10); for (uint32_t i = 0; i < header->programHeaderEntryCount; i++) { if (hlib && programHeader->virtualAddress >= 0xF0000000) { goto end; @@ -93,7 +97,6 @@ return service; } }) - ; return NULL; } @@ -103,7 +106,6 @@ return provider; } }) - ; return NULL; }