acassis commented on PR #8926:
URL: https://github.com/apache/nuttx/pull/8926#issuecomment-1490450015

   > > It probably requires fixing for other architectures.
   > 
   > @tmedicci I applied the same changes to 
arch/arm/src/armv7-a/arm_sigdeliver.c locally and tested with sabre-6quad:smp 
on both qemu-7.1 and the sabre board, but the ostest crashed on both 
environments.
   > 
   > ```
   > diff --git a/arch/arm/src/armv7-a/arm_sigdeliver.c 
b/arch/arm/src/armv7-a/arm_sigdeliver.c
   > index 856f216c0c..9b32e9b855 100644
   > --- a/arch/arm/src/armv7-a/arm_sigdeliver.c
   > +++ b/arch/arm/src/armv7-a/arm_sigdeliver.c
   > @@ -54,7 +54,6 @@
   >  void arm_sigdeliver(void)
   >  {
   >    struct tcb_s *rtcb = this_task();
   > -  uint32_t *regs = rtcb->xcp.saved_regs;
   > 
   >  #ifdef CONFIG_SMP
   >    /* In the SMP case, we must terminate the critical section while the 
signal
   > @@ -86,7 +85,7 @@ void arm_sigdeliver(void)
   > 
   >    do
   >      {
   > -      leave_critical_section(regs[REG_CPSR]);
   > +      leave_critical_section(rtcb->xcp.regs[REG_CPSR]);
   >      }
   >    while (rtcb->irqcount > 0);
   >  #endif /* CONFIG_SMP */
   > @@ -144,5 +143,5 @@ void arm_sigdeliver(void)
   >    /* Then restore the correct state for this thread of execution. */
   > 
   >    board_autoled_off(LED_SIGNAL);
   > -  arm_fullcontextrestore(regs);
   > +  arm_fullcontextrestore(rtcb->xcp.saved_regs);
   >  }
   > 
   > 
   > user_main: signal handler test 
   > sighand_test: Initializing semaphore to 0 
   > sighand_test: Starting waiter task 
   > sighand_test: Started waiter_main pid=175 
   > waiter_main: Waiter started 
   > waiter_main: Unmasking signal 17 
   > waiter_main: Registering signal handler 
   > waiter_main: oact.sigaction=0 oact.sa_flags=0 
oact.sa_mask=0000000000000000 
   > waiter_main: Waiting on semaphore 
   > sighand_test: Signaling pid=175 with signo=17 sigvalue=42 
   > [CPU1] arm_prefetchabort: Prefetch abort. PC: 00100000 IFAR: 00100000 
IFSR: 0000000d 
   > [CPU1] _assert: Current Version: NuttX 10.3.0 b2c8be28b1-dirty Mar 30 2023 
11:38:58 arm 
   > [CPU1] _assert: Assertion failed panic: at file: 
armv7-a/arm_prefetchabort.c:134 task(CPU1): waiter 0x10812c19 
   > [CPU1] up_dump_register: R0: 00000001 R1: 00000000 R2: 10825bb0 R3: 
00000001 
   > [CPU1] up_dump_register: R4: 00000000 R5: 00000000 R6: 00000000 FP: 
00000001 
   > [CPU1] up_dump_register: R8: 00000000 SB: 00000000 SL: 00000000 R11: 
00000000 
   > [CPU1] up_dump_register: IP: 00000000 SP: 10830eb8 LR: 10801aa9 PC: 
00100000 
   > [CPU1] up_dump_register: CPSR: 200000d1 
   > [CPU1] dump_stack: IRQ Stack: 
   > [CPU1] dump_stack: sp: 0x10830ca0 
   > [CPU1] dump_stack: base: 0x108227a8 
   > [CPU1] dump_stack: size: 00002048 
   > [CPU1] dump_stack: ERROR: IRQ Stack pointer is not within the stack 
   > [CPU1] stack_dump: 0x10822f20: deadbeef deadbeef deadbeef deadbeef 
00000001 10801ea1 108249e0 00000001 
   > [CPU1] stack_dump: 0x10822f40: 000001df 108249e3 108249e1 00000002 
108249e2 10801a0b 00000001 108241a8 
   > [CPU1] stack_dump: 0x10822f60: 00000001 10801a69 00000001 108241a8 
00000002 10800d57 10800d3d 10825bb0 
   > [CPU1] stack_dump: 0x10822f80: 10825bb0 10801b5f 10825bb0 1080123f 
00000002 00000000 00000000 10800a71 
   > [CPU1] dump_stack: User Stack: 
   > [CPU1] dump_stack: sp: 0x10830eb8 
   > [CPU1] dump_stack: base: 0x1082f0d0 
   > [CPU1] dump_stack: size: 00008152 
   > [CPU1] stack_dump: 0x10830ea0: 00000000 00000000 00000000 00000000 
00100000 200000d1 1082a1d0 00000001 
   > [CPU1] stack_dump: 0x10830ec0: 108241b0 108072a1 00000000 108242a8 
1082a1d0 10806fd1 00000000 00000000 
   > [CPU1] stack_dump: 0x10830ee0: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 
   > [CPU1] stack_dump: 0x10830f00: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 
   > [CPU1] stack_dump: 0x10830f20: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 
   > [CPU1] stack_dump: 0x10830f40: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 
   > [CPU1] stack_dump: 0x10830f60: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 
   > [CPU1] stack_dump: 0x10830f80: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 
   > [CPU1] stack_dump: 0x10830fa0: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 
   > [CPU1] stack_dump: 0x10830fc0: 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 10831020 
   > [CPU1] stack_dump: 0x10830fe0: 10806fd1 00000002 1082a254 10825bb0 
00000000 108242a8 1082a1d0 108241b0 
   > [CPU1] stack_dump: 0x10831000: 00000001 00000000 00000000 00000000 
00000000 00000000 10806fdc 200000ff 
   > [CPU1] stack_dump: 0x10831020: 108256f8 1082a1d0 0000005f 1080291b 
00000000 00000000 00000000 1082f0c0 
   > [CPU1] stack_dump: 0x10831040: 00000000 1080294d 00000000 10812cad 
00000000 00000000 00020000 00000000 
   > [CPU1] stack_dump: 0x10831060: 10812d35 fffdffff ffffffff 00000002 
00000000 00000000 00000000 00000000 
   > [CPU1] stack_dump: 0x10831080: 00000000 00000000 10812c19 10812c19 
00000001 108055ab 00000000 10802dd9 
   > [CPU1] show_tasks: PID GROUP CPU PRI POLICY TYPE NPX STATE EVENT SIGMASK 
STACKBASE STACKSIZE USED FILLED COMMAND 
   > [CPU1] show_tasks: ---- --- ---- --- -------- ------- --- ------- 
---------- -------- 0x108227a8 2048 120 5.8% irq 
   > [CPU1] dump_task: 0 0 0 0 FIFO Kthread N-- Assigned 0000000000000000 
0x10826518 1000 544 54.4% CPU0 IDLE 
   > [CPU1] dump_task: 1 1 1 0 FIFO Kthread N-- Assigned 0000000000000000 
0x10825918 1000 664 66.4% CPU1 IDLE 
   > [CPU1] dump_task: 2 2 2 0 FIFO Kthread N-- Running 0000000000000000 
0x10825d18 1000 664 66.4% CPU2 IDLE 
   > [CPU1] dump_task: 3 3 3 0 FIFO Kthread N-- Running 0000000000000000 
0x10826118 1000 664 66.4% CPU3 IDLE 
   > [CPU1] dump_task: 4 4 0 192 RR Kthread --- Waiting Semaphore 
0000000000000000 0x108282b8 1992 544 27.3% hpwork 0x10824b44 
   > [CPU1] dump_task: 5 5 0 100 RR Task --- Waiting Semaphore 0000000000000000 
0x10828e90 2000 1432 71.6% nsh_main 
   > [CPU1] dump_task: 44 44 0 100 RR Task --- Waiting Semaphore 
0000000000000000 0x10829998 2008 696 34.6% ostest 
   > [CPU1] dump_task: 45 45 0 100 RR Task --- Running 0000000000000000 
0x1082d0f0 8112 800 9.8% ostest Arg1 Arg2 Arg3 Arg4 
   > [CPU1] dump_task: 175 175 1 100 RR Task --- Running 0000000000000000 
0x1082f0d0 8152 1740 21.3% waiter 
   > ```
   
   Actually Tiago's suggestion to modify it is a little bit different:
   
   ```
   $ git diff
   diff --git a/arch/arm/src/armv7-m/arm_sigdeliver.c 
b/arch/arm/src/armv7-m/arm_sigdeliver.c
   index 94098e0367..581a9a291c 100644
   --- a/arch/arm/src/armv7-m/arm_sigdeliver.c
   +++ b/arch/arm/src/armv7-m/arm_sigdeliver.c
   @@ -87,9 +87,9 @@ void arm_sigdeliver(void)
      do
        {
    #ifdef CONFIG_ARMV7M_USEBASEPRI
   -      leave_critical_section((uint8_t)regs[REG_BASEPRI]);
   +      leave_critical_section((uint8_t)rtcb->xcp.regs[REG_BASEPRI]);
    #else
   -      leave_critical_section((uint16_t)regs[REG_PRIMASK]);
   +      leave_critical_section((uint16_t)rtcb->xcp.regs[REG_PRIMASK]);
    #endif
        }
      while (rtcb->irqcount > 0);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to