diff mbox series

[09/21] semihosting/uaccess: Avoid including 'cpu.h'

Message ID 20240417182806.69446-10-philmd@linaro.org
State Superseded
Headers show
Series exec/next for 9.1 | expand

Commit Message

Philippe Mathieu-Daudé April 17, 2024, 6:27 p.m. UTC
"semihosting/uaccess.h" only requires declarations
from "exec/cpu-defs.h". Avoid including the huge "cpu.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231211212003.21686-6-philmd@linaro.org>
---
 include/semihosting/uaccess.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Henderson April 17, 2024, 7:14 p.m. UTC | #1
On 4/17/24 11:27, Philippe Mathieu-Daudé wrote:
> "semihosting/uaccess.h" only requires declarations
> from "exec/cpu-defs.h". Avoid including the huge "cpu.h".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Message-Id: <20231211212003.21686-6-philmd@linaro.org>
> ---
>   include/semihosting/uaccess.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/semihosting/uaccess.h b/include/semihosting/uaccess.h
> index 3963eafc3e..6c8835fbcb 100644
> --- a/include/semihosting/uaccess.h
> +++ b/include/semihosting/uaccess.h
> @@ -14,7 +14,7 @@
>   #error Cannot include semihosting/uaccess.h from user emulation
>   #endif
>   
> -#include "cpu.h"
> +#include "exec/cpu-defs.h"
>   
>   #define get_user_u64(val, addr)                                         \
>       ({ uint64_t val_ = 0;                                               \


Does this actually need anything besides exec/tswap.h?


r~
Philippe Mathieu-Daudé April 18, 2024, 10:59 a.m. UTC | #2
On 17/4/24 21:14, Richard Henderson wrote:
> On 4/17/24 11:27, Philippe Mathieu-Daudé wrote:
>> "semihosting/uaccess.h" only requires declarations
>> from "exec/cpu-defs.h". Avoid including the huge "cpu.h".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Message-Id: <20231211212003.21686-6-philmd@linaro.org>
>> ---
>>   include/semihosting/uaccess.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/semihosting/uaccess.h 
>> b/include/semihosting/uaccess.h
>> index 3963eafc3e..6c8835fbcb 100644
>> --- a/include/semihosting/uaccess.h
>> +++ b/include/semihosting/uaccess.h
>> @@ -14,7 +14,7 @@
>>   #error Cannot include semihosting/uaccess.h from user emulation
>>   #endif
>> -#include "cpu.h"
>> +#include "exec/cpu-defs.h"
>>   #define get_user_u64(val, 
>> addr)                                         \
>>       ({ uint64_t val_ = 
>> 0;                                               \
> 
> 
> Does this actually need anything besides exec/tswap.h?

Actually what is needed is:

#include "exec/cpu-common.h" // cpu_memory_rw_debug
#include "exec/cpu-defs.h"   // target_ulong
#include "exec/tswap.h"      // tswap32

Fixed locally as:

-- >8 --
Author: Philippe Mathieu-Daudé <philmd@linaro.org>
Date:   Wed Dec 6 16:11:15 2023 +0100

     semihosting/uaccess: Avoid including 'cpu.h'

     "semihosting/uaccess.h" only requires the following headers:

       - "exec/cpu-defs.h" for target_ulong,
       - "exec/cpu-common.h" for cpu_memory_rw_debug()
       - "exec/tswap.h" for tswap32() and tswap64().

     Include them instead of the huge "cpu.h".

     Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
     Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

diff --git a/include/semihosting/uaccess.h b/include/semihosting/uaccess.h
index 3963eafc3e..dd289af8dd 100644
--- a/include/semihosting/uaccess.h
+++ b/include/semihosting/uaccess.h
@@ -17 +17,3 @@
-#include "cpu.h"
+#include "exec/cpu-common.h"
+#include "exec/cpu-defs.h"
+#include "exec/tswap.h"
---
diff mbox series

Patch

diff --git a/include/semihosting/uaccess.h b/include/semihosting/uaccess.h
index 3963eafc3e..6c8835fbcb 100644
--- a/include/semihosting/uaccess.h
+++ b/include/semihosting/uaccess.h
@@ -14,7 +14,7 @@ 
 #error Cannot include semihosting/uaccess.h from user emulation
 #endif
 
-#include "cpu.h"
+#include "exec/cpu-defs.h"
 
 #define get_user_u64(val, addr)                                         \
     ({ uint64_t val_ = 0;                                               \