diff mbox series

[RFC,17/34] hw/core: [CPUTLB] Move target specifics to end of TCGCPUOps

Message ID 20240119144024.14289-18-anjo@rev.ng (mailing list archive)
State New, archived
Headers show
Series Compile accel/tcg once (partially) | expand

Commit Message

Anton Johansson Jan. 19, 2024, 2:40 p.m. UTC
TCGCPUOps contains an extra function pointer when included with
NEED_CPU_H, these are moved from the middle to the end of the struct. As
such offsets to target independent function pointers don't vary in
target specific and independent code.

[Move target specfic fields to separate struct?]

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 include/hw/core/tcg-cpu-ops.h | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

Comments

Richard Henderson Jan. 24, 2024, 12:43 a.m. UTC | #1
On 1/20/24 00:40, Anton Johansson wrote:
> TCGCPUOps contains an extra function pointer when included with
> NEED_CPU_H, these are moved from the middle to the end of the struct. As
> such offsets to target independent function pointers don't vary in
> target specific and independent code.
> 
> [Move target specfic fields to separate struct?]
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>

Or make these unconditional.  Move fake_user_interrupt into the CONFIG_USER_ONLY block and 
do_interrupt into the system block.


r~
Richard Henderson Jan. 28, 2024, 12:37 a.m. UTC | #2
On 1/24/24 10:43, Richard Henderson wrote:
> On 1/20/24 00:40, Anton Johansson wrote:
>> TCGCPUOps contains an extra function pointer when included with
>> NEED_CPU_H, these are moved from the middle to the end of the struct. As
>> such offsets to target independent function pointers don't vary in
>> target specific and independent code.
>>
>> [Move target specfic fields to separate struct?]
>>
>> Signed-off-by: Anton Johansson <anjo@rev.ng>
> 
> Or make these unconditional.  Move fake_user_interrupt into the CONFIG_USER_ONLY block and 
> do_interrupt into the system block.

I have split the patch in two, made fake_user_interrupt unconditional, and queued.


r~
diff mbox series

Patch

diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index 479713a36e..feb849051f 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/tcg-cpu-ops.h
@@ -49,21 +49,6 @@  struct TCGCPUOps {
     /** @debug_excp_handler: Callback for handling debug exceptions */
     void (*debug_excp_handler)(CPUState *cpu);
 
-#ifdef NEED_CPU_H
-#if defined(CONFIG_USER_ONLY) && defined(TARGET_I386)
-    /**
-     * @fake_user_interrupt: Callback for 'fake exception' handling.
-     *
-     * Simulate 'fake exception' which will be handled outside the
-     * cpu execution loop (hack for x86 user mode).
-     */
-    void (*fake_user_interrupt)(CPUState *cpu);
-#else
-    /**
-     * @do_interrupt: Callback for interrupt handling.
-     */
-    void (*do_interrupt)(CPUState *cpu);
-#endif /* !CONFIG_USER_ONLY || !TARGET_I386 */
 #ifdef CONFIG_USER_ONLY
     /**
      * record_sigsegv:
@@ -171,8 +156,25 @@  struct TCGCPUOps {
     bool (*io_recompile_replay_branch)(CPUState *cpu,
                                        const TranslationBlock *tb);
 #endif /* !CONFIG_USER_ONLY */
+
+#ifdef NEED_CPU_H
+#if defined(CONFIG_USER_ONLY) && defined(TARGET_I386)
+    /**
+     * @fake_user_interrupt: Callback for 'fake exception' handling.
+     *
+     * Simulate 'fake exception' which will be handled outside the
+     * cpu execution loop (hack for x86 user mode).
+     */
+    void (*fake_user_interrupt)(CPUState *cpu);
+#else
+    /**
+     * @do_interrupt: Callback for interrupt handling.
+     */
+    void (*do_interrupt)(CPUState *cpu);
+#endif /* !CONFIG_USER_ONLY || !TARGET_I386 */
 #endif /* NEED_CPU_H */
 
+
 };
 
 #if defined(CONFIG_USER_ONLY)