Skip to contentSkip to conversation

move user-exec, tcg-runtime, atomic_template.h to accel/tcg/

PATCH In review Philippe Mathieu-Daudé 4 participants 11 messages Sep 11, 2017 – Sep 12, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover move user-exec, tcg-runtime, atomic_template.h to accel/tcg/

As suggested by Paolo:

That part of tcg/tcg-runtime.c probably should be moved to user-exec.c, and user-exec.c should in turn be in accel/tcg.

in http://lists.nongnu.org/archive/html/qemu-devel/2017-07/msg03657.html

also update MAINTAINERS accordingly.

Regards,

Phil.

Philippe Mathieu-Daudé (4):
tcg: move user-exec
tcg: move tcg-runtime to accel/tcg/
tcg: move atomic_template.h to accel/tcg/
tcg: restrict i386 regs definitions

Thomas Huth (1):
tcg: Move softmmu_template.h to the accel/tcg/ folder

 Makefile.target                                    |  6 +++---
 atomic_template.h => accel/tcg/atomic_template.h   |  0
 softmmu_template.h => accel/tcg/softmmu_template.h |  0
 {tcg => accel/tcg}/tcg-runtime.h                   |  0
 {tcg => accel/tcg}/tcg-runtime.c                   |  0
 user-exec-stub.c => accel/tcg/user-exec-stub.c     |  0
 user-exec.c => accel/tcg/user-exec.c               | 18 +++++++++---------
 MAINTAINERS                                        |  4 +---
 accel/tcg/Makefile.objs                            |  4 ++++
 9 files changed, 17 insertions(+), 15 deletions(-)
 rename atomic_template.h => accel/tcg/atomic_template.h (100%)
 rename softmmu_template.h => accel/tcg/softmmu_template.h (100%)
 rename {tcg => accel/tcg}/tcg-runtime.h (100%)
 rename {tcg => accel/tcg}/tcg-runtime.c (100%)
 rename user-exec-stub.c => accel/tcg/user-exec-stub.c (100%)
 rename user-exec.c => accel/tcg/user-exec.c (100%)

Based-on: [email protected]

Signature · 1 line
2.14.1
#1 lore raw

PATCH v2 1/5 tcg: Move softmmu_template.h to the accel/tcg/ folder

From: Thomas Huth <[email protected]>

The header is only used by accel/tcg/cputlb.c so we can move it to the accel/tcg/ folder, too.

[PMD: reword commit title to match series]
---
 softmmu_template.h => accel/tcg/softmmu_template.h | 0
 MAINTAINERS                                        | 1 -
 2 files changed, 1 deletion(-)
 rename softmmu_template.h => accel/tcg/softmmu_template.h (100%)
accel/tcg/softmmu_template.h renamed from softmmu_template.h +0 -0
similarity index 100%
rename from softmmu_template.h
rename to accel/tcg/softmmu_template.h
MAINTAINERS +0 -1
index 36eeb42d19..a6b7e1c19f 100644
@@ -86,7 +86,6 @@ M: Richard Henderson <[email protected]>
 S: Maintained
 F: cpus.c
 F: exec.c
-F: softmmu_template.h
 F: accel/tcg/
 F: include/exec/cpu*.h
 F: include/exec/exec-all.h
Signature · 1 line
2.14.1
#2 lore raw

PATCH v2 2/5 tcg: move user-exec to accel/tcg/

In reply to Philippe Mathieu-Daudé
---
 Makefile.target                                | 4 ++--
 user-exec-stub.c => accel/tcg/user-exec-stub.c | 0
 user-exec.c => accel/tcg/user-exec.c           | 0
 MAINTAINERS                                    | 3 +--
 accel/tcg/Makefile.objs                        | 3 +++
 5 files changed, 6 insertions(+), 4 deletions(-)
 rename user-exec-stub.c => accel/tcg/user-exec-stub.c (100%)
 rename user-exec.c => accel/tcg/user-exec.c (100%)
Makefile.target +2 -2
index 7f42c45db8..520305b025 100644
@@ -119,7 +119,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
              -I$(SRC_PATH)/linux-user
 
 obj-y += linux-user/
-obj-y += gdbstub.o thunk.o user-exec.o user-exec-stub.o
+obj-y += gdbstub.o thunk.o
 
 endif #CONFIG_LINUX_USER
 
@@ -132,7 +132,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
 			 -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
 
 obj-y += bsd-user/
