From: Anton Johansson via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org
Cc: ale@rev.ng, richard.henderson@linaro.org, pbonzini@redhat.com,
eduardo@habkost.net, peter.maydell@linaro.org, mrolnik@gmail.com,
tsimpson@quicinc.com, gaosong@loongson.cn,
yangxiaojuan@loongson.cn, edgar.iglesias@gmail.com,
philmd@linaro.org, shorne@gmail.com, palmer@dabbelt.com,
alistair.francis@wdc.com, bin.meng@windriver.com,
ysato@users.sourceforge.jp, mark.cave-ayland@ilande.co.uk,
atar4qemu@gmail.com, kbastian@mail.uni-paderborn.de
Subject: [PATCH v2 06/27] target/arm: Replace `TARGET_TB_PCREL` with `CF_PCREL`
Date: Tue, 21 Feb 2023 23:17:57 +0100 [thread overview]
Message-ID: <20230221221818.9382-7-anjo@rev.ng> (raw)
In-Reply-To: <20230221221818.9382-1-anjo@rev.ng>
Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/cpu.c | 8 ++++----
target/arm/translate-a64.c | 8 ++++----
target/arm/translate.c | 6 +++---
target/arm/translate.h | 2 +-
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index c38420a4d1..c05cb86a47 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -78,8 +78,8 @@ static vaddr arm_cpu_get_pc(CPUState *cs)
void arm_cpu_synchronize_from_tb(CPUState *cs,
const TranslationBlock *tb)
{
- /* The program counter is always up to date with TARGET_TB_PCREL. */
- if (!TARGET_TB_PCREL) {
+ /* The program counter is always up to date with CF_PCREL. */
+ if (!(tb_cflags(tb) & CF_PCREL)) {
CPUARMState *env = cs->env_ptr;
/*
* It's OK to look at env for the current mode here, because it's
@@ -100,7 +100,7 @@ void arm_restore_state_to_opc(CPUState *cs,
CPUARMState *env = cs->env_ptr;
if (is_a64(env)) {
- if (TARGET_TB_PCREL) {
+ if (tb_cflags(tb) & CF_PCREL) {
env->pc = (env->pc & TARGET_PAGE_MASK) | data[0];
} else {
env->pc = data[0];
@@ -108,7 +108,7 @@ void arm_restore_state_to_opc(CPUState *cs,
env->condexec_bits = 0;
env->exception.syndrome = data[2] << ARM_INSN_START_WORD2_SHIFT;
} else {
- if (TARGET_TB_PCREL) {
+ if (tb_cflags(tb) & CF_PCREL) {
env->regs[15] = (env->regs[15] & TARGET_PAGE_MASK) | data[0];
} else {
env->regs[15] = data[0];
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index da9f877476..b6d00b81da 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -143,7 +143,7 @@ static void reset_btype(DisasContext *s)
static void gen_pc_plus_diff(DisasContext *s, TCGv_i64 dest, target_long diff)
{
assert(s->pc_save != -1);
- if (TARGET_TB_PCREL) {
+ if (tb_cflags(s->base.tb) & CF_PCREL) {
tcg_gen_addi_i64(dest, cpu_pc, (s->pc_curr - s->pc_save) + diff);
} else {
tcg_gen_movi_i64(dest, s->pc_curr + diff);
@@ -393,7 +393,7 @@ static void gen_goto_tb(DisasContext *s, int n, int64_t diff)
* update to pc to the unlinked path. A long chain of links
* can thus avoid many updates to the PC.
*/
- if (TARGET_TB_PCREL) {
+ if (tb_cflags(s->base.tb) & CF_PCREL) {
gen_a64_update_pc(s, diff);
tcg_gen_goto_tb(n);
} else {
@@ -4297,7 +4297,7 @@ static void disas_pc_rel_adr(DisasContext *s, uint32_t insn)
if (page) {
/* ADRP (page based) */
offset <<= 12;
- /* The page offset is ok for TARGET_TB_PCREL. */
+ /* The page offset is ok for CF_PCREL. */
offset -= s->pc_curr & 0xfff;
}
@@ -14809,7 +14809,7 @@ static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
DisasContext *dc = container_of(dcbase, DisasContext, base);
target_ulong pc_arg = dc->base.pc_next;
- if (TARGET_TB_PCREL) {
+ if (tb_cflags(dcbase->tb) & CF_PCREL) {
pc_arg &= ~TARGET_PAGE_MASK;
}
tcg_gen_insn_start(pc_arg, 0, 0);
diff --git a/target/arm/translate.c b/target/arm/translate.c
index c23a3462bf..0e7d3b8561 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -269,7 +269,7 @@ static target_long jmp_diff(DisasContext *s, target_long diff)
static void gen_pc_plus_diff(DisasContext *s, TCGv_i32 var, target_long diff)
{
assert(s->pc_save != -1);
- if (TARGET_TB_PCREL) {
+ if (tb_cflags(s->base.tb) & CF_PCREL) {
tcg_gen_addi_i32(var, cpu_R[15], (s->pc_curr - s->pc_save) + diff);
} else {
tcg_gen_movi_i32(var, s->pc_curr + diff);
@@ -2620,7 +2620,7 @@ static void gen_goto_tb(DisasContext *s, int n, target_long diff)
* update to pc to the unlinked path. A long chain of links
* can thus avoid many updates to the PC.
*/
- if (TARGET_TB_PCREL) {
+ if (tb_cflags(s->base.tb) & CF_PCREL) {
gen_update_pc(s, diff);
tcg_gen_goto_tb(n);
} else {
@@ -9542,7 +9542,7 @@ static void arm_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
uint32_t condexec_bits;
target_ulong pc_arg = dc->base.pc_next;
- if (TARGET_TB_PCREL) {
+ if (tb_cflags(dcbase->tb) & CF_PCREL) {
pc_arg &= ~TARGET_PAGE_MASK;
}
if (dc->eci) {
diff --git a/target/arm/translate.h b/target/arm/translate.h
index 3717824b75..4001372acd 100644
--- a/target/arm/translate.h
+++ b/target/arm/translate.h
@@ -23,7 +23,7 @@ typedef struct DisasContext {
/* The address of the current instruction being translated. */
target_ulong pc_curr;
/*
- * For TARGET_TB_PCREL, the full value of cpu_pc is not known
+ * For CF_PCREL, the full value of cpu_pc is not known
* (although the page offset is known). For convenience, the
* translation loop uses the full virtual address that triggered
* the translation, from base.pc_start through pc_curr.
--
2.39.1
next prev parent reply other threads:[~2023-02-21 22:21 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 22:17 [PATCH v2 00/27] Replace TARGET_TB_PCREL with CF_PCREL Anton Johansson via
2023-02-21 22:17 ` [PATCH v2 01/27] include/exec: Introduce `CF_PCREL` Anton Johansson via
2023-02-21 22:17 ` [PATCH v2 02/27] target/i386: set `CF_PCREL` in `x86_cpu_realizefn` Anton Johansson via
2023-02-21 22:17 ` [PATCH v2 03/27] target/arm: set `CF_PCREL` in `arm_cpu_realizefn` Anton Johansson via
2023-02-21 22:17 ` [PATCH v2 04/27] accel/tcg: Replace `TARGET_TB_PCREL` with `CF_PCREL` Anton Johansson via
2023-02-21 22:17 ` [PATCH v2 05/27] include/exec: " Anton Johansson via
2023-02-21 22:17 ` Anton Johansson via [this message]
2023-02-21 22:17 ` [PATCH v2 07/27] target/i386: " Anton Johansson via
2023-02-21 22:17 ` [PATCH v2 08/27] include/exec: Remove `TARGET_TB_PCREL` define Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 09/27] target/arm: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 10/27] target/i386: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 11/27] accel/tcg: Move jmp-cache `CF_PCREL` checks to caller Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 12/27] accel/tcg: Replace `tb_pc()` with `tb->pc` Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 13/27] target/tricore: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 14/27] target/sparc: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 15/27] target/sh4: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 16/27] target/rx: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 17/27] target/riscv: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 18/27] target/openrisc: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 19/27] target/mips: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 20/27] target/microblaze: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 21/27] target/loongarch: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 22/27] target/i386: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 23/27] target/hppa: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 24/27] target/hexagon: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 25/27] target/avr: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 26/27] target/arm: " Anton Johansson via
2023-02-21 22:18 ` [PATCH v2 27/27] include/exec: Remove `tb_pc()` Anton Johansson via
2023-02-21 22:39 ` [PATCH v2 00/27] Replace TARGET_TB_PCREL with CF_PCREL Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230221221818.9382-7-anjo@rev.ng \
--to=qemu-devel@nongnu.org \
--cc=ale@rev.ng \
--cc=alistair.francis@wdc.com \
--cc=anjo@rev.ng \
--cc=atar4qemu@gmail.com \
--cc=bin.meng@windriver.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=gaosong@loongson.cn \
--cc=kbastian@mail.uni-paderborn.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=mrolnik@gmail.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=richard.henderson@linaro.org \
--cc=shorne@gmail.com \
--cc=tsimpson@quicinc.com \
--cc=yangxiaojuan@loongson.cn \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).