From aa643c44bb897ff0eaf1303352a876c3e9ffd2c1 Mon Sep 17 00:00:00 2001 From: wheremyfoodat Date: Sat, 17 Sep 2022 02:02:45 +0300 Subject: [PATCH] connectToPort stub, acknowledge configuration memory --- CMakeLists.txt | 1 + include/kernel/config_mem.hpp | 10 ++++++++++ include/kernel/kernel.hpp | 1 + src/core/kernel/kernel.cpp | 9 +++++++++ src/core/memory.cpp | 7 ++++++- 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 include/kernel/config_mem.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 35e60fcc..c1ba3950 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ set(KERNEL_SOURCE_FILES src/core/kernel/kernel.cpp src/core/kernel/resource_limi set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp include/termcolor.hpp include/cpu.hpp include/cpu_dynarmic.hpp include/memory.hpp include/kernel/kernel.hpp include/dynarmic_cp15.hpp include/kernel/resource_limits.hpp include/kernel/kernel_types.hpp + include/kernel/config_mem.hpp ) set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp diff --git a/include/kernel/config_mem.hpp b/include/kernel/config_mem.hpp new file mode 100644 index 00000000..417bb2b0 --- /dev/null +++ b/include/kernel/config_mem.hpp @@ -0,0 +1,10 @@ +#pragma once +#include "helpers.hpp" + +// Configuration memory addresses +namespace ConfigMem { + enum : u32 { + KernelVersionMinor = 0x1FF80002, + KernelVersionMajor = 0x1FF80003 + }; +} \ No newline at end of file diff --git a/include/kernel/kernel.hpp b/include/kernel/kernel.hpp index e8e5250a..9af5de5f 100644 --- a/include/kernel/kernel.hpp +++ b/include/kernel/kernel.hpp @@ -59,6 +59,7 @@ class Kernel { void getResourceLimitLimitValues(); void getResourceLimitCurrentValues(); void svcCloseHandle(); + void connectToPort(); public: Kernel(std::array& regs, Memory& mem) : regs(regs), mem(mem), handleCounter(0) { diff --git a/src/core/kernel/kernel.cpp b/src/core/kernel/kernel.cpp index 691d26a7..65f237aa 100644 --- a/src/core/kernel/kernel.cpp +++ b/src/core/kernel/kernel.cpp @@ -7,6 +7,7 @@ void Kernel::serviceSVC(u32 svc) { case 0x01: controlMemory(); break; case 0x21: createAddressArbiter(); break; case 0x23: svcCloseHandle(); break; + case 0x2D: connectToPort(); break; case 0x38: getResourceLimit(); break; case 0x39: getResourceLimitLimitValues(); break; case 0x3A: getResourceLimitCurrentValues(); break; @@ -64,6 +65,14 @@ void Kernel::svcCloseHandle() { regs[0] = SVCResult::Success; } +void Kernel::connectToPort() { + const u32 handlePointer = regs[0]; + const char* port = static_cast(mem.getReadPointer(regs[1])); + + printf("ConnectToPort(handle pointer = %08X, port = \"%s\")\n", handlePointer, port); + Helpers::panic("Unimplemented IPC"); +} + std::string Kernel::getProcessName(u32 pid) { if (pid == KernelHandles::CurrentProcess) { return "current"; diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 50e91c7a..964a521a 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -1,6 +1,8 @@ #include "memory.hpp" +#include "config_mem.hpp" #include + Memory::Memory() { fcram = new uint8_t[FCRAM_SIZE](); readTable.resize(totalPageCount, 0); @@ -122,7 +124,10 @@ u8 Memory::read8(u32 vaddr) { return *(u8*)(pointer + offset); } else { - Helpers::panic("Unimplemented 8-bit read, addr: %08X", vaddr); + switch (vaddr) { + case ConfigMem::KernelVersionMinor: return 38; + default: Helpers::panic("Unimplemented 8-bit read, addr: %08X", vaddr); + } } }