qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] semihosting/uaccess: Compile once
@ 2025-05-26  9:52 Philippe Mathieu-Daudé
  2025-05-26  9:52 ` [PATCH v3 1/2] semihosting/uaccess: Remove uses of target_ulong type Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-26  9:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Pierrick Bouvier, Philippe Mathieu-Daudé

Replace target_ulong -> vaddr/size_t to compile once.

since v2:
- fixed build error when TCG enabled (Pierrick)
since v1:
- fixed build error when TCG disabled (Pierrick)

Based-on: <20250521223414.248276-1-pierrick.bouvier@linaro.org>

Philippe Mathieu-Daudé (2):
  semihosting/uaccess: Remove uses of target_ulong type
  semihosting/uaccess: Compile once

 include/semihosting/uaccess.h | 12 ++++++------
 semihosting/uaccess.c         | 10 +++++-----
 semihosting/meson.build       |  5 +----
 3 files changed, 12 insertions(+), 15 deletions(-)

-- 
2.47.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/2] semihosting/uaccess: Remove uses of target_ulong type
  2025-05-26  9:52 [PATCH v3 0/2] semihosting/uaccess: Compile once Philippe Mathieu-Daudé
@ 2025-05-26  9:52 ` Philippe Mathieu-Daudé
  2025-05-26 17:25   ` Richard Henderson
  2025-05-26  9:52 ` [PATCH v3 2/2] semihosting/uaccess: Compile once Philippe Mathieu-Daudé
  2025-06-03 11:17 ` [PATCH v3 0/2] " Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-26  9:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Pierrick Bouvier, Philippe Mathieu-Daudé

Replace target_ulong by vaddr or size_t types to match
cpu_memory_rw_debug() prototype in "exec/cpu-common.h":

 >  int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
 >                          void *ptr, size_t len,
 >                          bool is_write);

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 include/semihosting/uaccess.h | 12 ++++++------
 semihosting/uaccess.c         | 10 +++++-----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/semihosting/uaccess.h b/include/semihosting/uaccess.h
index 6bc90b12d6f..2093a498277 100644
--- a/include/semihosting/uaccess.h
+++ b/include/semihosting/uaccess.h
@@ -15,9 +15,9 @@
 #endif
 
 #include "exec/cpu-common.h"
-#include "exec/cpu-defs.h"
 #include "exec/tswap.h"
 #include "exec/page-protection.h"
+#include "exec/vaddr.h"
 
 /**
  * get_user_u64:
@@ -89,8 +89,8 @@
  *
  * The returned pointer should be freed using uaccess_unlock_user().
  */
-void *uaccess_lock_user(CPUArchState *env, target_ulong addr,
-                        target_ulong len, bool copy);
+void *uaccess_lock_user(CPUArchState *env, vaddr addr,
+                        size_t len, bool copy);
 /**
  * lock_user:
  *
@@ -103,7 +103,7 @@ void *uaccess_lock_user(CPUArchState *env, target_ulong addr,
  *
  * The returned string should be freed using uaccess_unlock_user().
  */
-char *uaccess_lock_user_string(CPUArchState *env, target_ulong addr);
+char *uaccess_lock_user_string(CPUArchState *env, vaddr addr);
 /**
  * uaccess_lock_user_string:
  *
@@ -112,10 +112,10 @@ char *uaccess_lock_user_string(CPUArchState *env, target_ulong addr);
 #define lock_user_string(p) uaccess_lock_user_string(env, p)
 
 void uaccess_unlock_user(CPUArchState *env, void *p,
-                         target_ulong addr, target_ulong len);
+                         vaddr addr, size_t len);
 #define unlock_user(s, args, len) uaccess_unlock_user(env, s, args, len)
 
-ssize_t uaccess_strlen_user(CPUArchState *env, target_ulong addr);
+ssize_t uaccess_strlen_user(CPUArchState *env, vaddr addr);
 #define target_strlen(p) uaccess_strlen_user(env, p)
 
 #endif /* SEMIHOSTING_SOFTMMU_UACCESS_H */
diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c
index 4554844e15b..ff944d8c2f7 100644
--- a/semihosting/uaccess.c
+++ b/semihosting/uaccess.c
@@ -14,8 +14,8 @@
 #include "exec/tlb-flags.h"
 #include "semihosting/uaccess.h"
 
-void *uaccess_lock_user(CPUArchState *env, target_ulong addr,
-                        target_ulong len, bool copy)
+void *uaccess_lock_user(CPUArchState *env, vaddr addr,
+                        size_t len, bool copy)
 {
     void *p = malloc(len);
     if (p && copy) {
@@ -27,7 +27,7 @@ void *uaccess_lock_user(CPUArchState *env, target_ulong addr,
     return p;
 }
 
-ssize_t uaccess_strlen_user(CPUArchState *env, target_ulong addr)
+ssize_t uaccess_strlen_user(CPUArchState *env, vaddr addr)
 {
     int mmu_idx = cpu_mmu_index(env_cpu(env), false);
     size_t len = 0;
@@ -75,7 +75,7 @@ ssize_t uaccess_strlen_user(CPUArchState *env, target_ulong addr)
     }
 }
 
-char *uaccess_lock_user_string(CPUArchState *env, target_ulong addr)
+char *uaccess_lock_user_string(CPUArchState *env, vaddr addr)
 {
     ssize_t len = uaccess_strlen_user(env, addr);
     if (len < 0) {
@@ -85,7 +85,7 @@ char *uaccess_lock_user_string(CPUArchState *env, target_ulong addr)
 }
 
 void uaccess_unlock_user(CPUArchState *env, void *p,
-                         target_ulong addr, target_ulong len)
+                         vaddr addr, size_t len)
 {
     if (len) {
         cpu_memory_rw_debug(env_cpu(env), addr, p, len, 1);
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/2] semihosting/uaccess: Compile once
  2025-05-26  9:52 [PATCH v3 0/2] semihosting/uaccess: Compile once Philippe Mathieu-Daudé
  2025-05-26  9:52 ` [PATCH v3 1/2] semihosting/uaccess: Remove uses of target_ulong type Philippe Mathieu-Daudé
