Commit fb7a076f authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Fix to ARM9 clean loop.

parent 6a293f53
......@@ -143,9 +143,9 @@ FindARMloop
TEQ v4, #ARMunk ; Modify deduced flags
ADRNEL lr, KnownCPUFlags
ADDNE lr, lr, v4, LSL #3
LDMNEIA lr, {a1, a2}
ORRNE v5, v5, a1
BICNE v5, v5, a2
LDMNEIA lr, {a2, a3}
ORRNE v5, v5, a2
BICNE v5, v5, a3
STR v5, [v6, #ProcessorFlags]
......@@ -306,7 +306,6 @@ Analyse_WB_CR7_LDa_L1
LDRB a2, [a1, #DCache_LineLen]
SUB a4, a4, #1
MUL a4, a2, a4
SUB a4, a4, a3
STR a4, [a1, #DCache_IndexSegStart]
MOV a2, #32*1024 ; arbitrary-ish
......@@ -661,19 +660,19 @@ Cache_CleanAll_WB_CR7_LDa ROUT
;
; DCache_LineLen = 32 (32 byte cache line, segment field starts at bit 5)
; DCache_IndexBit = &04000000 (index field starts at bit 26)
; DCache_IndexSegStart = &FC0000E0 (start at index=63, segment = 7)
; DCache_IndexSegStart = &000000E0 (start at index=0, segment = 7)
;
Push "a2, ip"
MOV ip, #0
LDRB a1, [ip, #DCache_LineLen] ; segment field starts at this bit
LDR a2, [ip, #DCache_IndexBit] ; index field starts at this bit
LDR ip, [ip, #DCache_IndexSegStart] ; starting value, with index and seg each at max
LDR ip, [ip, #DCache_IndexSegStart] ; starting value, with index at min, seg at max
10
MCR p15, 0, ip, c7, c10, 2 ; clean DCache entry by segment/index
SUBS ip, ip, a2 ; next index, counting down, CC if wrapped back to max
BCS %BT10
SUBS ip, ip, a1 ; next segment, counting down, CC if done
BCS %BT10
ADDS ip, ip, a2 ; next index, counting up, CS if wrapped back to 0
BCC %BT10
SUBS ip, ip, a1 ; next segment, counting down, CC if wrapped back to max
BCS %BT10 ; if segment wrapped, then we've finished
MOV ip, #0
MCR p15, 0, ip, c7, c10, 4 ; drain WBuffer
Pull "a2, ip"
......@@ -688,13 +687,13 @@ Cache_CleanInvalidateAll_WB_CR7_LDa ROUT
MOV ip, #0
LDRB a1, [ip, #DCache_LineLen] ; segment field starts at this bit
LDR a2, [ip, #DCache_IndexBit] ; index field starts at this bit
LDR ip, [ip, #DCache_IndexSegStart] ; starting value, with index and seg each at max
LDR ip, [ip, #DCache_IndexSegStart] ; starting value, with index at min, seg at max
10
MCR p15, 0, ip, c7, c14, 2 ; clean&invalidate DCache entry by segment/index
SUBS ip, ip, a2 ; next index, counting down, CC if wrapped back to max
BCS %BT10
SUBS ip, ip, a1 ; next segment, counting down, CC if done
BCS %BT10
ADDS ip, ip, a2 ; next index, counting up, CS if wrapped back to 0
BCC %BT10
SUBS ip, ip, a1 ; next segment, counting down, CC if wrapped back to max
BCS %BT10 ; if segment wrapped, then we've finished
MOV ip, #0
MCR p15, 0, ip, c7, c10, 4 ; drain WBuffer
MCR p15, 0, ip, c7, c5, 0 ; invalidate ICache
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment