mac_via: remove VIA1 timer optimisations
[qemu/ar7.git] / include / exec / tb-lookup.h
blob29d61ceb3407346897541ba69f14d117340ce5e8
1 /*
2 * Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
4 * License: GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7 #ifndef EXEC_TB_LOOKUP_H
8 #define EXEC_TB_LOOKUP_H
10 #ifdef NEED_CPU_H
11 #include "cpu.h"
12 #else
13 #include "exec/poison.h"
14 #endif
16 #include "exec/exec-all.h"
17 #include "exec/tb-hash.h"
19 /* Might cause an exception, so have a longjmp destination ready */
20 static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
21 target_ulong cs_base,
22 uint32_t flags, uint32_t cflags)
24 TranslationBlock *tb;
25 uint32_t hash;
27 /* we should never be trying to look up an INVALID tb */
28 tcg_debug_assert(!(cflags & CF_INVALID));
30 hash = tb_jmp_cache_hash_func(pc);
31 tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]);
33 if (likely(tb &&
34 tb->pc == pc &&
35 tb->cs_base == cs_base &&
36 tb->flags == flags &&
37 tb->trace_vcpu_dstate == *cpu->trace_dstate &&
38 tb_cflags(tb) == cflags)) {
39 return tb;
41 tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags);
42 if (tb == NULL) {
43 return NULL;
45 qatomic_set(&cpu->tb_jmp_cache[hash], tb);
46 return tb;
49 #endif /* EXEC_TB_LOOKUP_H */