mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-25 13:16:45 +00:00
include/exec: Move tb hash functions out
This is one of very few things in exec-all with a genuine CPU architecture dependency. Move these hashing helpers to a new header to trim exec-all.h down to a near architecture-agnostic header. The defs are only used by cpu-exec and translate-all which are both arch-obj's so the new tb-hash.h has no core code usage. Backports commit e1b89321bafea9fb33d87852fc91fee579d17dfe from qemu
This commit is contained in:
parent
860e4184df
commit
09d23c6604
|
@ -23,6 +23,7 @@
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "exec/address-spaces.h"
|
#include "exec/address-spaces.h"
|
||||||
#include "exec/memory-internal.h"
|
#include "exec/memory-internal.h"
|
||||||
|
#include "exec/tb-hash.h"
|
||||||
|
|
||||||
#include "uc_priv.h"
|
#include "uc_priv.h"
|
||||||
|
|
||||||
|
|
|
@ -183,26 +183,6 @@ struct TBContext {
|
||||||
int tb_invalidated_flag;
|
int tb_invalidated_flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
|
|
||||||
{
|
|
||||||
target_ulong tmp;
|
|
||||||
tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
|
|
||||||
return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
|
|
||||||
{
|
|
||||||
target_ulong tmp;
|
|
||||||
tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
|
|
||||||
return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
|
|
||||||
| (tmp & TB_JMP_ADDR_MASK));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
|
|
||||||
{
|
|
||||||
return (pc >> 2) & (CODE_GEN_PHYS_HASH_SIZE - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tb_free(struct uc_struct *uc, TranslationBlock *tb);
|
void tb_free(struct uc_struct *uc, TranslationBlock *tb);
|
||||||
void tb_flush(CPUArchState *env);
|
void tb_flush(CPUArchState *env);
|
||||||
void tb_phys_invalidate(struct uc_struct *uc,
|
void tb_phys_invalidate(struct uc_struct *uc,
|
||||||
|
|
43
qemu/include/exec/tb-hash.h
Normal file
43
qemu/include/exec/tb-hash.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* internal execution defines for qemu
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003 Fabrice Bellard
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EXEC_TB_HASH
|
||||||
|
#define EXEC_TB_HASH
|
||||||
|
|
||||||
|
static inline unsigned int tb_jmp_cache_hash_page(target_ulong pc)
|
||||||
|
{
|
||||||
|
target_ulong tmp;
|
||||||
|
tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
|
||||||
|
return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
|
||||||
|
{
|
||||||
|
target_ulong tmp;
|
||||||
|
tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
|
||||||
|
return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
|
||||||
|
| (tmp & TB_JMP_ADDR_MASK));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned int tb_phys_hash_func(tb_page_addr_t pc)
|
||||||
|
{
|
||||||
|
return (pc >> 2) & (CODE_GEN_PHYS_HASH_SIZE - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -58,6 +58,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "exec/cputlb.h"
|
#include "exec/cputlb.h"
|
||||||
|
#include "exec/tb-hash.h"
|
||||||
#include "translate-all.h"
|
#include "translate-all.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue