Re: [PATCH v2 5/5] disas: Move disas.c into the target-independent source set

2023-05-10 Thread Philippe Mathieu-Daudé

On 10/5/23 10:13, Richard Henderson wrote:

On 5/10/23 09:10, Thomas Huth wrote:

On 10/05/2023 09.46, Richard Henderson wrote:

On 5/10/23 07:53, Thomas Huth wrote:

On 09/05/2023 18.33, Richard Henderson wrote:

From: Thomas Huth 

By using target_words_bigendian() instead of an ifdef,
we can build this code once.

Signed-off-by: Thomas Huth 
[rth: Type change done in a separate patch]
Signed-off-by: Richard Henderson 
---

...

diff --git a/disas/meson.build b/disas/meson.build
index f40230c58f..2ae44691fa 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -13,4 +13,5 @@ common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: 
files('xtensa.c'))
  common_ss.add(when: capstone, if_true: [files('capstone.c'), 
capstone])

  softmmu_ss.add(files('disas-mon.c'))
-specific_ss.add(files('disas.c'), capstone)
+common_ss.add(files('disas.c'), capstone)


I guess you could drop the "capstone" here now since it is already 
added to common_ss now three lines earlier.


I have a memory that it's required to get the include path for 
 for "disas/capstone.h", for use by the target's 
cpu_set_disas_info. Otherwise only common_ss files have access to the 
include path.


I only meant to remove it from the new 
"common_ss.add(files('disas.c')" line since it is already there in the 
"common_ss.add(when: capstone, if_true: [files('capstone.c'), 
capstone])" line ... I think you have to keep the 
"specific_ss.add(capstone)" line.


Oh, yes, duplicate within common_ss.  Removed.


What the final patch looks like?




Re: [PATCH v2 5/5] disas: Move disas.c into the target-independent source set

2023-05-10 Thread Richard Henderson

On 5/10/23 09:10, Thomas Huth wrote:

On 10/05/2023 09.46, Richard Henderson wrote:

On 5/10/23 07:53, Thomas Huth wrote:

On 09/05/2023 18.33, Richard Henderson wrote:

From: Thomas Huth 

By using target_words_bigendian() instead of an ifdef,
we can build this code once.

Signed-off-by: Thomas Huth 
[rth: Type change done in a separate patch]
Signed-off-by: Richard Henderson 
---

...

diff --git a/disas/meson.build b/disas/meson.build
index f40230c58f..2ae44691fa 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -13,4 +13,5 @@ common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: 
files('xtensa.c'))
  common_ss.add(when: capstone, if_true: [files('capstone.c'), capstone])
  softmmu_ss.add(files('disas-mon.c'))
-specific_ss.add(files('disas.c'), capstone)
+common_ss.add(files('disas.c'), capstone)


I guess you could drop the "capstone" here now since it is already added to common_ss 
now three lines earlier.


I have a memory that it's required to get the include path for  for 
"disas/capstone.h", for use by the target's cpu_set_disas_info. Otherwise only common_ss 
files have access to the include path.


I only meant to remove it from the new "common_ss.add(files('disas.c')" line since it is 
already there in the "common_ss.add(when: capstone, if_true: [files('capstone.c'), 
capstone])" line ... I think you have to keep the "specific_ss.add(capstone)" line.


Oh, yes, duplicate within common_ss.  Removed.


r~




Re: [PATCH v2 5/5] disas: Move disas.c into the target-independent source set

2023-05-10 Thread Thomas Huth

On 10/05/2023 09.46, Richard Henderson wrote:

On 5/10/23 07:53, Thomas Huth wrote:

On 09/05/2023 18.33, Richard Henderson wrote:

From: Thomas Huth 

By using target_words_bigendian() instead of an ifdef,
we can build this code once.

Signed-off-by: Thomas Huth 
[rth: Type change done in a separate patch]
Signed-off-by: Richard Henderson 
---

...

diff --git a/disas/meson.build b/disas/meson.build
index f40230c58f..2ae44691fa 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -13,4 +13,5 @@ common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: 
files('xtensa.c'))

  common_ss.add(when: capstone, if_true: [files('capstone.c'), capstone])
  softmmu_ss.add(files('disas-mon.c'))
-specific_ss.add(files('disas.c'), capstone)
+common_ss.add(files('disas.c'), capstone)


I guess you could drop the "capstone" here now since it is already added 
to common_ss now three lines earlier.


