Skip to content

Commit 1a2eaf9

Browse files
committed
target/arm: Use cpu_*_mmu instead of helper_*_mmu
The helper_*_mmu functions were the only thing available when this code was written. This could have been adjusted when we added cpu_*_mmuidx_ra, but now we can most easily use the newest set of interfaces. Cc: [email protected] Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Richard Henderson <[email protected]>
1 parent a8f8495 commit 1a2eaf9

File tree

2 files changed

+11
-47
lines changed

2 files changed

+11
-47
lines changed

target/arm/helper-a64.c

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -512,37 +512,19 @@ uint64_t HELPER(paired_cmpxchg64_le)(CPUARMState *env, uint64_t addr,
512512
uintptr_t ra = GETPC();
513513
uint64_t o0, o1;
514514
bool success;
515-
516-
#ifdef CONFIG_USER_ONLY
517-
/* ??? Enforce alignment. */
518-
uint64_t *haddr = g2h(env_cpu(env), addr);
519-
520-
set_helper_retaddr(ra);
521-
o0 = ldq_le_p(haddr + 0);
522-
o1 = ldq_le_p(haddr + 1);
523-
oldv = int128_make128(o0, o1);
524-
525-
success = int128_eq(oldv, cmpv);
526-
if (success) {
527-
stq_le_p(haddr + 0, int128_getlo(newv));
528-
stq_le_p(haddr + 1, int128_gethi(newv));
529-
}
530-
clear_helper_retaddr();
531-
#else
532515
int mem_idx = cpu_mmu_index(env, false);
533516
MemOpIdx oi0 = make_memop_idx(MO_LEQ | MO_ALIGN_16, mem_idx);
534517
MemOpIdx oi1 = make_memop_idx(MO_LEQ, mem_idx);
535518

536-
o0 = helper_le_ldq_mmu(env, addr + 0, oi0, ra);
537-
o1 = helper_le_ldq_mmu(env, addr + 8, oi1, ra);
519+
o0 = cpu_ldq_le_mmu(env, addr + 0, oi0, ra);
520+
o1 = cpu_ldq_le_mmu(env, addr + 8, oi1, ra);
538521
oldv = int128_make128(o0, o1);
539522

540523
success = int128_eq(oldv, cmpv);
541524
if (success) {
542-
helper_le_stq_mmu(env, addr + 0, int128_getlo(newv), oi1, ra);
543-
helper_le_stq_mmu(env, addr + 8, int128_gethi(newv), oi1, ra);
525+
cpu_stq_le_mmu(env, addr + 0, int128_getlo(newv), oi1, ra);
526+
cpu_stq_le_mmu(env, addr + 8, int128_gethi(newv), oi1, ra);
544527
}
545-
#endif
546528

547529
return !success;
548530
}
@@ -582,37 +564,19 @@ uint64_t HELPER(paired_cmpxchg64_be)(CPUARMState *env, uint64_t addr,
582564
uintptr_t ra = GETPC();
583565
uint64_t o0, o1;
584566
bool success;
585-
586-
#ifdef CONFIG_USER_ONLY
587-
/* ??? Enforce alignment. */
588-
uint64_t *haddr = g2h(env_cpu(env), addr);
589-
590-
set_helper_retaddr(ra);
591-
o1 = ldq_be_p(haddr + 0);
592-
o0 = ldq_be_p(haddr + 1);
593-
oldv = int128_make128(o0, o1);
594-
595-
success = int128_eq(oldv, cmpv);
596-
if (success) {
597-
stq_be_p(haddr + 0, int128_gethi(newv));
598-
stq_be_p(haddr + 1, int128_getlo(newv));
599-
}
600-
clear_helper_retaddr();
601-
#else
602567
int mem_idx = cpu_mmu_index(env, false);
603568
MemOpIdx oi0 = make_memop_idx(MO_BEQ | MO_ALIGN_16, mem_idx);
604569
MemOpIdx oi1 = make_memop_idx(MO_BEQ, mem_idx);
605570

606-
o1 = helper_be_ldq_mmu(env, addr + 0, oi0, ra);
607-
o0 = helper_be_ldq_mmu(env, addr + 8, oi1, ra);
571+
o1 = cpu_ldq_be_mmu(env, addr + 0, oi0, ra);
572+
o0 = cpu_ldq_be_mmu(env, addr + 8, oi1, ra);
608573
oldv = int128_make128(o0, o1);
609574

610575
success = int128_eq(oldv, cmpv);
611576
if (success) {
612-
helper_be_stq_mmu(env, addr + 0, int128_gethi(newv), oi1, ra);
613-
helper_be_stq_mmu(env, addr + 8, int128_getlo(newv), oi1, ra);
577+
cpu_stq_be_mmu(env, addr + 0, int128_gethi(newv), oi1, ra);
578+
cpu_stq_be_mmu(env, addr + 8, int128_getlo(newv), oi1, ra);
614579
}
615-
#endif
616580

617581
return !success;
618582
}

target/arm/m_helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,9 +1947,9 @@ static bool do_v7m_function_return(ARMCPU *cpu)
19471947
* do them as secure, so work out what MMU index that is.
19481948
*/
19491949
mmu_idx = arm_v7m_mmu_idx_for_secstate(env, true);
1950-
oi = make_memop_idx(MO_LE, arm_to_core_mmu_idx(mmu_idx));
1951-
newpc = helper_le_ldul_mmu(env, frameptr, oi, 0);
1952-
newpsr = helper_le_ldul_mmu(env, frameptr + 4, oi, 0);
1950+
oi = make_memop_idx(MO_LEUL, arm_to_core_mmu_idx(mmu_idx));
1951+
newpc = cpu_ldl_le_mmu(env, frameptr, oi, 0);
1952+
newpsr = cpu_ldl_le_mmu(env, frameptr + 4, oi, 0);
19531953

19541954
/* Consistency checks on new IPSR */
19551955
newpsr_exc = newpsr & XPSR_EXCP;

0 commit comments

Comments
 (0)