Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 0/9] x86 AREG0 conversion

Finally, I found the bug in SSE helpers (passed cpu_env to pshufx,
not caught because of the ugly casts).

Now this also passes the test with OpenSUSE-12.1-GNOME-LiveCD-x86_64.

It's also possible to use Clang to compile x86 targets with my earlier
Clang patch set applied.

I think this is 1.2 material.

Blue Swirl (9):
  x86: avoid AREG0 for FPU helpers
  x86: avoid AREG0 for condition code helpers
  x86: avoid AREG0 for integer helpers
  x86: avoid AREG0 for SVM helpers
  x86: avoid AREG0 for SMM helpers
  x86: use wrappers for memory access helpers
  x86: avoid AREG0 for misc helpers
  x86: avoid AREG0 in segmentation helpers
  x86: switch to AREG0 free mode

 configure                           |    2 +-
 cpu-all.h                           |   22 +
 target-i386/Makefile.objs           |    9 -
 target-i386/cc_helper.c             |  199 ++++----
 target-i386/cc_helper_template.h    |   36 +-
 target-i386/fpu_helper.c            |  429 ++++++++---------
 target-i386/helper.h                |  352 +++++++-------
 target-i386/int_helper.c            |   44 +-
 target-i386/mem_helper.c            |   46 +-
(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 2/9] x86: avoid AREG0 for condition code helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 target-i386/Makefile.objs           |    1 -
 target-i386/cc_helper.c             |  199 +++++++++++++++++------------------
 target-i386/cc_helper_template.h    |   36 +++---
 target-i386/helper.h                |   20 ++--
 target-i386/int_helper.c            |    8 +-
 target-i386/mem_helper.c            |    4 +-
 target-i386/misc_helper.c           |    2 +-
 target-i386/seg_helper.c            |    8 +-
 target-i386/shift_helper_template.h |    4 +-
 target-i386/translate.c             |   66 ++++++++----
 10 files changed, 179 insertions(+), 169 deletions(-)

diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs
index af99b81..fab2385 100644
--- a/target-i386/Makefile.objs
+++ b/target-i386/Makefile.objs
 <at>  <at>  -6,7 +6,6  <at>  <at>  obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(CONFIG_LINUX_USER) += ioport-user.o
 obj-$(CONFIG_BSD_USER) += ioport-user.o

-$(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/svm_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/smm_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
diff --git a/target-i386/cc_helper.c b/target-i386/cc_helper.c
index ff654bc..07892f9 100644
(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 3/9] x86: avoid AREG0 for integer helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 target-i386/Makefile.objs           |    1 -
 target-i386/helper.h                |   50 +++++++++++++-------------
 target-i386/int_helper.c            |   36 +++++++++---------
 target-i386/shift_helper_template.h |    6 ++-
 target-i386/translate.c             |   66 +++++++++++++++++++++-------------
 5 files changed, 88 insertions(+), 71 deletions(-)

diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs
index fab2385..71b7c7b 100644
--- a/target-i386/Makefile.objs
+++ b/target-i386/Makefile.objs
 <at>  <at>  -6,7 +6,6  <at>  <at>  obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(CONFIG_LINUX_USER) += ioport-user.o
 obj-$(CONFIG_BSD_USER) += ioport-user.o

-$(obj)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/svm_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/smm_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
diff --git a/target-i386/helper.h b/target-i386/helper.h
index d647e54..67c81bf 100644
--- a/target-i386/helper.h
+++ b/target-i386/helper.h
 <at>  <at>  -7,26 +7,26  <at>  <at>  DEF_HELPER_0(lock, void)
 DEF_HELPER_0(unlock, void)
 DEF_HELPER_3(write_eflags, void, env, tl, i32)
(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 1/9] x86: avoid AREG0 for FPU helpers

Make FPU helpers take a parameter for CPUState instead
of relying on global env.

Introduce temporary wrappers for FPU load and store ops. Remove
wrappers for non-AREG0 code. Don't call unconverted helpers
directly.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 target-i386/Makefile.objs    |    1 -
 target-i386/cpu.h            |   11 +
 target-i386/fpu_helper.c     |  433 +++++++++++++++++++--------------------
 target-i386/helper.h         |  172 ++++++++--------
 target-i386/mem_helper.c     |   49 +++++
 target-i386/ops_sse.h        |  378 ++++++++++++++++++----------------
 target-i386/ops_sse_header.h |  334 +++++++++++++++---------------
 target-i386/translate.c      |  466 +++++++++++++++++++++++-------------------
 8 files changed, 968 insertions(+), 876 deletions(-)

diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs
index 683fd59..af99b81 100644
--- a/target-i386/Makefile.objs
+++ b/target-i386/Makefile.objs
 <at>  <at>  -6,7 +6,6  <at>  <at>  obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(CONFIG_LINUX_USER) += ioport-user.o
 obj-$(CONFIG_BSD_USER) += ioport-user.o
 
-$(obj)/fpu_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/cc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/int_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 4/9] x86: avoid AREG0 for SVM helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 target-i386/Makefile.objs |    1 -
 target-i386/helper.h      |   22 +++---
 target-i386/svm_helper.c  |  181 ++++++++++++++++++++++-----------------------
 target-i386/translate.c   |   21 +++---
 4 files changed, 110 insertions(+), 115 deletions(-)

diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs
index 71b7c7b..370fde7 100644
--- a/target-i386/Makefile.objs
+++ b/target-i386/Makefile.objs
 <at>  <at>  -6,7 +6,6  <at>  <at>  obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(CONFIG_LINUX_USER) += ioport-user.o
 obj-$(CONFIG_BSD_USER) += ioport-user.o

-$(obj)/svm_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/smm_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
diff --git a/target-i386/helper.h b/target-i386/helper.h
index 67c81bf..601b8dd 100644
--- a/target-i386/helper.h
+++ b/target-i386/helper.h
 <at>  <at>  -95,17 +95,17  <at>  <at>  DEF_HELPER_1(inw, tl, i32)
 DEF_HELPER_2(outl, void, i32, i32)
 DEF_HELPER_1(inl, tl, i32)

(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 6/9] x86: use wrappers for memory access helpers

Switch to wrapped versions of memory access functions.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 target-i386/cpu.h        |   10 ++
 target-i386/mem_helper.c |   10 ++
 target-i386/seg_helper.c |  209 +++++++++++++++++++++++-----------------------
 3 files changed, 126 insertions(+), 103 deletions(-)

diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 9b2ead8..2d4ca0d 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
 <at>  <at>  -1148,4 +1148,14  <at>  <at>  void cpu_stw_data(CPUX86State *env, target_ulong ptr, uint32_t data);
 void cpu_stl_data(CPUX86State *env, target_ulong ptr, uint32_t data);
 void cpu_stq_data(CPUX86State *env, target_ulong ptr, uint64_t data);

+uint32_t cpu_ldub_kernel(CPUX86State *env, target_ulong ptr);
+uint32_t cpu_lduw_kernel(CPUX86State *env, target_ulong ptr);
+uint32_t cpu_ldl_kernel(CPUX86State *env, target_ulong ptr);
+uint64_t cpu_ldq_kernel(CPUX86State *env, target_ulong ptr);
+
+void cpu_stb_kernel(CPUX86State *env, target_ulong ptr, uint32_t data);
+void cpu_stw_kernel(CPUX86State *env, target_ulong ptr, uint32_t data);
+void cpu_stl_kernel(CPUX86State *env, target_ulong ptr, uint32_t data);
+void cpu_stq_kernel(CPUX86State *env, target_ulong ptr, uint64_t data);
+
 #endif /* CPU_I386_H */
diff --git a/target-i386/mem_helper.c b/target-i386/mem_helper.c
index 30c3bd0..3dd4406 100644
(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 7/9] x86: avoid AREG0 for misc helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 target-i386/Makefile.objs |    1 -
 target-i386/helper.h      |   40 ++++++++++++------------
 target-i386/misc_helper.c |   77 +++++++++++++++++++++------------------------
 target-i386/translate.c   |   49 ++++++++++++++++------------
 4 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs
index f843fe9..04e34f8 100644
--- a/target-i386/Makefile.objs
+++ b/target-i386/Makefile.objs
 <at>  <at>  -6,6 +6,5  <at>  <at>  obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(CONFIG_LINUX_USER) += ioport-user.o
 obj-$(CONFIG_BSD_USER) += ioport-user.o

