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 2022/03/25 16:57:00 UTC

[GitHub] [incubator-nuttx] GUIDINGLI opened a new pull request #5845: armv8-m: make the securefault handled by non-securefult

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


   ## Summary
   armv8-m: make the securefault handled by non-securefult
   
   If non-secure generated securefault, then we can't get non-secure PC and backtrace in secure ENV (TEE).
   
   So, this patch provide a method, return the securefault IRQ, back to non-secure env, and crash.
   Then we can get the error PC and backtrace, this is very useful for debugging.
   
   ## Impact
   armv8-m secure
   
   ## Testing
   VELA
   
   


-- 
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 merged pull request #5845: armv8-m: make the securefault handled by non-securefult

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


   


-- 
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] pkarashchenko commented on a change in pull request #5845: armv8-m: make the securefault handled by non-securefult

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #5845:
URL: https://github.com/apache/incubator-nuttx/pull/5845#discussion_r835792935



##########
File path: arch/arm/src/armv8-m/arm_securefault.c
##########
@@ -41,6 +41,38 @@
 
 #ifdef CONFIG_DEBUG_SECUREFAULT
 #  define sfalert(format, ...)  _alert(format, ##__VA_ARGS__)
+
+#define OFFSET_R0              (0 * 4) /* R0 */
+#define OFFSET_R1              (1 * 4) /* R1 */
+#define OFFSET_R2              (2 * 4) /* R2 */
+#define OFFSET_R3              (3 * 4) /* R3 */
+#define OFFSET_R12             (4 * 4) /* R12 */
+#define OFFSET_R14             (5 * 4) /* R14 = LR */
+#define OFFSET_R15             (6 * 4) /* R15 = PC */
+#define OFFSET_XPSR            (7 * 4) /* xPSR */

Review comment:
       ```suggestion
   #  define OFFSET_R0              (0 * 4) /* R0 */
   #  define OFFSET_R1              (1 * 4) /* R1 */
   #  define OFFSET_R2              (2 * 4) /* R2 */
   #  define OFFSET_R3              (3 * 4) /* R3 */
   #  define OFFSET_R12             (4 * 4) /* R12 */
   #  define OFFSET_R14             (5 * 4) /* R14 = LR */
   #  define OFFSET_R15             (6 * 4) /* R15 = PC */
   #  define OFFSET_XPSR            (7 * 4) /* xPSR */
   ```

##########
File path: arch/arm/src/armv8-m/arm_securefault.c
##########
@@ -41,6 +41,38 @@
 
 #ifdef CONFIG_DEBUG_SECUREFAULT
 #  define sfalert(format, ...)  _alert(format, ##__VA_ARGS__)
+
+#define OFFSET_R0              (0 * 4) /* R0 */
+#define OFFSET_R1              (1 * 4) /* R1 */
+#define OFFSET_R2              (2 * 4) /* R2 */
+#define OFFSET_R3              (3 * 4) /* R3 */
+#define OFFSET_R12             (4 * 4) /* R12 */
+#define OFFSET_R14             (5 * 4) /* R14 = LR */
+#define OFFSET_R15             (6 * 4) /* R15 = PC */
+#define OFFSET_XPSR            (7 * 4) /* xPSR */
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+static void generate_nonsecure_busfault(void)
+{
+  uint32_t nsp;
+
+  /* Get non-secure SP */
+
+  __asm__ __volatile__ ("mrs %0, msp_ns" : "=r" (nsp));
+
+  sfalert("Non-sec sp %08x\n", nsp);

Review comment:
       ```suggestion
     sfalert("Non-sec sp %08" PRIx32 "\n", nsp);
   ```




-- 
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