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/12/22 08:58:59 UTC
[GitHub] [nuttx] zyfeier opened a new pull request, #7955: arch: save user context in assert common code
zyfeier opened a new pull request, #7955:
URL: https://github.com/apache/nuttx/pull/7955
## Summary
This is the work continue with #7875.
## Impact
## 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] [nuttx] xiaoxiang781216 commented on a diff in pull request #7955: arch: save user context in assert common code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7955:
URL: https://github.com/apache/nuttx/pull/7955#discussion_r1056349841
##########
sched/misc/assert.c:
##########
@@ -59,6 +60,12 @@
# undef CONFIG_ARCH_USBDUMP
#endif
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static uint8_t s_last_regs[XCPTCONTEXT_SIZE];
Review Comment:
I think even static global variable still use g_ prefix?
```suggestion
static uint8_t g_last_regs[XCPTCONTEXT_SIZE];
```
##########
arch/avr/src/avr32/avr_saveusercontext.S:
##########
@@ -0,0 +1,86 @@
+/************************************************************************************
+ * arch/avr/src/avr32/avr_saveusercontext.S
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/irq.h>
+#include <arch/avr32/avr32.h>
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Symbols
+ ************************************************************************************/
+
+ .file "avr_saveusercontext.S"
+
+/************************************************************************************
+ * Macros
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_saveusercontext
+ *
+ * Description:
+ * Save the current thread context
+ *
+ ****************************************************************************/
+
+ .text
+ .globl up_saveusercontext
+ .type up_saveusercontext, @function
+up_saveusercontext:
+ /* "Pickle" the current thread context in the saveregs "can." r12=saveregs. */
+ /* xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx */
+ /* ^r12 */
+ /* Sample SR and set r12 to just after the LR storage location. */
+ /* xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx */
+ /* ^r12 */
+
+ mfsr r10, AVR32_SR
+ sub r12, -4*(REG_LR+1)
+
+ /* Then "push" PC=LR, LR, SR, and SP as they are on entry. */
+ /* xx xx xx xx xx xx xx xx SP SR PC LR xx xx xx xx xx */
+ /* ^r12 */
+
+ st.w --r12, lr
+ st.w --r12, lr
+ st.w --r12, r10
+ st.w --r12, sp
+
+ /* Save the preserved/static registers, r0-r7. There is no reason to save the */
+ /* scratch/volatile registers, r8-r12, in this context. */
+ /* 07 06 05 04 03 02 01 00 SP SR PC LR xx xx xx xx xx */
+ /* ^r12 */
+
+ stm --r12, r0-r7
Review Comment:
```suggestion
stm --r12, r0-r7
```
##########
arch/avr/src/avr32/avr_saveusercontext.S:
##########
@@ -0,0 +1,86 @@
+/************************************************************************************
+ * arch/avr/src/avr32/avr_saveusercontext.S
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ************************************************************************************/
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/irq.h>
+#include <arch/avr32/avr32.h>
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Symbols
+ ************************************************************************************/
+
+ .file "avr_saveusercontext.S"
+
+/************************************************************************************
+ * Macros
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+/****************************************************************************
+ * Name: up_saveusercontext
+ *
+ * Description:
+ * Save the current thread context
+ *
+ ****************************************************************************/
+
+ .text
+ .globl up_saveusercontext
+ .type up_saveusercontext, @function
+up_saveusercontext:
+ /* "Pickle" the current thread context in the saveregs "can." r12=saveregs. */
+ /* xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx */
+ /* ^r12 */
+ /* Sample SR and set r12 to just after the LR storage location. */
+ /* xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx */
+ /* ^r12 */
+
+ mfsr r10, AVR32_SR
+ sub r12, -4*(REG_LR+1)
Review Comment:
```suggestion
sub r12, -4*(REG_LR+1)
```
--
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] [nuttx] xiaoxiang781216 merged pull request #7955: arch: save user context in assert common code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #7955:
URL: https://github.com/apache/nuttx/pull/7955
--
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] [nuttx] pkarashchenko commented on a diff in pull request #7955: arch: save user context in assert common code
Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7955:
URL: https://github.com/apache/nuttx/pull/7955#discussion_r1056839308
##########
arch/z16/src/common/z16_registerdump.c:
##########
@@ -43,20 +43,22 @@ uintptr_t up_getusrsp(void)
}
/****************************************************************************
- * Name: z16_registerdump
+ * Name: up_dump_register
****************************************************************************/
-void z16_registerdump(FAR volatile uint32_t *regs)
+void up_dump_register(FAR void *dumpregs)
{
#ifdef CONFIG_DEBUG_INFO
+ FAR uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
Review Comment:
```suggestion
FAR volatile uint32_t *regs = dumpregs ? dumpregs : g_current_regs;
```
--
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