I have a memory that it's required to get the include path for  
for "disas/capstone.h", for use by the target's cpu_set_disas_info.  
Otherwise only common_ss files have access to the include path.


I only meant to remove it from the new "common_ss.add(files('disas.c')" line 
since it is already there in the "common_ss.add(when: capstone, if_true: 
[files('capstone.c'), capstone])" line ... I think you have to keep the 
"specific_ss.add(capstone)" line.


 Thomas





Re: [PATCH v2 5/5] disas: Move disas.c into the target-independent source set

2023-05-10 Thread Richard Henderson

On 5/10/23 07:53, Thomas Huth wrote:

On 09/05/2023 18.33, Richard Henderson wrote:

From: Thomas Huth 

By using target_words_bigendian() instead of an ifdef,
we can build this code once.

Signed-off-by: Thomas Huth 
[rth: Type change done in a separate patch]
Signed-off-by: Richard Henderson 
---

...

diff --git a/disas/meson.build b/disas/meson.build
index f40230c58f..2ae44691fa 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -13,4 +13,5 @@ common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: 
files('xtensa.c'))
  common_ss.add(when: capstone, if_true: [files('capstone.c'), capstone])
  softmmu_ss.add(files('disas-mon.c'))
-specific_ss.add(files('disas.c'), capstone)
+common_ss.add(files('disas.c'), capstone)


I guess you could drop the "capstone" here now since it is already added to common_ss now 
three lines earlier.


I have a memory that it's required to get the include path for  for 
"disas/capstone.h", for use by the target's cpu_set_disas_info.  Otherwise only common_ss 
files have access to the include path.


But I'll double-check.


r~




Re: [PATCH v2 5/5] disas: Move disas.c into the target-independent source set

2023-05-10 Thread Thomas Huth

On 09/05/2023 18.33, Richard Henderson wrote:

From: Thomas Huth 

By using target_words_bigendian() instead of an ifdef,
we can build this code once.

Signed-off-by: Thomas Huth 
[rth: Type change done in a separate patch]
Signed-off-by: Richard Henderson 
---

...

diff --git a/disas/meson.build b/disas/meson.build
index f40230c58f..2ae44691fa 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -13,4 +13,5 @@ common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: 
files('xtensa.c'))
  common_ss.add(when: capstone, if_true: [files('capstone.c'), capstone])
  
  softmmu_ss.add(files('disas-mon.c'))

-specific_ss.add(files('disas.c'), capstone)
+common_ss.add(files('disas.c'), capstone)


I guess you could drop the "capstone" here now since it is already added to 
common_ss now three lines earlier.


 Thomas




[PATCH v2 5/5] disas: Move disas.c into the target-independent source set

2023-05-09 Thread Richard Henderson
From: Thomas Huth 

By using target_words_bigendian() instead of an ifdef,
we can build this code once.

Signed-off-by: Thomas Huth 
[rth: Type change done in a separate patch]
Signed-off-by: Richard Henderson 
---
 disas/disas.c | 10 +-
 disas/meson.build |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/disas/disas.c b/disas/disas.c
index 5e7401bb6f..954b385a82 100644
--- a/disas/disas.c
+++ b/disas/disas.c
@@ -122,11 +122,11 @@ void disas_initialize_debug_target(CPUDebug *s, CPUState 
*cpu)
 s->cpu = cpu;
 s->info.read_memory_func = target_read_memory;
 s->info.print_address_func = print_address;
-#if TARGET_BIG_ENDIAN
-s->info.endian = BFD_ENDIAN_BIG;
-#else
-s->info.endian = BFD_ENDIAN_LITTLE;
-#endif
+if (target_words_bigendian()) {
+s->info.endian = BFD_ENDIAN_BIG;
+} else {
+s->info.endian =  BFD_ENDIAN_LITTLE;
+}
 
 CPUClass *cc = CPU_GET_CLASS(cpu);
 if (cc->disas_set_info) {
diff --git a/disas/meson.build b/disas/meson.build
index f40230c58f..2ae44691fa 100644
--- a/disas/meson.build
+++ b/disas/meson.build
@@ -13,4 +13,5 @@ common_ss.add(when: 'CONFIG_XTENSA_DIS', if_true: 
files('xtensa.c'))
 common_ss.add(when: capstone, if_true: [files('capstone.c'), capstone])
 
 softmmu_ss.add(files('disas-mon.c'))
-specific_ss.add(files('disas.c'), capstone)
+common_ss.add(files('disas.c'), capstone)
+specific_ss.add(capstone)
-- 
2.34.1