@ 2025-05-26  9:52 ` Philippe Mathieu-Daudé
  2025-05-26 17:26   ` Richard Henderson
  2025-06-03 11:17 ` [PATCH v3 0/2] " Philippe Mathieu-Daudé
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-26  9:52 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Pierrick Bouvier, Philippe Mathieu-Daudé

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 semihosting/meson.build | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/semihosting/meson.build b/semihosting/meson.build
index f3d38dda91d..b1ab2506c6e 100644
--- a/semihosting/meson.build
+++ b/semihosting/meson.build
@@ -3,15 +3,12 @@ specific_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
   'syscalls.c',
 ))
 
-specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_true: files(
-  'uaccess.c',
-))
-
 common_ss.add(when: 'CONFIG_SEMIHOSTING', if_false: files('stubs-all.c'))
 user_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files('user.c'))
 system_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
   'config.c',
   'console.c',
+  'uaccess.c',
 ), if_false: files(
   'stubs-system.c',
 ))
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] semihosting/uaccess: Remove uses of target_ulong type
  2025-05-26  9:52 ` [PATCH v3 1/2] semihosting/uaccess: Remove uses of target_ulong type Philippe Mathieu-Daudé
@ 2025-05-26 17:25   ` Richard Henderson
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2025-05-26 17:25 UTC (permalink / raw)
  To: qemu-devel

On 5/26/25 10:52, Philippe Mathieu-Daudé wrote:
> Replace target_ulong by vaddr or size_t types to match
> cpu_memory_rw_debug() prototype in "exec/cpu-common.h":
> 
>   >  int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
>   >                          void *ptr, size_t len,
>   >                          bool is_write);
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> Reviewed-by: Pierrick Bouvier<pierrick.bouvier@linaro.org>
> ---
>   include/semihosting/uaccess.h | 12 ++++++------
>   semihosting/uaccess.c         | 10 +++++-----
>   2 files changed, 11 insertions(+), 11 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] semihosting/uaccess: Compile once
  2025-05-26  9:52 ` [PATCH v3 2/2] semihosting/uaccess: Compile once Philippe Mathieu-Daudé
