Skip to content

Commit

Permalink
Improved performance of hicode a bit and reduce itcm usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Gericom committed Dec 9, 2023
1 parent 3aa32d7 commit 4243977
Showing 1 changed file with 44 additions and 18 deletions.
62 changes: 44 additions & 18 deletions code/core/arm9/source/MemoryEmulator/HiCodeCacheMapping.s
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,37 @@ arm_func hic_mapRomBlock

mov r12, #0x80000000 //load bit + segment 0
mcr p15, 0, r12, c9, c0, 1
bl prefetchCacheSet
.rept 64
mcr p15, 3, r1, c15, c0, 0 //set index

prefetchCacheSet0:
mov r12, #64
1:
mcr p15, 0, r0, c7, c13, 1 //prefetch
mcr p15, 3, r0, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r0, r0, #32
mcr p15, 0, r0, c7, c13, 1 //prefetch
mcr p15, 3, r0, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r0, r0, #32
mcr p15, 0, r0, c7, c13, 1 //prefetch
mcr p15, 3, r0, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r1, r1, #32
.endr
add r0, r0, #32
mcr p15, 0, r0, c7, c13, 1 //prefetch
mcr p15, 3, r0, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r0, r0, #32
subs r12, r12, #4
bne 1b

add r1, r1, #2048
mov r12, #0x80000001 //load bit + segment 1
mcr p15, 0, r12, c9, c0, 1
bl prefetchCacheSet
.rept 64
orr r3, r1, #(1 << 30)
mcr p15, 3, r3, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r1, r1, #32
.endr
mov r0, #0x00000002 //segment 2
mcr p15, 0, r0, c9, c0, 1
pop {r4, pc}

prefetchCacheSet:
prefetchCacheSet1:
mov r12, #64
1:
2:
mcr p15, 0, r0, c7, c13, 1 //prefetch
add r0, r0, #32
mcr p15, 0, r0, c7, c13, 1 //prefetch
Expand All @@ -67,8 +76,25 @@ prefetchCacheSet:
add r0, r0, #32
mcr p15, 0, r0, c7, c13, 1 //prefetch
add r0, r0, #32

mcr p15, 3, r3, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r3, r3, #32
mcr p15, 3, r3, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r3, r3, #32
mcr p15, 3, r3, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r3, r3, #32
mcr p15, 3, r3, c15, c0, 0 //set index
mcr p15, 3, r1, c15, c1, 0 //write tag
add r3, r3, #32

subs r12, r12, #4
bne 1b
bx lr
bne 2b

mov r0, #0x00000002 //segment 2
mcr p15, 0, r0, c9, c0, 1
pop {r4, pc}

#endif

0 comments on commit 4243977

Please sign in to comment.