[PowerPC64LE] Fix endian conversion bugs in moea64.

For a body of code that had its endian conversion bits written blind without
the ability to test, moea64 was VERY close to being correct.

There were only four instances where the existing code was getting it wrong.

Sponsored by:	Tag1 Consulting, Inc.
This commit is contained in:
Brandon Bergren 2020-09-23 01:29:33 +00:00
parent ead0ba6e8d
commit f475e00fb3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366045

View File

@ -341,7 +341,7 @@ moea64_pte_unset_native(struct pvo_entry *pvo)
pvo_ptevpn = moea64_pte_vpn_from_pvo_vpn(pvo);
rw_rlock(&moea64_eviction_lock);
if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) != pvo_ptevpn) {
if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) != pvo_ptevpn) {
/* Evicted */
STAT_MOEA64(moea64_pte_overflow--);
rw_runlock(&moea64_eviction_lock);
@ -354,7 +354,7 @@ moea64_pte_unset_native(struct pvo_entry *pvo)
*/
isync();
critical_enter();
pt->pte_hi = be64toh((pt->pte_hi & ~LPTE_VALID) | LPTE_LOCKED);
pt->pte_hi = htobe64((be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED);
PTESYNC();
TLBIE(pvo->pvo_vpn);
ptelo = be64toh(pt->pte_lo);
@ -378,7 +378,7 @@ moea64_pte_replace_inval_native(struct pvo_entry *pvo,
moea64_pte_from_pvo(pvo, &properpt);
rw_rlock(&moea64_eviction_lock);
if ((be64toh(pt->pte_hi & LPTE_AVPN_MASK)) !=
if ((be64toh(pt->pte_hi) & LPTE_AVPN_MASK) !=
(properpt.pte_hi & LPTE_AVPN_MASK)) {
/* Evicted */
STAT_MOEA64(moea64_pte_overflow--);
@ -392,7 +392,7 @@ moea64_pte_replace_inval_native(struct pvo_entry *pvo,
*/
isync();
critical_enter();
pt->pte_hi = be64toh((pt->pte_hi & ~LPTE_VALID) | LPTE_LOCKED);
pt->pte_hi = htobe64((be64toh(pt->pte_hi) & ~LPTE_VALID) | LPTE_LOCKED);
PTESYNC();
TLBIE(pvo->pvo_vpn);
ptelo = be64toh(pt->pte_lo);