[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-7.2 17/21] accel/tcg: Introduce is_same_page()
From: |
Richard Henderson |
Subject: |
[PATCH for-7.2 17/21] accel/tcg: Introduce is_same_page() |
Date: |
Fri, 12 Aug 2022 11:08:02 -0700 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
Introduce a function that checks whether a given address is on the same
page as where disassembly started. Having it improves readability of
the following patches.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20220811095534.241224-3-iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[rth: Make the DisasContextBase parameter const.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/exec/translator.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/exec/translator.h b/include/exec/translator.h
index 7db6845535..0d0bf3a31e 100644
--- a/include/exec/translator.h
+++ b/include/exec/translator.h
@@ -187,4 +187,14 @@ FOR_EACH_TRANSLATOR_LD(GEN_TRANSLATOR_LD)
#undef GEN_TRANSLATOR_LD
+/*
+ * Return whether addr is on the same page as where disassembly started.
+ * Translators can use this to enforce the rule that only single-insn
+ * translation blocks are allowed to cross page boundaries.
+ */
+static inline bool is_same_page(const DisasContextBase *db, target_ulong addr)
+{
+ return ((addr ^ db->pc_first) & TARGET_PAGE_MASK) == 0;
+}
+
#endif /* EXEC__TRANSLATOR_H */
--
2.34.1
- Re: [PATCH for-7.2 14/21] accel/tcg: Hoist get_page_addr_code out of tb_lookup, (continued)
- Re: [PATCH for-7.2 14/21] accel/tcg: Hoist get_page_addr_code out of tb_lookup, Ilya Leoshkevich, 2022/08/17
- Re: [PATCH for-7.2 14/21] accel/tcg: Hoist get_page_addr_code out of tb_lookup, Richard Henderson, 2022/08/17
- Re: [PATCH for-7.2 14/21] accel/tcg: Hoist get_page_addr_code out of tb_lookup, Ilya Leoshkevich, 2022/08/17
- Re: [PATCH for-7.2 14/21] accel/tcg: Hoist get_page_addr_code out of tb_lookup, Richard Henderson, 2022/08/17
- Re: [PATCH for-7.2 14/21] accel/tcg: Hoist get_page_addr_code out of tb_lookup, Ilya Leoshkevich, 2022/08/17
- Re: [PATCH for-7.2 14/21] accel/tcg: Hoist get_page_addr_code out of tb_lookup, Richard Henderson, 2022/08/17
- Re: [PATCH for-7.2 14/21] accel/tcg: Hoist get_page_addr_code out of tb_lookup, Richard Henderson, 2022/08/17
[PATCH for-7.2 12/21] accel/tcg: Add nofault parameter to get_page_addr_code_hostp, Richard Henderson, 2022/08/12
[PATCH for-7.2 16/21] accel/tcg: Raise PROT_EXEC exception early, Richard Henderson, 2022/08/12
[PATCH for-7.2 15/21] accel/tcg: Hoist get_page_addr_code out of tb_gen_code, Richard Henderson, 2022/08/12
[PATCH for-7.2 17/21] accel/tcg: Introduce is_same_page(),
Richard Henderson <=
[PATCH for-7.2 18/21] accel/tcg: Remove translator_ldsw, Richard Henderson, 2022/08/12
[PATCH for-7.2 20/21] accel/tcg: Add fast path for translator_ld*, Richard Henderson, 2022/08/12
[PATCH for-7.2 19/21] accel/tcg: Add pc and host_pc params to gen_intermediate_code, Richard Henderson, 2022/08/12
[PATCH for-7.2 21/21] accel/tcg: Use DisasContextBase in plugin_gen_tb_start, Richard Henderson, 2022/08/12
Re: [PATCH for-7.2 00/21] accel/tcg: minimize tlb lookups during translate + user-only PROT_EXEC fixes, Ilya Leoshkevich, 2022/08/16