From 4f1d6163402688a0b7a2b8a0e5e00c269dcbeb3f Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 17 Aug 2026 05:17:45 +0200 Subject: [PATCH] bsps/x86_64/amd64: Implement tm27 support The BSP used the default of , where Cause_tm27_intr() does nothing. Every test which calls CallWithinISR() waited forever for an interrupt which was never raised, which stopped five test suites. Use the software interrupt of the BSP. Lower_tm27_intr() only has to enable the interrupts, because the dispatch acknowledges the interrupt before the handler runs. Update #5692. Assisted-by: Claude:claude-opus-5 claude-code Signed-off-by: Sebastian Huber --- bsps/x86_64/amd64/include/tm27.h | 52 +++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/bsps/x86_64/amd64/include/tm27.h b/bsps/x86_64/amd64/include/tm27.h index 7fef429245..ca7d5f0c40 100644 --- a/bsps/x86_64/amd64/include/tm27.h +++ b/bsps/x86_64/amd64/include/tm27.h @@ -35,4 +35,54 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include +#ifndef _RTEMS_TMTEST27 +#error "This is an RTEMS internal file you must not include directly." +#endif + +#ifndef __tm27_h +#define __tm27_h + +#include +#include +#include + +#define MUST_WAIT_FOR_INTERRUPT 1 + +#define TM27_INTERRUPT_VECTOR_DEFAULT BSP_VECTOR_SOFTWARE + +static rtems_interrupt_entry amd64_tm27_interrupt_entry; + +static inline void Install_tm27_vector( rtems_interrupt_handler handler ) +{ + rtems_interrupt_entry_initialize( + &amd64_tm27_interrupt_entry, + handler, + NULL, + "tm27" + ); + (void) rtems_interrupt_entry_install( + BSP_VECTOR_SOFTWARE, + RTEMS_INTERRUPT_SHARED, + &amd64_tm27_interrupt_entry + ); +} + +static inline void Cause_tm27_intr( void ) +{ + (void) rtems_interrupt_raise( BSP_VECTOR_SOFTWARE ); +} + +/* + * The Local APIC clears the interrupt request bit when the processor + * acknowledges the interrupt, so there is nothing left to clear. + */ +static inline void Clear_tm27_intr( void ) +{ +} + +static inline void Lower_tm27_intr( void ) +{ + _ISR_Set_level( 0 ); +} + +#endif /* __tm27_h */