mirror of
https://github.com/wiiu-env/MochaPayload.git
synced 2024-11-22 07:59:16 +01:00
Improve usb serial logging behaviour when rebooting iosu
This commit is contained in:
parent
47641326a5
commit
91b20af377
@ -102,11 +102,6 @@ void instant_patches_setup(void) {
|
||||
// give us bsp::ee:read permission for PPC
|
||||
*(volatile u32 *) (0xe6044db0 - 0xe6042000 + 0x13d02000) = 0x000001F0;
|
||||
|
||||
// Patch MCP debugmode check for syslog
|
||||
*(volatile u32 *) (0x050290d8 - 0x05000000 + 0x081C0000) = 0x20004770;
|
||||
// Patch TEST to allow syslog
|
||||
*(volatile u32 *) (0xe4007828 - 0xe4000000 + 0x13A40000) = 0xe3a00000;
|
||||
|
||||
// patch default title id to system menu
|
||||
*(volatile u32 *) mcp_data_phys(0x050B817C) = *(volatile u32 *) 0x0017FFF0;
|
||||
*(volatile u32 *) mcp_data_phys(0x050B8180) = *(volatile u32 *) 0x0017FFF4;
|
||||
|
@ -56,6 +56,9 @@ ThreadContext_t **currentThreadContext = (ThreadContext_t **) 0x08173ba0;
|
||||
uint32_t *domainAccessPermissions = (uint32_t *) 0x081a4000;
|
||||
|
||||
int kernel_syscall_0x81(u32 command, u32 arg1, u32 arg2, u32 arg3) {
|
||||
void (*invalidate_icache)() = (void (*)()) 0x0812DCF0;
|
||||
void (*invalidate_dcache)(unsigned int, unsigned int) = (void (*)()) 0x08120164;
|
||||
void (*flush_dcache)(unsigned int, unsigned int) = (void (*)()) 0x08120160;
|
||||
int result = 0;
|
||||
int level = disable_interrupts();
|
||||
set_domain_register(domainAccessPermissions[0]); // 0 = KERNEL
|
||||
@ -67,10 +70,14 @@ int kernel_syscall_0x81(u32 command, u32 arg1, u32 arg2, u32 arg3) {
|
||||
}
|
||||
case KERNEL_WRITE32: {
|
||||
*(volatile u32 *) arg1 = arg2;
|
||||
flush_dcache(arg1, 4);
|
||||
invalidate_icache();
|
||||
break;
|
||||
}
|
||||
case KERNEL_MEMCPY: {
|
||||
kernel_memcpy((void *) arg1, (void *) arg2, arg3);
|
||||
flush_dcache(arg1, arg3);
|
||||
invalidate_icache();
|
||||
break;
|
||||
}
|
||||
case KERNEL_READ_OTP: {
|
||||
@ -127,19 +134,22 @@ void kernel_run_patches(u32 ios_elf_start) {
|
||||
section_write_word(ios_elf_start, 0xe22b2a78, 0x00000000);
|
||||
section_write_word(ios_elf_start, 0xe204fb68, 0xe3a00000);
|
||||
|
||||
// patch MCP syslog debug mode check
|
||||
section_write_word(ios_elf_start, 0x050290d8, 0x20004770);
|
||||
|
||||
// Write magic word to disable custom IPC
|
||||
section_write_word(ios_elf_start, 0x050290dc, 0x42424242);
|
||||
|
||||
// give us bsp::ee:read permission for PPC
|
||||
section_write_word(ios_elf_start, 0xe6044db0, 0x000001F0);
|
||||
|
||||
// Keep usb for reboot logging if we already do usb logging
|
||||
if (*((volatile uint32_t *) (0x050290dc - 0x05000000 + 0x081C0000)) == 0x42424242) {
|
||||
// patch TEST debug mode check
|
||||
//section_write_word(ios_elf_start, 0xe4016a78, 0xe3a00000);
|
||||
section_write_word(ios_elf_start, 0xe4007828, 0xe3a00000);
|
||||
|
||||
// patch MCP syslog debug mode check
|
||||
section_write_word(ios_elf_start, 0x050290d8, 0x20004770);
|
||||
|
||||
// Write magic word to disable custom USB logging IPC
|
||||
section_write_word(ios_elf_start, 0x050290dc, 0x42424242);
|
||||
}
|
||||
|
||||
// give us bsp::ee:read permission for PPC
|
||||
section_write_word(ios_elf_start, 0xe6044db0, 0x000001F0);
|
||||
|
||||
// Patch FS to syslog everything
|
||||
section_write_word(ios_elf_start, 0x107F5720, ARM_B(0x107F5720, 0x107F0C84));
|
||||
|
||||
|
@ -17,7 +17,9 @@
|
||||
*/
|
||||
|
||||
#include "../../common/ipc_defs.h"
|
||||
#include "../../common/kernel_commands.h"
|
||||
#include "fsa.h"
|
||||
#include "imports.h"
|
||||
#include "ipc_types.h"
|
||||
#include "logger.h"
|
||||
#include "svc.h"
|
||||
@ -299,10 +301,21 @@ int _MCP_ioctl100_patch(ipcmessage *msg) {
|
||||
}
|
||||
}
|
||||
case IPC_CUSTOM_START_USB_LOGGING: {
|
||||
if (usbLoggingEnabled || *((uint32_t *) 0x050290dc) == 0x42424242) {
|
||||
if (*((uint32_t *) 0x050290dc) == 0x42424242) {
|
||||
// Skip syslog after a reload
|
||||
break;
|
||||
}
|
||||
|
||||
// set the flag to not run this twice.
|
||||
svcCustomKernelCommand(KERNEL_WRITE32, 0x050290dc, 0x42424242);
|
||||
|
||||
// Patch MCP debugmode check for usb syslog
|
||||
svcCustomKernelCommand(KERNEL_WRITE32, 0x050290d8, 0x20004770);
|
||||
// Patch TEST to allow usb syslog
|
||||
svcCustomKernelCommand(KERNEL_WRITE32, 0xe4007828, 0xe3a00000);
|
||||
|
||||
usleep(1000 * 10);
|
||||
|
||||
int handle = svcOpen("/dev/testproc1", 0);
|
||||
if (handle > 0) {
|
||||
svcResume(handle);
|
||||
|
Loading…
Reference in New Issue
Block a user