|
|
@ -13,7 +13,7 @@ TEST_CASE("Memory::IsValidVirtualAddress", "[core][memory]") {
|
|
|
|
CoreTiming::Init();
|
|
|
|
CoreTiming::Init();
|
|
|
|
Kernel::KernelSystem kernel(0);
|
|
|
|
Kernel::KernelSystem kernel(0);
|
|
|
|
SECTION("these regions should not be mapped on an empty process") {
|
|
|
|
SECTION("these regions should not be mapped on an empty process") {
|
|
|
|
auto process = Kernel::Process::Create(kernel.CreateCodeSet("", 0));
|
|
|
|
auto process = kernel.CreateProcess(kernel.CreateCodeSet("", 0));
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::PROCESS_IMAGE_VADDR) == false);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::PROCESS_IMAGE_VADDR) == false);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::HEAP_VADDR) == false);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::HEAP_VADDR) == false);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::LINEAR_HEAP_VADDR) == false);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::LINEAR_HEAP_VADDR) == false);
|
|
|
@ -24,14 +24,14 @@ TEST_CASE("Memory::IsValidVirtualAddress", "[core][memory]") {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SECTION("CONFIG_MEMORY_VADDR and SHARED_PAGE_VADDR should be valid after mapping them") {
|
|
|
|
SECTION("CONFIG_MEMORY_VADDR and SHARED_PAGE_VADDR should be valid after mapping them") {
|
|
|
|
auto process = Kernel::Process::Create(kernel.CreateCodeSet("", 0));
|
|
|
|
auto process = kernel.CreateProcess(kernel.CreateCodeSet("", 0));
|
|
|
|
Kernel::MapSharedPages(process->vm_manager);
|
|
|
|
Kernel::MapSharedPages(process->vm_manager);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::CONFIG_MEMORY_VADDR) == true);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::CONFIG_MEMORY_VADDR) == true);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::SHARED_PAGE_VADDR) == true);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::SHARED_PAGE_VADDR) == true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SECTION("special regions should be valid after mapping them") {
|
|
|
|
SECTION("special regions should be valid after mapping them") {
|
|
|
|
auto process = Kernel::Process::Create(kernel.CreateCodeSet("", 0));
|
|
|
|
auto process = kernel.CreateProcess(kernel.CreateCodeSet("", 0));
|
|
|
|
SECTION("VRAM") {
|
|
|
|
SECTION("VRAM") {
|
|
|
|
Kernel::HandleSpecialMapping(process->vm_manager,
|
|
|
|
Kernel::HandleSpecialMapping(process->vm_manager,
|
|
|
|
{Memory::VRAM_VADDR, Memory::VRAM_SIZE, false, false});
|
|
|
|
{Memory::VRAM_VADDR, Memory::VRAM_SIZE, false, false});
|
|
|
@ -46,7 +46,7 @@ TEST_CASE("Memory::IsValidVirtualAddress", "[core][memory]") {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SECTION("Unmapping a VAddr should make it invalid") {
|
|
|
|
SECTION("Unmapping a VAddr should make it invalid") {
|
|
|
|
auto process = Kernel::Process::Create(kernel.CreateCodeSet("", 0));
|
|
|
|
auto process = kernel.CreateProcess(kernel.CreateCodeSet("", 0));
|
|
|
|
Kernel::MapSharedPages(process->vm_manager);
|
|
|
|
Kernel::MapSharedPages(process->vm_manager);
|
|
|
|
process->vm_manager.UnmapRange(Memory::CONFIG_MEMORY_VADDR, Memory::CONFIG_MEMORY_SIZE);
|
|
|
|
process->vm_manager.UnmapRange(Memory::CONFIG_MEMORY_VADDR, Memory::CONFIG_MEMORY_SIZE);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::CONFIG_MEMORY_VADDR) == false);
|
|
|
|
CHECK(Memory::IsValidVirtualAddress(*process, Memory::CONFIG_MEMORY_VADDR) == false);
|
|
|
|