@ 2025-05-26 17:26   ` Richard Henderson
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2025-05-26 17:26 UTC (permalink / raw)
  To: qemu-devel

On 5/26/25 10:52, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   semihosting/meson.build | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/semihosting/meson.build b/semihosting/meson.build
> index f3d38dda91d..b1ab2506c6e 100644
> --- a/semihosting/meson.build
> +++ b/semihosting/meson.build
> @@ -3,15 +3,12 @@ specific_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
>     'syscalls.c',
>   ))
>   
> -specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_true: files(
> -  'uaccess.c',
> -))
> -
>   common_ss.add(when: 'CONFIG_SEMIHOSTING', if_false: files('stubs-all.c'))
>   user_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files('user.c'))
>   system_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files(
>     'config.c',
>     'console.c',
> +  'uaccess.c',
>   ), if_false: files(
>     'stubs-system.c',
>   ))

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/2] semihosting/uaccess: Compile once
  2025-05-26  9:52 [PATCH v3 0/2] semihosting/uaccess: Compile once Philippe Mathieu-Daudé
  2025-05-26  9:52 ` [PATCH v3 1/2] semihosting/uaccess: Remove uses of target_ulong type Philippe Mathieu-Daudé
  2025-05-26  9:52 ` [PATCH v3 2/2] semihosting/uaccess: Compile once Philippe Mathieu-Daudé
@ 2025-06-03 11:17 ` Philippe Mathieu-Daudé
  2025-06-06 10:00   ` Alex Bennée
  2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-06-03 11:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, Pierrick Bouvier

ping?

On 26/5/25 11:52, Philippe Mathieu-Daudé wrote:
> Replace target_ulong -> vaddr/size_t to compile once.
> 
> since v2:
> - fixed build error when TCG enabled (Pierrick)
> since v1:
> - fixed build error when TCG disabled (Pierrick)
> 
> Based-on: <20250521223414.248276-1-pierrick.bouvier@linaro.org>
> 
> Philippe Mathieu-Daudé (2):
>    semihosting/uaccess: Remove uses of target_ulong type
>    semihosting/uaccess: Compile once
> 
>   include/semihosting/uaccess.h | 12 ++++++------
>   semihosting/uaccess.c         | 10 +++++-----
>   semihosting/meson.build       |  5 +----
>   3 files changed, 12 insertions(+), 15 deletions(-)
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 0/2] semihosting/uaccess: Compile once
  2025-06-03 11:17 ` [PATCH v3 0/2] " Philippe Mathieu-Daudé
@ 2025-06-06 10:00   ` Alex Bennée
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Bennée @ 2025-06-06 10:00 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Pierrick Bouvier

Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> ping?

Queued to semihosting/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-06-06 10:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26  9:52 [PATCH v3 0/2] semihosting/uaccess: Compile once Philippe Mathieu-Daudé
2025-05-26  9:52 ` [PATCH v3 1/2] semihosting/uaccess: Remove uses of target_ulong type Philippe Mathieu-Daudé
2025-05-26 17:25   ` Richard Henderson
2025-05-26  9:52 ` [PATCH v3 2/2] semihosting/uaccess: Compile once Philippe Mathieu-Daudé
2025-05-26 17:26   ` Richard Henderson
2025-06-03 11:17 ` [PATCH v3 0/2] " Philippe Mathieu-Daudé
2025-06-06 10:00   ` Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).