[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/3] target: Set `CF_PCREL` for arm and i386 frontends
From: |
Anton Johansson |
Subject: |
[PATCH 3/3] target: Set `CF_PCREL` for arm and i386 frontends |
Date: |
Tue, 7 Feb 2023 11:43:52 +0100 |
Signed-off-by: Anton Johansson <anjo@rev.ng>
---
target/arm/cpu-param.h | 2 --
target/arm/cpu.c | 5 +++++
target/i386/cpu-param.h | 4 ----
target/i386/cpu.c | 5 +++++
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h
index 53cac9c89b..b7bde18986 100644
--- a/target/arm/cpu-param.h
+++ b/target/arm/cpu-param.h
@@ -31,8 +31,6 @@
# define TARGET_PAGE_BITS_VARY
# define TARGET_PAGE_BITS_MIN 10
-# define TARGET_TB_PCREL 1
-
/*
* Cache the attrs and shareability fields from the page table entry.
*
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 31dc595e11..62b876e0f0 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1551,6 +1551,11 @@ static void arm_cpu_realizefn(DeviceState *dev, Error
**errp)
Error *local_err = NULL;
bool no_aa32 = false;
+ /* Use pc-relative instructions in system-mode */
+#ifndef CONFIG_USER_ONLY
+ cs->tcg_cflags |= CF_PCREL;
+#endif
+
/* If we needed to query the host kernel for the CPU features
* then it's possible that might have failed in the initfn, but
* this is the first point where we can report it.
diff --git a/target/i386/cpu-param.h b/target/i386/cpu-param.h
index f579b16bd2..abad52af20 100644
--- a/target/i386/cpu-param.h
+++ b/target/i386/cpu-param.h
@@ -25,8 +25,4 @@
#define TARGET_PAGE_BITS 12
#define NB_MMU_MODES 5
-#ifndef CONFIG_USER_ONLY
-# define TARGET_TB_PCREL 1
-#endif
-
#endif
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 4d2b8d0444..5be294b122 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6404,6 +6404,11 @@ static void x86_cpu_realizefn(DeviceState *dev, Error
**errp)
static bool ht_warned;
unsigned requested_lbr_fmt;
+ /* Use pc-relative instructions in system-mode */
+#ifndef CONFIG_USER_ONLY
+ cs->tcg_cflags |= CF_PCREL;
+#endif
+
if (cpu->apic_id == UNASSIGNED_APIC_ID) {
error_setg(errp, "apic-id property was not initialized properly");
return;
--
2.39.1