From e108d4a0be4c3fbfa4b6cdc4679f527d61da0765 Mon Sep 17 00:00:00 2001 From: Ryan Teal Date: Tue, 2 Jul 2019 22:34:08 +0100 Subject: [PATCH] Implement svcOutputDebugString --- app/src/main/cpp/core/hos/kernel/svc.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/core/hos/kernel/svc.cpp b/app/src/main/cpp/core/hos/kernel/svc.cpp index 407956bf..ba7b9e0c 100644 --- a/app/src/main/cpp/core/hos/kernel/svc.cpp +++ b/app/src/main/cpp/core/hos/kernel/svc.cpp @@ -1,12 +1,24 @@ #include +#include #include #include #include "core/arm/cpu.h" +#include "core/arm/memory.h" #include "svc.h" +using namespace core::cpu; namespace core::kernel { + static uint32_t OutputDebugString() { + std::string debug(GetRegister(UC_ARM64_REG_X1), '\0'); + memory::Read((void*)debug.data(), GetRegister(UC_ARM64_REG_X0), GetRegister(UC_ARM64_REG_X1)); + + syslog(LOG_DEBUG, "svcOutputDebugString: %s", debug.c_str()); + return 0; + } + std::pair svcTable[] = { + {0x00, nullptr}, {0x01, nullptr}, {0x02, nullptr}, {0x03, nullptr}, @@ -45,7 +57,7 @@ namespace core::kernel { {0x24, nullptr}, {0x25, nullptr}, {0x26, nullptr}, - {0x27, nullptr}, + {0x27, OutputDebugString}, {0x28, nullptr}, {0x29, nullptr}, {0x2a, nullptr},