aboutsummaryrefslogtreecommitdiff
path: root/exec.h
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-05-25 19:20:31 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-05-25 19:20:31 +0000
commitcf25629d1eafe17cc789b2c5ce73e5c9ef986435 (patch)
treee932a1fe73b80892ee3571f7c41c398de8738d8a /exec.h
parent0ca790b92e1912b7d465deddaef31d9a783da4b9 (diff)
more efficient locking
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@186 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec.h')
-rw-r--r--exec.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/exec.h b/exec.h
index c6a6d1b23e..29a7ab1fda 100644
--- a/exec.h
+++ b/exec.h
@@ -23,9 +23,9 @@
#define GEN_FLAG_SS32_SHIFT 2
#define GEN_FLAG_VM_SHIFT 3
#define GEN_FLAG_ST_SHIFT 4
-#define GEN_FLAG_CPL_SHIFT 7
-#define GEN_FLAG_IOPL_SHIFT 9
-#define GEN_FLAG_TF_SHIFT 11
+#define GEN_FLAG_TF_SHIFT 8 /* same position as eflags */
+#define GEN_FLAG_CPL_SHIFT 9
+#define GEN_FLAG_IOPL_SHIFT 12 /* same position as eflags */
struct TranslationBlock;
int cpu_x86_gen_code(uint8_t *gen_code_buf, int max_code_size,
@@ -150,12 +150,15 @@ static inline void tb_set_jmp_target(TranslationBlock *tb,
static inline void tb_add_jump(TranslationBlock *tb, int n,
TranslationBlock *tb_next)
{
- /* patch the native jump address */
- tb_set_jmp_target(tb, n, (unsigned long)tb_next->tc_ptr);
-
- /* add in TB jmp circular list */
- tb->jmp_next[n] = tb_next->jmp_first;
- tb_next->jmp_first = (TranslationBlock *)((long)(tb) | (n));
+ /* NOTE: this test is only needed for thread safety */
+ if (!tb->jmp_next[n]) {
+ /* patch the native jump address */
+ tb_set_jmp_target(tb, n, (unsigned long)tb_next->tc_ptr);
+
+ /* add in TB jmp circular list */
+ tb->jmp_next[n] = tb_next->jmp_first;
+ tb_next->jmp_first = (TranslationBlock *)((long)(tb) | (n));
+ }
}
#ifndef offsetof