Attempt fixing svcConnectToPortInitHook.s again

This commit is contained in:
TuxSH 2017-06-09 18:10:02 +02:00
parent 4d47d891d1
commit 901d4992c0
3 changed files with 11 additions and 2 deletions

View File

@ -6,6 +6,7 @@
vars: vars:
orig: .word 0 orig: .word 0
SleepThread: .word 0 SleepThread: .word 0
UnmapProcessMemory: .word 0
skip_vars: skip_vars:
push {r0-r4, lr} push {r0-r4, lr}
ldr r4, =0x1ff81108 ldr r4, =0x1ff81108
@ -16,12 +17,18 @@ skip_vars:
bne loop_end bne loop_end
ldr r12, [SleepThread] ldr r12, [SleepThread]
ldr r0, =(10 * 1000 * 1000) ldr r0, =(50 * 1000 * 1000)
mov r1, #0 mov r1, #0
blx r12 blx r12
b loop b loop
loop_end: loop_end:
; Attempt flushing caches
mov r0, #0
mov r1, #0
mov r2, #0
ldr r12, [UnmapProcessMemory]
blx r12
pop {r0-r4, lr} pop {r0-r4, lr}
mov r12, #0x40000000 mov r12, #0x40000000
add r12, #4 add r12, #4

View File

@ -181,7 +181,7 @@ void installK11MainHook(u8 *pos, u32 size, bool isSafeMode, u32 baseK11VA, u32 *
void installSvcConnectToPortInitHook(u32 *arm11SvcTable, u32 *arm11ExceptionsPage, u8 **freeK11Space) void installSvcConnectToPortInitHook(u32 *arm11SvcTable, u32 *arm11ExceptionsPage, u8 **freeK11Space)
{ {
u32 addr = 0xFFFF0000 + (u32)*freeK11Space - (u32)arm11ExceptionsPage; u32 addr = 0xFFFF0000 + (u32)*freeK11Space - (u32)arm11ExceptionsPage;
u32 svcSleepThreadAddr = arm11SvcTable[0x0A], svcConnectToPortAddr = arm11SvcTable[0x2D]; u32 svcSleepThreadAddr = arm11SvcTable[0x0A], svcConnectToPortAddr = arm11SvcTable[0x2D], svcUnmapProcessMemoryAddr = arm11SvcTable[0x72];
arm11SvcTable[0x2D] = addr; arm11SvcTable[0x2D] = addr;
memcpy(*freeK11Space, svcConnectToPortInitHook_bin, svcConnectToPortInitHook_bin_size); memcpy(*freeK11Space, svcConnectToPortInitHook_bin, svcConnectToPortInitHook_bin_size);
@ -189,6 +189,7 @@ void installSvcConnectToPortInitHook(u32 *arm11SvcTable, u32 *arm11ExceptionsPag
u32 *off = (u32 *)(*freeK11Space); u32 *off = (u32 *)(*freeK11Space);
off[1] = svcConnectToPortAddr; off[1] = svcConnectToPortAddr;
off[2] = svcSleepThreadAddr; off[2] = svcSleepThreadAddr;
off[3] = svcUnmapProcessMemoryAddr;
(*freeK11Space) += svcConnectToPortInitHook_bin_size; (*freeK11Space) += svcConnectToPortInitHook_bin_size;
} }

View File

@ -32,6 +32,7 @@ Result ConnectToPortHook(Handle *out, const char *name)
{ {
char portName[12] = {0}; char portName[12] = {0};
Result res = 0; Result res = 0;
if(name != NULL) if(name != NULL)
{ {
s32 nb = usrToKernelStrncpy(portName, name, 12); s32 nb = usrToKernelStrncpy(portName, name, 12);