[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/50] target/i386: Assert !ADDSEG for x86_64 user-only
From: |
Richard Henderson |
Subject: |
[PULL 14/50] target/i386: Assert !ADDSEG for x86_64 user-only |
Date: |
Wed, 19 May 2021 13:30:14 -0500 |
LMA disables traditional segmentation, exposing a flat address space.
This means that ADDSEG is off.
Since we're adding an accessor macro, pull the value directly out
of flags otherwise.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20210514151342.384376-15-richard.henderson@linaro.org>
---
target/i386/tcg/translate.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 9c8a405694..7d7ab3e03d 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -108,7 +108,6 @@ typedef struct DisasContext {
#ifdef TARGET_X86_64
bool x86_64_hregs;
#endif
- int addseg; /* non zero if either DS/ES/SS have a non zero base */
int f_st; /* currently unused */
int tf; /* TF cpu flag */
int jmp_opt; /* use direct block chaining for direct jumps */
@@ -156,10 +155,12 @@ typedef struct DisasContext {
#define VM86(S) false
#define CODE32(S) true
#define SS32(S) true
+#define ADDSEG(S) false
#else
#define VM86(S) (((S)->flags & HF_VM_MASK) != 0)
#define CODE32(S) (((S)->flags & HF_CS32_MASK) != 0)
#define SS32(S) (((S)->flags & HF_SS32_MASK) != 0)
+#define ADDSEG(S) (((S)->flags & HF_ADDSEG_MASK) != 0)
#endif
#if !defined(TARGET_X86_64)
#define CODE64(S) false
@@ -492,7 +493,7 @@ static void gen_lea_v_seg(DisasContext *s, MemOp aflag,
TCGv a0,
#endif
case MO_32:
/* 32 bit address */
- if (ovr_seg < 0 && s->addseg) {
+ if (ovr_seg < 0 && ADDSEG(s)) {
ovr_seg = def_seg;
}
if (ovr_seg < 0) {
@@ -505,7 +506,7 @@ static void gen_lea_v_seg(DisasContext *s, MemOp aflag,
TCGv a0,
tcg_gen_ext16u_tl(s->A0, a0);
a0 = s->A0;
if (ovr_seg < 0) {
- if (s->addseg) {
+ if (ADDSEG(s)) {
ovr_seg = def_seg;
} else {
return;
@@ -2429,7 +2430,7 @@ static void gen_push_v(DisasContext *s, TCGv val)
tcg_gen_subi_tl(s->A0, cpu_regs[R_ESP], size);
if (!CODE64(s)) {
- if (s->addseg) {
+ if (ADDSEG(s)) {
new_esp = s->tmp4;
tcg_gen_mov_tl(new_esp, s->A0);
}
@@ -8506,8 +8507,8 @@ static void i386_tr_init_disas_context(DisasContextBase
*dcbase, CPUState *cpu)
g_assert(CODE64(dc) == ((flags & HF_CS64_MASK) != 0));
g_assert(SS32(dc) == ((flags & HF_SS32_MASK) != 0));
g_assert(LMA(dc) == ((flags & HF_LMA_MASK) != 0));
+ g_assert(ADDSEG(dc) == ((flags & HF_ADDSEG_MASK) != 0));
- dc->addseg = (flags >> HF_ADDSEG_SHIFT) & 1;
dc->f_st = 0;
dc->tf = (flags >> TF_SHIFT) & 1;
dc->cc_op = CC_OP_DYNAMIC;
--
2.25.1
- [PULL 05/50] target/i386: Split out check_iopl, (continued)
- [PULL 05/50] target/i386: Split out check_iopl, Richard Henderson, 2021/05/19
- [PULL 08/50] target/i386: Assert IOPL is 0 for user-only, Richard Henderson, 2021/05/19
- [PULL 07/50] target/i386: Assert CPL is 3 for user-only, Richard Henderson, 2021/05/19
- [PULL 06/50] target/i386: Assert PE is set for user-only, Richard Henderson, 2021/05/19
- [PULL 10/50] target/i386: Assert CODE32 for x86_64 user-only, Richard Henderson, 2021/05/19
- [PULL 11/50] target/i386: Assert SS32 for x86_64 user-only, Richard Henderson, 2021/05/19
- [PULL 13/50] target/i386: Assert LMA for x86_64 user-only, Richard Henderson, 2021/05/19
- [PULL 12/50] target/i386: Assert CODE64 for x86_64 user-only, Richard Henderson, 2021/05/19
- [PULL 16/50] target/i386: Tidy REX_B, REX_X definition, Richard Henderson, 2021/05/19
- [PULL 09/50] target/i386: Assert !VM86 for x86_64 user-only, Richard Henderson, 2021/05/19
- [PULL 14/50] target/i386: Assert !ADDSEG for x86_64 user-only,
Richard Henderson <=
- [PULL 18/50] target/i386: Move rex_w into DisasContext, Richard Henderson, 2021/05/19
- [PULL 17/50] target/i386: Move rex_r into DisasContext, Richard Henderson, 2021/05/19
- [PULL 15/50] target/i386: Introduce REX_PREFIX, Richard Henderson, 2021/05/19
- [PULL 22/50] target/i386: Reduce DisasContext.prefix to uint8_t, Richard Henderson, 2021/05/19
- [PULL 23/50] target/i386: Reduce DisasContext.vex_[lv] to uint8_t, Richard Henderson, 2021/05/19
- [PULL 21/50] target/i386: Reduce DisasContext.override to int8_t, Richard Henderson, 2021/05/19
- [PULL 29/50] target/i386: Add stub generator for helper_set_dr, Richard Henderson, 2021/05/19
- [PULL 19/50] target/i386: Remove DisasContext.f_st as unused, Richard Henderson, 2021/05/19
- [PULL 20/50] target/i386: Reduce DisasContext.flags to uint32_t, Richard Henderson, 2021/05/19
- [PULL 30/50] target/i386: Assert !SVME for user-only, Richard Henderson, 2021/05/19