Fix bug(s), refactor svcConnectToPortInitHook.s, cleanup

This commit is contained in:
TuxSH
2017-06-08 21:35:41 +02:00
parent 427a05997d
commit 461035b212
8 changed files with 42 additions and 53 deletions

View File

@@ -2,15 +2,19 @@
.create "build/svcConnectToPortInitHook.bin", 0
.arm
b skip_vars
vars:
orig: .word 0
SleepThread: .word 0
skip_vars:
push {r0-r4, lr}
adr r0, jumpAddress
bl convertVAToPA
orr r4, r0, #(1 << 31)
ldr r4, =0x1ff81108
loop:
ldr r12, [r4]
ldrb r12, [r4]
cmp r12, #0
bne loop_end
ldr r12, [SleepThread]
ldr r0, =(10 * 1000 * 1000)
mov r1, #0
@@ -19,25 +23,10 @@
loop_end:
pop {r0-r4, lr}
mov r12, #0x40000000
add r12, #4
bx r12
convertVAToPA:
mov r1, #0x1000
sub r1, #1
and r2, r0, r1
bic r0, r1
mcr p15, 0, r0, c7, c8, 0 ; VA to PA translation with privileged read permission check
mrc p15, 0, r0, c7, c4, 0 ; read PA register
tst r0, #1 ; failure bit
bic r0, r1
addeq r0, r2
movne r0, #0
bx lr
.pool
_base: .ascii "base"
jumpAddressOrig: .ascii "orig"
SleepThread: .ascii "SlpT"
jumpAddress: .word 0
.close