-obj-y += gdbstub.o user-exec.o user-exec-stub.o
+obj-y += gdbstub.o
 
 endif #CONFIG_BSD_USER
 
accel/tcg/user-exec-stub.c renamed from user-exec-stub.c +0 -0
similarity index 100%
rename from user-exec-stub.c
rename to accel/tcg/user-exec-stub.c
accel/tcg/user-exec.c renamed from user-exec.c +0 -0
similarity index 100%
rename from user-exec.c
rename to accel/tcg/user-exec.c
MAINTAINERS +1 -2
index a6b7e1c19f..b2d4a4711f 100644
@@ -1602,8 +1602,7 @@ Overall
 M: Riku Voipio <[email protected]>
 S: Maintained
 F: thunk.c
-F: user-exec.c
-F: user-exec-stub.c
+F: accel/tcg/user-exec*.c
 
 BSD user
 S: Orphan
accel/tcg/Makefile.objs +3 -0
index 22642e6f75..f2422d0fb3 100644
@@ -2,3 +2,6 @@ obj-$(CONFIG_SOFTMMU) += tcg-all.o
 obj-$(CONFIG_SOFTMMU) += cputlb.o
 obj-y += cpu-exec.o cpu-exec-common.o translate-all.o
 obj-y += translator.o
+
+obj-$(CONFIG_USER_ONLY) += user-exec.o
+obj-$(call lnot,$(CONFIG_SOFTMMU)) += user-exec-stub.o
Signature · 1 line
2.14.1
#3 lore raw

PATCH v2 3/5 tcg: move tcg-runtime to accel/tcg/

In reply to Philippe Mathieu-Daudé
---
 Makefile.target                  | 2 +-
 {tcg => accel/tcg}/tcg-runtime.h | 0
 {tcg => accel/tcg}/tcg-runtime.c | 0
 accel/tcg/Makefile.objs          | 1 +
 4 files changed, 2 insertions(+), 1 deletion(-)
 rename {tcg => accel/tcg}/tcg-runtime.h (100%)
 rename {tcg => accel/tcg}/tcg-runtime.c (100%)
Makefile.target +1 -1
index 520305b025..6361f957fb 100644
@@ -94,7 +94,7 @@ all: $(PROGS) stap
 obj-y += exec.o
 obj-y += accel/
 obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o
-obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/tcg-runtime.o
+obj-$(CONFIG_TCG) += tcg/tcg-common.o
 obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o
 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
 obj-y += fpu/softfloat.o
accel/tcg/tcg-runtime.h renamed from tcg/tcg-runtime.h +0 -0
similarity index 100%
rename from tcg/tcg-runtime.h
rename to accel/tcg/tcg-runtime.h
accel/tcg/tcg-runtime.c renamed from tcg/tcg-runtime.c +0 -0
similarity index 100%
rename from tcg/tcg-runtime.c
rename to accel/tcg/tcg-runtime.c
accel/tcg/Makefile.objs +1 -0
index f2422d0fb3..228cd84fa4 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_SOFTMMU) += tcg-all.o
 obj-$(CONFIG_SOFTMMU) += cputlb.o
+obj-y += tcg-runtime.o
 obj-y += cpu-exec.o cpu-exec-common.o translate-all.o
 obj-y += translator.o
 
Signature · 1 line
2.14.1
#4 lore raw

Re: [Qemu-devel] [PATCH v2 3/5] tcg: move tcg-runtime to accel/tcg/

----- Original Message -----

Quoted 9 lines

From: "Philippe Mathieu-Daudé" <[email protected]>
To: "Paolo Bonzini" <[email protected]>, "Richard Henderson" <[email protected]>, "Peter Crosthwaite" <[email protected]>, "Thomas Huth" <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>, [email protected]
Sent: Monday, September 11, 2017 11:33:26 PM
Subject: [PATCH v2 3/5] tcg: move tcg-runtime to accel/tcg/

To make this better, the "#ifndef CONFIG_SOFTMMU" part at the end of this should be moved to user-exec.c. Feel free to just post a sixth patch for it.

Paolo

Quoted 45 lines
---
 Makefile.target                  | 2 +-
 {tcg => accel/tcg}/tcg-runtime.h | 0
 {tcg => accel/tcg}/tcg-runtime.c | 0
 accel/tcg/Makefile.objs          | 1 +
 4 files changed, 2 insertions(+), 1 deletion(-)
 rename {tcg => accel/tcg}/tcg-runtime.h (100%)
 rename {tcg => accel/tcg}/tcg-runtime.c (100%)
