You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/08/10 18:02:51 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #4317: arch: Implement up_signal_handler by C instead of ASM

xiaoxiang781216 opened a new pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317


   ## Summary
   and remove the duplicated implementation
   
   ## Impact
   Code refactory
   
   ## Testing
   
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-904290253


   Hmm, stm32f4discovery:kostest crashed.
   
   ```
   user_main: signal handler test
   sighand_test: Initializing semaphore to 0
   sighand_test: Starting waiter task
   sighand_test: Started waiter_main pid=54
   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=0
   waiter_main: Waiting on semaphore
   sighand_test: Signaling pid=54 with signo=17 sigarm_hardfault: PANIC!!! Hard fault: 40000000
   up_assert: Assertion failed at file:armv7-m/arm_hardfault.c line: 135 task: waiter
   up_registerdump: R0: 00000007 ffffffff ffffffff 20011d5c 00000000 08002191 ffffffff 20002188
   up_registerdump: R8: 20002180 00000000 00000000 00000000 0800380d 20011d80 0802112f 20002130
   up_registerdump: xPSR: 20000000 PRIMASK: 00000000 CONTROL: 00000000
   up_registerdump: EXC_RETURN: fffffff9
   up_dumpstate: sp:         20011cb8
   up_dumpstate: stack base: 20011678
   up_dumpstate: stack size: 000007f0
   up_stackdump: 20011ca0: 00000000 20011e68 20011678 20002130 20000438 08004461 00000000 00000000
   up_stackdump: 20011cc0: 00000000 0800380d 20011d80 0802112f 20002130 08003d2d 00000000 20002130
   up_stackdump: 20011ce0: 0802d35f 08020030 00000000 20002180 00000000 080038fd 0800a1f9 0800093f
   up_stackdump: 20011d00: 20000438 00000003 20011d34 08001d57 10000000 080007a1 00000000 20011d34
   up_stackdump: 20011d20: 08002191 ffffffff 20002188 0800073d 080210d1 20011d80 00000000 00000000
   up_stackdump: 20011d40: 08002191 ffffffff 20002188 20002180 00000000 00000000 00000000 fffffff9
   up_stackdump: 20011d60: 00000007 ffffffff ffffffff 20011d5c 0800380d 0802112f 20002130 20000000
   up_stackdump: 20011d80: 20001920 08002191 00000111 0000002a 01000000 20002130 00000004 00000000
   up_stackdump: 20011da0: 00000000 00000000 00000000 00000000 00000000 080047cd 08021181 20011e18
   up_stackdump: 20011dc0: 00000001 00000000 08021181 00000000 00000000 00000000 00000000 00000000
   up_stackdump: 20011de0: 00000000 fffffff9 ffffffff 20011de4 ffffffff 20011534 080037d9 fffffff9
   up_stackdump: 20011e00: 080047a1 01000000 080037d9 00000000 08021181 fffffff9 00000014 00000000
   up_stackdump: 20011e20: 00000000 00000000 00020000 080210d1 fffdffff 00000002 00000000 00000000
   up_stackdump: 20011e40: 00000000 00000000 0802003b 20011668 0800265d 08021181 00000000 0800265d
   up_stackdump: 20011e60: 00000000 00000000 0000e190 00000820 10000008 200100cc 00000000 ffff0001
   ```


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] davids5 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-904654758


   @xiaoxiang781216 - does this new discovery have any bearing on the other PR?


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-903529376


   @xiaoxiang781216 
   
   ```
   ====================================================================================
   Configuration/Tool: spresense/usbnsh,CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL
   ------------------------------------------------------------------------------------
     Cleaning...
     Configuring...
     Disabling CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL
     Enabling CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL
     Building NuttX...
   /github/workspace/sources/nuttx/include/unistd.h: In function '_exit':
   Error: task/exit.c:57:1: error: 'noreturn' function does return [-Werror]
      57 | }
         | ^
   ```
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-903593468


   Fixed.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-904663312


   No, arm_switchcontext in https://github.com/apache/incubator-nuttx/pull/4279 still need return to caller. It's different from SYS_signal_handler_return.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-896463033


   Note: the generated code is better than the manual write:
   ```
   ./arch/arm/src/arm_signal_handler.o:     file format elf32-littlearm
   
   
   Disassembly of section .text:
   
   00000000 <up_signal_dispatch>:
      0:   b510            push    {r4, lr}
      2:   4604            mov     r4, r0
      4:   4608            mov     r0, r1
      6:   4611            mov     r1, r2
      8:   461a            mov     r2, r3
      a:   47a0            blx     r4
      c:   2007            movs    r0, #7
      e:   df00            svc     0
     10:   bd10            pop     {r4, pc}
   ```


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-902412793


   @xiaoxiang781216 
   
   >Note: the generated code is better than the manual write:
   
   Which configuration did you use to generate the code?
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 closed pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 closed pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317


   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-903497850


   > @xiaoxiang781216
   > 
   > > Note: the generated code is better than the manual write:
   > 
   > Which configuration did you use to generate the code?
   
   stm32f4discovery:kostest


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-904334353


   After comparing the assemble code side by side, there is a key point difference.
   The manual assembler code restore lr before svc:
   ```
   	/* Restore the registers */
   
   	pop		{r2}			/* Recover LR in R2 */
   	mov		lr, r2			/* Restore LR */
   
   	/* Execute the SYS_signal_handler_return SVCall (will not return) */
   
   	mov		r0, #SYS_signal_handler_return
   	svc		#SYS_syscall
   ```
   but the generated code restore lr after svc:
   ```
      c:   2007            movs    r0, #7
      e:   df00            svc     0
     10:   bd10            pop     {r4, pc}
   ```
   So, it look that the manual assembler code is required here to control the accurate sequence.


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #4317: arch: Implement up_signal_handler by C instead of ASM

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #4317:
URL: https://github.com/apache/incubator-nuttx/pull/4317#issuecomment-904181494


   @xiaoxiang781216 
   
   Hmm, maix-bit:kostest with QEMU stopped with DEBUGASSERT
   
   ```
   user_main: signal handler test
   sighand_test: Initializing semaphore to 0
   sighand_test: Starting waiter task
   sighand_test: Started waiter_main pid=53
   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=0
   waiter_main: Waiting on semaphore
   sighand_test: Signaling pid=53 with signo=17 sigvalue=42
   wakeup_action: Received signal 17
   wakeup_action: sival_int=42
   wakeup_action: si_code=1
   wakeup_action: ucontext=0
   up_assert: Assertion failed at file:rv64gc/riscv_swint.c line: 407 task: waiter
   up_registerdump: EPC:00000000801000d4 
   up_registerdump: A0:0000000000000007 A1:ffffffffffffffff6 A2:ffffffffffffffff A3:0000000080406e38 
   up_registerdump: A4:0000000000000040 A5:0000000000000013A6:0000000000000009 A7:0000000000000068 
   up_registerdump: T0:00000000800042cc T1:0000000000000009 T2:0000000000000020 T3:000000000000002a 
   up_registerdump: T4:000000000000002e T5:00000000000001ff T6:000000000000002d 
   up_registerdump: S0:0000000080481d70 S1:0000000080480b50 S2:ffffffffffffffff S3:0000000000000000 
   up_registerdump: S4:0000000080481e08 S5:0000000000000008 S6:0000000080481df8 S7:0000000000000002 
   up_registerdump: S8:0000000000000088 S9:0000000000000000 S10:0000000000000000 S11:0000000000000000 
   up_registerdump: SP:0000000080406e60 FP:0000000080481d70 TP:0000000000000000 RA:00000000801000ce 
   ```
   


-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org