-$(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/seg_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
diff --git a/target-i386/helper.h b/target-i386/helper.h
index ec7edca..9a9c064 100644
--- a/target-i386/helper.h
+++ b/target-i386/helper.h
 <at>  <at>  -41,12 +41,12  <at>  <at>  DEF_HELPER_4(lcall_protected, void, int, tl, int, int)
 DEF_HELPER_1(iret_real, void, int)
 DEF_HELPER_2(iret_protected, void, int, int)
 DEF_HELPER_2(lret_protected, void, int, int)
-DEF_HELPER_1(read_crN, tl, int)
(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 8/9] x86: avoid AREG0 in segmentation helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Rename remains of op_helper.c to seg_helper.c.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 target-i386/Makefile.objs |    1 -
 target-i386/helper.h      |   38 ++++----
 target-i386/seg_helper.c  |  217 +++++++++++++++++++++------------------------
 target-i386/translate.c   |   54 ++++++------
 4 files changed, 150 insertions(+), 160 deletions(-)

diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs
index 04e34f8..3ea19ca 100644
--- a/target-i386/Makefile.objs
+++ b/target-i386/Makefile.objs
 <at>  <at>  -7,4 +7,3  <at>  <at>  obj-$(CONFIG_LINUX_USER) += ioport-user.o
 obj-$(CONFIG_BSD_USER) += ioport-user.o

 $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
-$(obj)/seg_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
diff --git a/target-i386/helper.h b/target-i386/helper.h
index 9a9c064..0f02103 100644
--- a/target-i386/helper.h
+++ b/target-i386/helper.h
 <at>  <at>  -28,19 +28,19  <at>  <at>  DEF_HELPER_1(aas, void, env)
 DEF_HELPER_1(daa, void, env)
 DEF_HELPER_1(das, void, env)

-DEF_HELPER_1(lsl, tl, tl)
(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 9/9] x86: switch to AREG0 free mode

Add an explicit CPUX86State parameter instead of relying on AREG0.

Remove temporary wrappers and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 configure                 |    2 +-
 cpu-all.h                 |   22 ++++++
 target-i386/Makefile.objs |    2 -
 target-i386/cpu.h         |   21 -----
 target-i386/fpu_helper.c  |    4 +
 target-i386/helper.h      |    8 +-
 target-i386/mem_helper.c  |  101 +++++---------------------
 target-i386/misc_helper.c |    4 +
 target-i386/seg_helper.c  |    4 +
 target-i386/svm_helper.c  |    4 +
 target-i386/translate.c   |  179 +++++++++++++++++++++++----------------------
 11 files changed, 151 insertions(+), 200 deletions(-)

diff --git a/configure b/configure
index 280726c..f4711bc 100755
--- a/configure
+++ b/configure
 <at>  <at>  -3755,7 +3755,7  <at>  <at>  symlink "$source_path/Makefile.target" "$target_dir/Makefile"

 
 case "$target_arch2" in
-  alpha | or32 | sparc* | xtensa* | ppc*)
+  alpha | i386 | or32 | sparc* | x86_64 | xtensa* | ppc*)
     echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
(Continue reading)

Blue Swirl | 7 Aug 2012 21:49
Picon

[PATCH v2 5/9] x86: avoid AREG0 for SMM helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel <at> gmail.com>
---
 target-i386/Makefile.objs |    1 -
 target-i386/helper.h      |    2 +-
 target-i386/smm_helper.c  |   14 ++++----------
 target-i386/translate.c   |    2 +-
 4 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/target-i386/Makefile.objs b/target-i386/Makefile.objs
index 370fde7..f843fe9 100644
--- a/target-i386/Makefile.objs
+++ b/target-i386/Makefile.objs
 <at>  <at>  -6,7 +6,6  <at>  <at>  obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(CONFIG_LINUX_USER) += ioport-user.o
 obj-$(CONFIG_BSD_USER) += ioport-user.o

-$(obj)/smm_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/misc_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/mem_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 $(obj)/seg_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
diff --git a/target-i386/helper.h b/target-i386/helper.h
index 601b8dd..ec7edca 100644
--- a/target-i386/helper.h
+++ b/target-i386/helper.h
 <at>  <at>  -71,7 +71,7  <at>  <at>  DEF_HELPER_1(set_inhibit_irq, void, env)
 DEF_HELPER_1(reset_inhibit_irq, void, env)
 DEF_HELPER_2(boundw, void, tl, int)
 DEF_HELPER_2(boundl, void, tl, int)
(Continue reading)


Gmane