Makefile.target +1 -1
index 520305b025..6361f957fb 100644
@@ -94,7 +94,7 @@ all: $(PROGS) stap
 obj-y += exec.o
 obj-y += accel/
 obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o
-obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/tcg-runtime.o
+obj-$(CONFIG_TCG) += tcg/tcg-common.o
 obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o
 obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
 obj-y += fpu/softfloat.o
accel/tcg/tcg-runtime.h renamed from tcg/tcg-runtime.h +0 -0
similarity index 100%
rename from tcg/tcg-runtime.h
rename to accel/tcg/tcg-runtime.h
accel/tcg/tcg-runtime.c renamed from tcg/tcg-runtime.c +0 -0
similarity index 100%
rename from tcg/tcg-runtime.c
rename to accel/tcg/tcg-runtime.c
accel/tcg/Makefile.objs +1 -1
index f2422d0fb3..228cd84fa4 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_SOFTMMU) += tcg-all.o
 obj-$(CONFIG_SOFTMMU) += cputlb.o
+obj-y += tcg-runtime.o
 obj-y += cpu-exec.o cpu-exec-common.o translate-all.o
 obj-y += translator.o
 
--

2.14.1

#5 lore raw

PATCH v2 4/5 tcg: move atomic_template.h to accel/tcg/

In reply to Philippe Mathieu-Daudé
---
 atomic_template.h => accel/tcg/atomic_template.h | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename atomic_template.h => accel/tcg/atomic_template.h (100%)
accel/tcg/atomic_template.h renamed from atomic_template.h +0 -0
similarity index 100%
rename from atomic_template.h
rename to accel/tcg/atomic_template.h
Signature · 1 line
2.14.1
#6 lore raw

PATCH v2 5/5 tcg: restrict i386 regs definitions

In reply to Philippe Mathieu-Daudé

---
cleaning while here :)

 accel/tcg/user-exec.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
accel/tcg/user-exec.c +9 -9
index 2a975eaf69..484a3f5f8f 100644
@@ -25,15 +25,6 @@
 #include "exec/cpu_ldst.h"
 #include "translate-all.h"
 
-#undef EAX
-#undef ECX
-#undef EDX
-#undef EBX
-#undef ESP
-#undef EBP
-#undef ESI
-#undef EDI
-#undef EIP
 #ifdef __linux__
 #include <sys/ucontext.h>
 #endif
@@ -131,6 +122,15 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 }
 
 #if defined(__i386__)
+#undef EAX
+#undef ECX
+#undef EDX
+#undef EBX
+#undef ESP
+#undef EBP
+#undef ESI
+#undef EDI
+#undef EIP
 
 #if defined(__NetBSD__)
 #include <ucontext.h>
Signature · 1 line
2.14.1
#7 lore raw

Re: [Qemu-devel] [PATCH v2 5/5] tcg: restrict i386 regs definitions

Quoted 34 lines · Philippe Mathieu-Daudé

---
cleaning while here :)

 accel/tcg/user-exec.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
accel/tcg/user-exec.c +2 -9
index 2a975eaf69..484a3f5f8f 100644
@@ -25,15 +25,6 @@
 #include "exec/cpu_ldst.h"
 #include "translate-all.h"
 
-#undef EAX
-#undef ECX
-#undef EDX
-#undef EBX
-#undef ESP
-#undef EBP
-#undef ESI
-#undef EDI
-#undef EIP
 #ifdef __linux__
 #include <sys/ucontext.h>
 #endif
@@ -131,6 +122,15 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 }
 
 #if defined(__i386__)
+#undef EAX
+#undef ECX

accel/tcg/user-exec.c static inline int handle_cpu_signal(uintptr_t pc, unsigned long address, · line 136

Quoted 10 lines
accel/tcg/user-exec.c +7 -0
+#undef EDX
+#undef EBX
+#undef ESP
+#undef EBP
+#undef ESI
+#undef EDI
+#undef EIP
 
 #if defined(__NetBSD__)
 #include <ucontext.h>

Why to move under i386?

SmartOS pollutes namespace with these symbols on x86_64.

#8 lore raw

Re: [Qemu-devel] [PATCH v2 5/5] tcg: restrict i386 regs definitions

Quoted 42 lines · Kamil Rytarowski
Quoted 41 lines · Philippe Mathieu-Daudé

---
cleaning while here :)

  accel/tcg/user-exec.c | 18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
