mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-08 20:11:39 +12:00
Trongle
This commit is contained in:
parent
75070ca6ef
commit
be4fae5104
33 changed files with 341 additions and 70 deletions
|
@ -37,7 +37,7 @@ void Kernel::arbitrateAddress() {
|
|||
const s32 value = s32(regs[3]);
|
||||
const s64 ns = s64(u64(regs[4]) | (u64(regs[5]) << 32));
|
||||
|
||||
printf("ArbitrateAddress(Handle = %X, address = %08X, type = %s, value = %d, ns = %lld)\n", handle, address,
|
||||
logSVC("ArbitrateAddress(Handle = %X, address = %08X, type = %s, value = %d, ns = %lld)\n", handle, address,
|
||||
arbitrationTypeToString(type), value, ns);
|
||||
|
||||
const auto arbiter = getObject(handle, KernelObjectType::AddressArbiter);
|
||||
|
@ -68,7 +68,7 @@ void Kernel::arbitrateAddress() {
|
|||
}
|
||||
|
||||
case ArbitrationType::Signal:
|
||||
printf("Broken ArbitrateAddress (type == SIGNAL)\n");
|
||||
logSVC("Broken ArbitrateAddress (type == SIGNAL)\n");
|
||||
switchThread(0);
|
||||
break;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void Kernel::createEvent() {
|
|||
if (resetType > 2)
|
||||
Helpers::panic("Invalid reset type for event %d", resetType);
|
||||
|
||||
printf("CreateEvent(handle pointer = %08X, resetType = %s)\n", outPointer, resetTypeToString(resetType));
|
||||
logSVC("CreateEvent(handle pointer = %08X, resetType = %s)\n", outPointer, resetTypeToString(resetType));
|
||||
|
||||
regs[0] = SVCResult::Success;
|
||||
regs[1] = makeEvent(static_cast<ResetType>(resetType));
|
||||
|
@ -33,7 +33,7 @@ void Kernel::createEvent() {
|
|||
void Kernel::clearEvent() {
|
||||
const Handle handle = regs[0];
|
||||
const auto event = getObject(handle, KernelObjectType::Event);
|
||||
printf("ClearEvent(event handle = %d)\n", handle);
|
||||
logSVC("ClearEvent(event handle = %d)\n", handle);
|
||||
|
||||
if (event == nullptr) [[unlikely]] {
|
||||
regs[0] = SVCResult::BadHandle;
|
||||
|
@ -56,8 +56,6 @@ void Kernel::waitSynchronization1() {
|
|||
return;
|
||||
}
|
||||
|
||||
printf("WaitSynchronization1(handle = %X, ns = %lld) (STUBBED)\n", handle, ns);
|
||||
serviceManager.requestGPUInterrupt(GPUInterrupt::VBlank0);
|
||||
serviceManager.requestGPUInterrupt(GPUInterrupt::VBlank1);
|
||||
logSVC("WaitSynchronization1(handle = %X, ns = %lld) (STUBBED)\n", handle, ns);
|
||||
regs[0] = SVCResult::Success;
|
||||
}
|
|
@ -118,13 +118,13 @@ u32 Kernel::getTLSPointer() {
|
|||
|
||||
// Result CloseHandle(Handle handle)
|
||||
void Kernel::svcCloseHandle() {
|
||||
printf("CloseHandle(handle = %d) (Unimplemented)\n", regs[0]);
|
||||
logSVC("CloseHandle(handle = %d) (Unimplemented)\n", regs[0]);
|
||||
regs[0] = SVCResult::Success;
|
||||
}
|
||||
|
||||
// u64 GetSystemTick()
|
||||
void Kernel::getSystemTick() {
|
||||
printf("GetSystemTick()\n");
|
||||
logSVC("GetSystemTick()\n");
|
||||
|
||||
u64 ticks = cpu.getTicks();
|
||||
regs[0] = u32(ticks);
|
||||
|
@ -138,7 +138,7 @@ void Kernel::outputDebugString() {
|
|||
const u32 size = regs[1];
|
||||
|
||||
std::string message = mem.readString(pointer, size);
|
||||
printf("[OutputDebugString] %s\n", message.c_str());
|
||||
logSVC("[OutputDebugString] %s\n", message.c_str());
|
||||
regs[0] = SVCResult::Success;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ void Kernel::getProcessInfo() {
|
|||
const auto pid = regs[1];
|
||||
const auto type = regs[2];
|
||||
const auto process = getProcessFromPID(pid);
|
||||
printf("GetProcessInfo(process: %s, type = %d)\n", getProcessName(pid).c_str(), type);
|
||||
logSVC("GetProcessInfo(process: %s, type = %d)\n", getProcessName(pid).c_str(), type);
|
||||
|
||||
if (process == nullptr) [[unlikely]] {
|
||||
regs[0] = SVCResult::BadHandle;
|
||||
|
@ -170,7 +170,7 @@ void Kernel::getProcessInfo() {
|
|||
// Result GetThreadId(u32* threadId, Handle thread)
|
||||
void Kernel::duplicateHandle() {
|
||||
Handle original = regs[1];
|
||||
printf("DuplicateHandle(handle = %X)\n", original);
|
||||
logSVC("DuplicateHandle(handle = %X)\n", original);
|
||||
|
||||
if (original == KernelHandles::CurrentThread) {
|
||||
printf("[Warning] Duplicated current thread. This might be horribly broken!\n");
|
||||
|
|
|
@ -49,7 +49,7 @@ void Kernel::controlMemory() {
|
|||
Helpers::panic("ControlMemory: Unaligned parameters\nAddr0: %08X\nAddr1: %08X\nSize: %08X", addr0, addr1, size);
|
||||
}
|
||||
|
||||
printf("ControlMemory(addr0 = %08X, addr1 = %08X, size = %08X, operation = %X (%c%c%c)%s\n",
|
||||
logSVC("ControlMemory(addr0 = %08X, addr1 = %08X, size = %08X, operation = %X (%c%c%c)%s\n",
|
||||
addr0, addr1, size, operation, r ? 'r' : '-', w ? 'w' : '-', x ? 'x' : '-', linear ? ", linear" : ""
|
||||
);
|
||||
|
||||
|
@ -75,7 +75,7 @@ void Kernel::queryMemory() {
|
|||
const u32 pageInfo = regs[1];
|
||||
const u32 addr = regs[2];
|
||||
|
||||
printf("QueryMemory(mem info pointer = %08X, page info pointer = %08X, addr = %08X)\n", memInfo, pageInfo, addr);
|
||||
logSVC("QueryMemory(mem info pointer = %08X, page info pointer = %08X, addr = %08X)\n", memInfo, pageInfo, addr);
|
||||
|
||||
const auto info = mem.queryMemory(addr);
|
||||
regs[0] = SVCResult::Success;
|
||||
|
@ -92,7 +92,7 @@ void Kernel::mapMemoryBlock() {
|
|||
const u32 addr = regs[1];
|
||||
const u32 myPerms = regs[2];
|
||||
const u32 otherPerms = regs[3];
|
||||
printf("MapMemoryBlock(block = %d, addr = %08X, myPerms = %X, otherPerms = %X\n", block, addr, myPerms, otherPerms);
|
||||
logSVC("MapMemoryBlock(block = %d, addr = %08X, myPerms = %X, otherPerms = %X\n", block, addr, myPerms, otherPerms);
|
||||
|
||||
if (!isAligned(addr)) [[unlikely]] {
|
||||
Helpers::panic("MapMemoryBlock: Unaligned address");
|
||||
|
|
|
@ -56,7 +56,7 @@ void Kernel::connectToPort() {
|
|||
}
|
||||
|
||||
Handle portHandle = optionalHandle.value();
|
||||
printf("ConnectToPort(handle pointer = %X, port = \"%s\")\n", handlePointer, port.c_str());
|
||||
logSVC("ConnectToPort(handle pointer = %X, port = \"%s\")\n", handlePointer, port.c_str());
|
||||
|
||||
const auto portData = objects[portHandle].getData<Port>();
|
||||
if (!portData->isPublic) {
|
||||
|
@ -76,7 +76,7 @@ void Kernel::sendSyncRequest() {
|
|||
const auto handle = regs[0];
|
||||
u32 messagePointer = getTLSPointer() + 0x80; // The message is stored starting at TLS+0x80
|
||||
|
||||
printf("SendSyncRequest(session handle = %X)\n", handle);
|
||||
logSVC("SendSyncRequest(session handle = %X)\n", handle);
|
||||
|
||||
// The sync request is being sent at a service rather than whatever port, so have the service manager intercept it
|
||||
if (KernelHandles::isServiceHandle(handle)) {
|
||||
|
|
|
@ -7,7 +7,7 @@ void Kernel::getResourceLimit() {
|
|||
const auto handlePointer = regs[0];
|
||||
const auto pid = regs[1];
|
||||
const auto process = getProcessFromPID(pid);
|
||||
printf("GetResourceLimit (handle pointer = %08X, process: %s)\n", handlePointer, getProcessName(pid).c_str());
|
||||
logSVC("GetResourceLimit (handle pointer = %08X, process: %s)\n", handlePointer, getProcessName(pid).c_str());
|
||||
|
||||
if (process == nullptr) [[unlikely]] {
|
||||
regs[0] = SVCResult::BadHandle;
|
||||
|
@ -33,7 +33,7 @@ void Kernel::getResourceLimitLimitValues() {
|
|||
return;
|
||||
}
|
||||
|
||||
printf("GetResourceLimitLimitValues(values = %08X, handle = %X, names = %08X, count = %d)\n", values, resourceLimit, names, count);
|
||||
logSVC("GetResourceLimitLimitValues(values = %08X, handle = %X, names = %08X, count = %d)\n", values, resourceLimit, names, count);
|
||||
// printf("[Warning] We do not currently support any resource maximum aside from the application ones");
|
||||
while (count != 0) {
|
||||
const u32 name = mem.read32(names);
|
||||
|
@ -62,7 +62,7 @@ void Kernel::getResourceLimitCurrentValues() {
|
|||
return;
|
||||
}
|
||||
|
||||
printf("GetResourceLimitCurrentValues(values = %08X, handle = %X, names = %08X, count = %d)\n", values, resourceLimit, names, count);
|
||||
logSVC("GetResourceLimitCurrentValues(values = %08X, handle = %X, names = %08X, count = %d)\n", values, resourceLimit, names, count);
|
||||
while (count != 0) {
|
||||
const u32 name = mem.read32(names);
|
||||
// TODO: Unsure if this is supposed to be s32 or u32. Shouldn't matter as the kernel can't create so many resources
|
||||
|
|
|
@ -75,7 +75,7 @@ void Kernel::createThread() {
|
|||
u32 initialSP = regs[3] & ~7; // SP is force-aligned to 8 bytes
|
||||
s32 id = static_cast<s32>(regs[4]);
|
||||
|
||||
printf("CreateThread(entry = %08X, stacktop = %08X, priority = %X, processor ID = %d)\n", entrypoint,
|
||||
logSVC("CreateThread(entry = %08X, stacktop = %08X, priority = %X, processor ID = %d)\n", entrypoint,
|
||||
initialSP, priority, id);
|
||||
|
||||
if (priority > 0x3F) [[unlikely]] {
|
||||
|
@ -99,7 +99,7 @@ void Kernel::sleepThreadOnArbiter(u32 waitingAddress) {
|
|||
|
||||
void Kernel::getThreadID() {
|
||||
Handle handle = regs[1];
|
||||
printf("GetThreadID(handle = %X)\n", handle);
|
||||
logSVC("GetThreadID(handle = %X)\n", handle);
|
||||
|
||||
if (handle == KernelHandles::CurrentThread) {
|
||||
regs[0] = SVCResult::Success;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue