cpu-defs: Move out TB_JMP defines

These are not Architecture specific in any way so move them out of
cpu-defs.h. tb-hash.h is an appropriate place as a leading user and
their strong relationship to TB hashing and caching.

Backports commit 41da4bd6420afd1209c408974920f63ff9c658e1 from qemu
This commit is contained in:
Peter Crosthwaite 2018-02-14 08:13:58 -05:00 committed by Lioncash
parent 09d23c6604
commit 82a22d8f3a
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 8 additions and 8 deletions

View file

@ -56,14 +56,6 @@ typedef uint64_t target_ulong;
#error TARGET_LONG_SIZE undefined #error TARGET_LONG_SIZE undefined
#endif #endif
/* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for
addresses on the same page. The top bits are the same. This allows
TLB invalidation to quickly clear a subset of the hash table. */
#define TB_JMP_PAGE_BITS (TB_JMP_CACHE_BITS / 2)
#define TB_JMP_PAGE_SIZE (1 << TB_JMP_PAGE_BITS)
#define TB_JMP_ADDR_MASK (TB_JMP_PAGE_SIZE - 1)
#define TB_JMP_PAGE_MASK (TB_JMP_CACHE_SIZE - TB_JMP_PAGE_SIZE)
#if !defined(CONFIG_USER_ONLY) #if !defined(CONFIG_USER_ONLY)
/* use a fully associative victim tlb of 8 entries */ /* use a fully associative victim tlb of 8 entries */
#define CPU_VTLB_SIZE 8 #define CPU_VTLB_SIZE 8

View file

@ -20,6 +20,14 @@
#ifndef EXEC_TB_HASH #ifndef EXEC_TB_HASH
#define EXEC_TB_HASH #define EXEC_TB_HASH
/* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for
addresses on the same page. The top bits are the same. This allows
TLB invalidation to quickly clear a subset of the hash table. */
#define TB_JMP_PAGE_BITS (TB_JMP_CACHE_BITS / 2)
#define TB_JMP_PAGE_SIZE (1 << TB_JMP_PAGE_BITS)
#define TB_JMP_ADDR_MASK (TB_JMP_PAGE_SIZE - 1)
#define TB_JMP_PAGE_MASK (TB_JMP_CACHE_SIZE - TB_JMP_PAGE_SIZE)
static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc) static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
{ {
target_ulong tmp; target_ulong tmp;