accel/tcg/user-exec.c +9 -9
index 2a975eaf69..484a3f5f8f 100644
@@ -25,15 +25,6 @@
  #include "exec/cpu_ldst.h"
  #include "translate-all.h"
 
-#undef EAX
-#undef ECX
-#undef EDX
-#undef EBX
-#undef ESP
-#undef EBP
-#undef ESI
-#undef EDI
-#undef EIP
  #ifdef __linux__
  #include <sys/ucontext.h>
  #endif
@@ -131,6 +122,15 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
  }
 
  #if defined(__i386__)
+#undef EAX
+#undef ECX
+#undef EDX
+#undef EBX
+#undef ESP
+#undef EBP
+#undef ESI
+#undef EDI
+#undef EIP
 
Quoted 5 lines

accel/tcg/user-exec.c static inline int handle_cpu_signal(uintptr_t pc, unsigned long address, · line 136

Quoted 3 lines
accel/tcg/user-exec.c +0 -0
  #if defined(__NetBSD__)
  #include <ucontext.h>

Why to move under i386?

I tracked the origin of these #defines in op-i386.c (7bfdb6d18c7b) and thought the Exx naming was for i386 while the x86_64 uses the Rxx naming (RAX .. RIP) so you'd only have them on i386 arch. However it seems I didn't realize you can access x86_64 registers in 32-bit mode via the EAX .. EIP naming, as you see I'm not confident with this CISC arch :S

So I guess it's best to ignore this patch?

Quoted 3 lines

SmartOS pollutes namespace with these symbols on x86_64.

you should provide some VM :P

I plan to test this project soon:
https://www.packer.io/docs/builders/qemu.html

Regards,

Phil.

#9 lore raw

Re: [Qemu-devel] [PATCH v2 5/5] tcg: restrict i386 regs definitions

Quoted 47 lines · Philippe Mathieu-Daudé
Quoted 37 lines · Kamil Rytarowski
Quoted 36 lines · Philippe Mathieu-Daudé

---
cleaning while here :)

  accel/tcg/user-exec.c | 18 +++++++++---------

  1 file changed, 9 insertions(+), 9 deletions(-)
accel/tcg/user-exec.c +0 -0
index 2a975eaf69..484a3f5f8f 100644
@@ -25,15 +25,6 @@
   #include "exec/cpu_ldst.h"
   #include "translate-all.h"

  -#undef EAX

accel/tcg/user-exec.c +0 -8
-#undef ECX
-#undef EDX
-#undef EBX
-#undef ESP
-#undef EBP
-#undef ESI
-#undef EDI
-#undef EIP

  #ifdef __linux__
  #include <sys/ucontext.h>
  #endif

accel/tcg/user-exec.c +6 -0
@@ -131,6 +122,15 @@ static inline int handle_cpu_signal(uintptr_t
 pc, unsigned long address,
   }
     #if defined(__i386__)
+#undef EAX
+#undef ECX
+#undef EDX
+#undef EBX
+#undef ESP
+#undef EBP
Quoted 8 lines

accel/tcg/user-exec.c static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,

Quoted 6 lines
accel/tcg/user-exec.c +3 -0
+#undef ESI
+#undef EDI
+#undef EIP
     #if defined(__NetBSD__)
   #include <ucontext.h>
 

Why to move under i386?

Quoted 9 lines

I tracked the origin of these #defines in op-i386.c (7bfdb6d18c7b) and thought the Exx naming was for i386 while the x86_64 uses the Rxx naming (RAX .. RIP) so you'd only have them on i386 arch.
However it seems I didn't realize you can access x86_64 registers in 32-bit mode via the EAX .. EIP naming, as you see I'm not confident with this CISC arch :S

So I guess it's best to ignore this patch?

A typical 64-bit x86_64 OS can run 32-bit programs and reuse x86 32-bit headers.

Quoted 6 lines
Quoted 3 lines

SmartOS pollutes namespace with these symbols on x86_64.

you should provide some VM :P

Hope to see it too.

Quoted 6 lines

I plan to test this project soon:
https://www.packer.io/docs/builders/qemu.html

Regards,

Phil.

#10 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé

Philippe Mathieu-Daudé (4):
tcg: move user-exec
tcg: move tcg-runtime to accel/tcg/
tcg: move atomic_template.h to accel/tcg/
tcg: restrict i386 regs definitions

Thomas Huth (1):
tcg: Move softmmu_template.h to the accel/tcg/ folder

Queued 1-4.

r~