target-sparc: replace the last tlb entry when no free entries left

Implement the behavior described in the chapter 13.9.11 of
UltraSPARC T1™ Supplement to the UltraSPARC Architecture 2005:

"If a TLB Data-In replacement is attempted with all TLB
entries locked and valid, the last TLB entry (entry 63) is
replaced."

Backports commit 4797a6851975c1239df440c5f01d8566e63717bb from qemu
This commit is contained in:
Artyom Tarasenko 2018-03-01 21:26:04 -05:00 committed by Lioncash
parent c43a89b2bc
commit c61e580b2d
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -246,9 +246,11 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,
} }
#ifdef DEBUG_MMU #ifdef DEBUG_MMU
DPRINTF_MMU("%s lru replacement failed: no entries available\n", strmmu); DPRINTF_MMU("%s lru replacement: no free entries available, "
"replacing the last one\n", strmmu);
#endif #endif
/* error state? */ /* corner case: the last entry is replaced anyway */
replace_tlb_entry(&tlb[63], tlb_tag, tlb_tte, env1);
} }
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
static inline void do_check_asi(CPUSPARCState *env, int asi, uintptr_t ra) static inline void do_check_asi(CPUSPARCState *env, int asi, uintptr_t ra)