diff mbox series

[05/10] accel/tcg: Move cpu_unwind_state_data() declaration

Message ID 20241115152053.66442-6-philmd@linaro.org (mailing list archive)
State New
Headers show
Series accel/tcg: API prototype cleanups | expand

Commit Message

Philippe Mathieu-Daudé Nov. 15, 2024, 3:20 p.m. UTC
cpu_unwind_state_data() is specific to TCG accelerator,
move it to "exec/translate-all.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/exec/cpu-common.h    | 13 -------------
 include/exec/translate-all.h | 12 ++++++++++++
 2 files changed, 12 insertions(+), 13 deletions(-)

Comments

Peter Maydell Nov. 15, 2024, 3:48 p.m. UTC | #1
On Fri, 15 Nov 2024 at 15:21, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> cpu_unwind_state_data() is specific to TCG accelerator,
> move it to "exec/translate-all.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  include/exec/cpu-common.h    | 13 -------------
>  include/exec/translate-all.h | 12 ++++++++++++
>  2 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index 638dc806a5..b36fbf2a39 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -193,19 +193,6 @@ void tcg_cflags_set(CPUState *cpu, uint32_t flags);
>  /* current cflags for hashing/comparison */
>  uint32_t curr_cflags(CPUState *cpu);
>
> -/**
> - * cpu_unwind_state_data:
> - * @cpu: the cpu context
> - * @host_pc: the host pc within the translation
> - * @data: output data
> - *
> - * Attempt to load the the unwind state for a host pc occurring in
> - * translated code.  If @host_pc is not in translated code, the
> - * function returns false; otherwise @data is loaded.
> - * This is the same unwind info as given to restore_state_to_opc.
> - */
> -bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);
> -
>  /**
>   * cpu_restore_state:
>   * @cpu: the cpu context
> diff --git a/include/exec/translate-all.h b/include/exec/translate-all.h
> index 85c9460c7c..f06cfedd52 100644
> --- a/include/exec/translate-all.h
> +++ b/include/exec/translate-all.h
> @@ -21,6 +21,18 @@
>
>  #include "exec/exec-all.h"
>
> +/**
> + * cpu_unwind_state_data:
> + * @cpu: the cpu context
> + * @host_pc: the host pc within the translation
> + * @data: output data
> + *
> + * Attempt to load the the unwind state for a host pc occurring in
> + * translated code.  If @host_pc is not in translated code, the
> + * function returns false; otherwise @data is loaded.
> + * This is the same unwind info as given to restore_state_to_opc.
> + */
> +bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);
>
>  /* translate-all.c */
>  void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);

This function is used by some code in target/i386 and
target/openrisc, but a quick grep suggests that they don't
include translate-all.h or any other header that would pull
it in indirectly.

It also seems a bit odd to move the cpu_unwind_state_data()
prototype but not the similar cpu_restore_state() (which is
also TCG-only).

thanks
-- PMM
Philippe Mathieu-Daudé Nov. 15, 2024, 4:04 p.m. UTC | #2
On 15/11/24 15:48, Peter Maydell wrote:
> On Fri, 15 Nov 2024 at 15:21, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>>
>> cpu_unwind_state_data() is specific to TCG accelerator,
>> move it to "exec/translate-all.h".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   include/exec/cpu-common.h    | 13 -------------
>>   include/exec/translate-all.h | 12 ++++++++++++
>>   2 files changed, 12 insertions(+), 13 deletions(-)
>>
>> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
>> index 638dc806a5..b36fbf2a39 100644
>> --- a/include/exec/cpu-common.h
>> +++ b/include/exec/cpu-common.h
>> @@ -193,19 +193,6 @@ void tcg_cflags_set(CPUState *cpu, uint32_t flags);
>>   /* current cflags for hashing/comparison */
>>   uint32_t curr_cflags(CPUState *cpu);
>>
>> -/**
>> - * cpu_unwind_state_data:
>> - * @cpu: the cpu context
>> - * @host_pc: the host pc within the translation
>> - * @data: output data
>> - *
>> - * Attempt to load the the unwind state for a host pc occurring in
>> - * translated code.  If @host_pc is not in translated code, the
>> - * function returns false; otherwise @data is loaded.
>> - * This is the same unwind info as given to restore_state_to_opc.
>> - */
>> -bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);
>> -
>>   /**
>>    * cpu_restore_state:
>>    * @cpu: the cpu context
>> diff --git a/include/exec/translate-all.h b/include/exec/translate-all.h
>> index 85c9460c7c..f06cfedd52 100644
>> --- a/include/exec/translate-all.h
>> +++ b/include/exec/translate-all.h
>> @@ -21,6 +21,18 @@
>>
>>   #include "exec/exec-all.h"
>>
>> +/**
>> + * cpu_unwind_state_data:
>> + * @cpu: the cpu context
>> + * @host_pc: the host pc within the translation
>> + * @data: output data
>> + *
>> + * Attempt to load the the unwind state for a host pc occurring in
>> + * translated code.  If @host_pc is not in translated code, the
>> + * function returns false; otherwise @data is loaded.
>> + * This is the same unwind info as given to restore_state_to_opc.
>> + */
>> +bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);
>>
>>   /* translate-all.c */
>>   void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);
> 
> This function is used by some code in target/i386 and
> target/openrisc, but a quick grep suggests that they don't
> include translate-all.h or any other header that would pull
> it in indirectly.

Oops, this slipped to the next patch.

> It also seems a bit odd to move the cpu_unwind_state_data()
> prototype but not the similar cpu_restore_state() (which is
> also TCG-only).

OK I'll move them together (clearing "exec/cpu-common.h" is
not easy...)
diff mbox series

Patch

diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 638dc806a5..b36fbf2a39 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -193,19 +193,6 @@  void tcg_cflags_set(CPUState *cpu, uint32_t flags);
 /* current cflags for hashing/comparison */
 uint32_t curr_cflags(CPUState *cpu);
 
-/**
- * cpu_unwind_state_data:
- * @cpu: the cpu context
- * @host_pc: the host pc within the translation
- * @data: output data
- *
- * Attempt to load the the unwind state for a host pc occurring in
- * translated code.  If @host_pc is not in translated code, the
- * function returns false; otherwise @data is loaded.
- * This is the same unwind info as given to restore_state_to_opc.
- */
-bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);
-
 /**
  * cpu_restore_state:
  * @cpu: the cpu context
diff --git a/include/exec/translate-all.h b/include/exec/translate-all.h
index 85c9460c7c..f06cfedd52 100644
--- a/include/exec/translate-all.h
+++ b/include/exec/translate-all.h
@@ -21,6 +21,18 @@ 
 
 #include "exec/exec-all.h"
 
+/**
+ * cpu_unwind_state_data:
+ * @cpu: the cpu context
+ * @host_pc: the host pc within the translation
+ * @data: output data
+ *
+ * Attempt to load the the unwind state for a host pc occurring in
+ * translated code.  If @host_pc is not in translated code, the
+ * function returns false; otherwise @data is loaded.
+ * This is the same unwind info as given to restore_state_to_opc.
+ */
+bool cpu_unwind_state_data(CPUState *cpu, uintptr_t host_pc, uint64_t *data);
 
 /* translate-all.c */
 void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);