[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/28] target-i386: Introduce mo_stacksize
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 17/28] target-i386: Introduce mo_stacksize |
Date: |
Mon, 8 Feb 2016 18:03:08 +0100 |
From: Richard Henderson <address@hidden>
Centralize computation of a MO_SIZE for the stack pointer.
Signed-off-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
target-i386/translate.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/target-i386/translate.c b/target-i386/translate.c
index fd168f0..57dfec8 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -304,6 +304,12 @@ static inline TCGMemOp mo_pushpop(DisasContext *s,
TCGMemOp ot)
}
}
+/* Select the size of the stack pointer. */
+static inline TCGMemOp mo_stacksize(DisasContext *s)
+{
+ return CODE64(s) ? MO_64 : s->ss32 ? MO_32 : MO_16;
+}
+
/* Select only size 64 else 32. Used for SSE operand sizes. */
static inline TCGMemOp mo_64_32(TCGMemOp ot)
{
@@ -2289,31 +2295,22 @@ gen_svm_check_intercept(DisasContext *s, target_ulong
pc_start, uint64_t type)
static inline void gen_stack_update(DisasContext *s, int addend)
{
-#ifdef TARGET_X86_64
- if (CODE64(s)) {
- gen_op_add_reg_im(MO_64, R_ESP, addend);
- } else
-#endif
- if (s->ss32) {
- gen_op_add_reg_im(MO_32, R_ESP, addend);
- } else {
- gen_op_add_reg_im(MO_16, R_ESP, addend);
- }
+ gen_op_add_reg_im(mo_stacksize(s), R_ESP, addend);
}
/* Generate a push. It depends on ss32, addseg and dflag. */
static void gen_push_v(DisasContext *s, TCGv val)
{
- TCGMemOp a_ot, d_ot = mo_pushpop(s, s->dflag);
+ TCGMemOp d_ot = mo_pushpop(s, s->dflag);
+ TCGMemOp a_ot = mo_stacksize(s);
int size = 1 << d_ot;
TCGv new_esp = cpu_A0;
tcg_gen_subi_tl(cpu_A0, cpu_regs[R_ESP], size);
if (CODE64(s)) {
- a_ot = MO_64;
+ /* No special handling. */
} else if (s->ss32) {
- a_ot = MO_32;
if (s->addseg) {
new_esp = cpu_tmp4;
tcg_gen_mov_tl(new_esp, cpu_A0);
@@ -2322,7 +2319,6 @@ static void gen_push_v(DisasContext *s, TCGv val)
tcg_gen_ext32u_tl(cpu_A0, cpu_A0);
}
} else {
- a_ot = MO_16;
new_esp = cpu_tmp4;
tcg_gen_ext16u_tl(cpu_A0, cpu_A0);
tcg_gen_mov_tl(new_esp, cpu_A0);
--
1.8.3.1
- [Qemu-devel] [PULL 01/28] memory: add early bail out from cpu_physical_memory_set_dirty_range, (continued)
- [Qemu-devel] [PULL 01/28] memory: add early bail out from cpu_physical_memory_set_dirty_range, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 03/28] qemu-char: Keep pty slave file descriptor open until the master is closed, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 02/28] memory: RCU ram_list.dirty_memory[] for safe RAM hotplug, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 06/28] scsi: push WWN fields up to SCSIDevice, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 07/28] scsi-generic: grab device and port SAS addresses from backend, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 05/28] include/qemu/atomic.h: default to __atomic functions, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 04/28] configure: sanity check the glib library that pkg-config finds, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 09/28] qemu-nbd: Fix unintended texi verbatim formatting, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 12/28] scripts/kvm/kvm_stat: Fix tracefs access checking, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 14/28] kvm-all: trace: strerror fixup, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 17/28] target-i386: Introduce mo_stacksize,
Paolo Bonzini <=
- [Qemu-devel] [PULL 15/28] char: fix repeated registration of tcp chardev I/O handlers, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 18/28] target-i386: Use gen_lea_v_seg in gen_lea_modrm, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 19/28] target-i386: Use gen_lea_v_seg in stack subroutines, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 10/28] qemu-nbd: Minor texi updates, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 11/28] qemu-nbd: Fix texi sentence capitalisation, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 13/28] nbd: avoid unaligned uint64_t store, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 16/28] target-i386: Create gen_lea_v_seg, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 08/28] hw: Add support for LSI SAS1068 (mptsas) device, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 20/28] target-i386: Access segs via TCG registers, Paolo Bonzini, 2016/02/08
- [Qemu-devel] [PULL 22/28] target-i386: Rewrite gen_enter inline, Paolo Bonzini, 2016/02/08