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 2020/10/22 08:23:17 UTC
[GitHub] [incubator-nuttx] masayuki2009 opened a new pull request #2061: Refactor arm interrupt stack related code
masayuki2009 opened a new pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061
## Summary
- This PR refactors interrupt stack related code for all ARM architectures
- Also, this PR includes a fix for CPUx Idle stack for Cortex-A SMP
- This PR consists of the following commits
- commit 1: arch: armv7-a: Fix style warnings in smp.h
- commit 2: arch: armv7-a: Fix SMP_STACK_TOP in smp.h
- This commit fixes CPUx IDLE stack top for SMP
- commit 3: boards: sabre-6quad: Update nsh/defconfig
- Add CONFIG_DEBUG_FULLOPT=y
- Add CONFIG_DEBUG_SYMBOLS=y
- Remove CONFIG_HOST_WINDOWS=y
- Add CONFIG_READLINE_CMD_HISTORY=y
- Add CONFIG_STACK_COLORATION=y
- commit 4: armv7-a, imx6: Refactor interrupt stack related code
- Remove -4/-8 offset coding in imx_irq.c and arm_vectors.S
- Instead, add SP adjustment after calling setirqstack/setfiqstack
- Also, fix alignments for g_intstackalloc
- Fix comments on the user stack pointer in arm_vectors.S
- Also, fix up_dumpstate() to extract the user stack pointer
- NOTE: stack pointer alignment is 8-byte
- commit 5: arm, c5471: Refactor interrupt stack related code
- Apply the same logic for armv7-a
- NOTE: stack pointer alignment is 4-byte
- commit 6: boards: stm32f4discovery: Update wifi/defconfig
- Add CONFIG_ARCH_INTERRUPTSTACK=2048
- Add CONFIG_ARMV7M_LAZYFPU=y
- Add CONFIG_TESTING_OSTEST_FPUSIZE=132
- commit 7: armv7-m, cxd56xx, lc823450: Refactor interrupt stack related code
- Remove +4/-8 offset coding
- Instead, add SP adjustment after calling setintstack
- Also, fix alignments for g_intstackalloc
- NOTE: stack pointer alignment is 8-byte
- commit 8: arch: armv8-m: Refactor interrupt stack related code
- Apply the same logic for armv7-m
- NOTE: stack pointer alignment is 8-byte
- commit 9: arch: armv6-m: Refactor interrupt stack related code
- Apply the same logic for armv7-m
- NOTE: stack pointer alignment is 4-byte
## Impact
- All ARM architectures with interrupt stack enabled
## Testing
- Tested with sabre-6quad:smp with QEMU
- Tested with sabre-6quad:nsh with QEMU
- Built with c5471evm.nsh (CONFIG_ARCH_INTERRUPTSTACK=2048)
- Built with ea3131:nsh (CONFIG_ARCH_INTERRUPTSTACK=2048)
- Tested with spresense:wifi_smp
- Tested with lc823450:smp
- Tested with stm32f4discovery:wifi
- Not tested for armv7-r
- Not tested for armv8-m
- Built with freedom-kl25z:nsh (CONFIG_ARCH_INTERRUPTSTACK=2048)
- Not tested for armv6-m
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510528690
##########
File path: arch/arm/src/armv8-m/arm_exception.S
##########
@@ -213,6 +213,7 @@ exception_common:
*/
setintstack r2, r3
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
The same reason as what I commented on arch/arm/src/armv7-m/gnu/arm_lazyexception.S
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510531423
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -197,7 +197,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
The same reason as what I commented on arch/arm/src/armv7-m/gnu/arm_lazyexception.S
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715215040
> @xiaoxiang781216, @MasayukiIshikawa, @Ouss4
>
> I would like to test this on HW.
>
Sure, let's wait your test.
> I also think we need to define Top, bottom, base in terms of addresses.
>
> Thing like this read wrong
>
> `if (sp < istackbase && sp > istackbase - istacksize)`
>
> high address
> <- top, bound
>
> <-sp
> <- bottom, base
> low addresses
>
Yes, the term usage is strange, but it is an unrelated issue. It's better to create new PR to fix the term issue.
> I need to review this more carefully, but it look to me that were are adding instructions for alignment when the compiler can do it.
> We need to all ways allocate larger for alignment.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510517612
##########
File path: arch/arm/src/armv7-a/arm_assert.c
##########
@@ -265,24 +265,10 @@ static void up_dumpstate(void)
if (sp > istackbase - istacksize && sp < istackbase)
{
- uint32_t *stackbase;
Review comment:
@xiaoxiang781216
I think so too, becuase in arm_syscall.c we can find the following code.
```
#ifdef CONFIG_ARCH_KERNEL_STACK
/* If this is the first SYSCALL and if there is an allocated
* kernel stack, then switch to the kernel stack.
*/
if (index == 0 && rtcb->xcp.kstack != NULL)
{
rtcb->xcp.ustkptr = (FAR uint32_t *)regs[REG_SP];
regs[REG_SP] = (uint32_t)rtcb->xcp.kstack +
ARCH_KERNEL_STACKSIZE;
}
#endif
```
However, if we remove -4 at line 255, I think I should add a separate commit to this PR,
instead of ammending exsisting commit. What do you think?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510560312
##########
File path: arch/arm/src/armv7-a/arm_assert.c
##########
@@ -265,24 +265,10 @@ static void up_dumpstate(void)
if (sp > istackbase - istacksize && sp < istackbase)
{
- uint32_t *stackbase;
Review comment:
Sure.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511236136
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -890,9 +890,9 @@ arm_vectorfiq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lfiqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
Yes and done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510518398
##########
File path: arch/arm/src/armv7-a/smp.h
##########
@@ -58,7 +58,7 @@
#define SMP_STACK_MASK 7
#define SMP_STACK_SIZE ((CONFIG_SMP_IDLETHREAD_STACKSIZE + 7) & ~7)
#define SMP_STACK_WORDS (SMP_STACK_SIZE >> 2)
-#define SMP_STACK_TOP (SMP_STACK_SIZE - 8)
+#define SMP_STACK_TOP (SMP_STACK_SIZE)
Review comment:
@xiaoxiang781216
Thanks for the advice.
OK, to reduce complexity, I will replace them and remove SMP_STACK_TOP in smp.h
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510827344
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
This PR doesn't change the round behaviour, please don't do the different thing in one 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510671836
##########
File path: arch/arm/src/armv8-m/arm_lazyexception.S
##########
@@ -210,6 +210,7 @@ exception_common:
*/
setintstack r2, r3
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510375552
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
@xiaoxiang781216 why would that line be wrong? We use `CONFIG_ARCH_INTERRUPTSTACK < ALIGN_REQUIREMENT` to mean that there is no interrupt stack. We are not changing `CONFIG_ARCH_INTERRUPTSTACK`.
But yes, when dumping and checking the stack we always use the align down. Not sure why, if we have a consistent INTSTACK_SIZE (whether aligned up or down) wouldn't that suffice?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510670972
##########
File path: arch/arm/src/armv7-a/smp.h
##########
@@ -58,7 +58,7 @@
#define SMP_STACK_MASK 7
#define SMP_STACK_SIZE ((CONFIG_SMP_IDLETHREAD_STACKSIZE + 7) & ~7)
#define SMP_STACK_WORDS (SMP_STACK_SIZE >> 2)
-#define SMP_STACK_TOP (SMP_STACK_SIZE - 8)
+#define SMP_STACK_TOP (SMP_STACK_SIZE)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 edited a comment on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 edited a comment on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715265904
> Yes, the term usage is strange, but it is an unrelated issue. It's better to create new PR to fix the term issue.
@xiaoxiang781216 Agreed it can be changes in another PR.
> In terms of address, "base" is "top" for a push-down stack, this is what's making things a bit confusing. However, I believe it's used consistently: xx_alloc = bottom and xx_base = top or bottom depending on the stack.
Yes Memory allocations are base that is understood. The other is a visual thing for me. (I was indoctrinated by my first debugger http://www.pestingers.net/pdfs/s100-computers/vector-graphics/vector-raid-man.pdf - I wish there were pics)
I find it incorrect and confusing on descending stack arch.
Please read this with a smile....it it written with one......
Where do we put the lamp shade on a lamp? On the top or the base.
If we hang fly paper from a pole? On the base it hits the floor. On the top it does not, and it grows downward
What is the base address of a UART?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510023331
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
@Ouss4
I agree.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511235050
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1072,15 +1072,15 @@ arm_vectorfiq:
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
- .align 4
+ .balign 8
.globl g_intstackalloc
.type g_intstackalloc, object
.globl g_intstackbase
.type g_intstackbase, object
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
OK
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511235050
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1072,15 +1072,15 @@ arm_vectorfiq:
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
- .align 4
+ .balign 8
.globl g_intstackalloc
.type g_intstackalloc, object
.globl g_intstackbase
.type g_intstackbase, object
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715173257
@masayuki2009 do you have plan to fix -4/-8 issue for idle thread stack and normal task/thread stack?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715255051
@masayuki2009 - I have tested this. My only 2 concerns are 1) Not rounding UP (see https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510786581), and 2 this change:

Would you help me understand if is it correct?
Are we using Descending Empty or Descending Full?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510525031
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -261,7 +261,8 @@ arm_vectorirq:
/* Call arm_decodeirq() on the interrupt stack */
setirqstack r1, r3 /* SP = IRQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
OK.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510634317
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -179,9 +179,10 @@ arm_vectorirq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
OK
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -890,9 +891,10 @@ arm_vectorfiq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lfiqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
OK
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 edited a comment on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 edited a comment on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-714427977
> @masayuki2009 Thank you for the PR and all the information on what was done. Would you please add some back ground as to why these changes are needed?
@davids5
Good question!
I forgot to add the most important information on this PR.
This PR was created based on the discussion at https://github.com/apache/incubator-nuttx/pull/2042.
Anyway thanks for pointing out.
I will add a comment to the PR summary first.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715199513
@Ouss4 do you have more comment? otherwise, I will merge this patch.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 merged pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 merged pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715908411
> @Ouss4, @davids5, @xiaoxiang781216
> Thanks for your comments.
> I've just read all discussions and fixed the commits again.
>
> @davids5
> Thanks for imforming us the "ARM: Fix off-by-one ..." issue.
> I think the PR was posted to the old NuttX repository on bitbucket.
> However, the repository had been removed.
> So how can we find the PR?
hmmm, That pic was from my email, maybe we can ask @patacongo if it can be restored.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510635406
##########
File path: arch/arm/src/armv8-m/arm_exception.S
##########
@@ -213,6 +213,7 @@ exception_common:
*/
setintstack r2, r3
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
OK, I will remove the line.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715322284
> > So..
> > Descending-full then implies:
> > SP ->last write.
> > push is decrement then store
> > Correct?
>
> Yes, it is correct.
>
> > Then isn't the changes with SP-X wrong? The value at [SP-X] get overwritten by any push's in the call chain of arm_decodeirq.
>
> The ! at the end will write back the sp - 4 to sp, so the next push will allocate the new location in the next slot.
>
> > Or am I seeing this incorrectly?
I did not even notice it! Thank you!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511236354
##########
File path: arch/arm/src/armv8-m/arm_lazyexception.S
##########
@@ -373,9 +373,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510671752
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -192,7 +192,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511234906
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1004,7 +1004,7 @@ arm_vectorfiq:
#if CONFIG_ARCH_INTERRUPTSTACK > 7
setfiqstack r1, r4 /* SP = FIQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
Yes and done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511236285
##########
File path: arch/arm/src/armv8-m/arm_exception.S
##########
@@ -355,9 +355,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715328711
> @masayuki2009 @xiaoxiang781216
>
> On the alignment please see the [86400a2](https://github.com/apache/incubator-nuttx/commit/86400a252dcbe6e4aef3ecca000b469a0fe96b67) and the blame. I think in this PR we are reverting a change that fixed a real problem.
from the change, the stack space allocation round to the near(may roundup or rounddown), but the sp always point to the rounddown location. So I can't understand what problem he want to fix without the detail commit message.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510882366
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1004,7 +1004,7 @@ arm_vectorfiq:
#if CONFIG_ARCH_INTERRUPTSTACK > 7
setfiqstack r1, r4 /* SP = FIQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
-4?
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -261,7 +261,7 @@ arm_vectorirq:
/* Call arm_decodeirq() on the interrupt stack */
setirqstack r1, r3 /* SP = IRQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
-4?
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1096,7 +1096,7 @@ g_intstackbase:
.type g_fiqstackbase, object
g_fiqstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -340,9 +340,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
need keep the old code
##########
File path: arch/arm/src/armv8-m/arm_exception.S
##########
@@ -355,9 +355,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
need keep the old
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1072,15 +1072,15 @@ arm_vectorfiq:
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
- .align 4
+ .balign 8
.globl g_intstackalloc
.type g_intstackalloc, object
.globl g_intstackbase
.type g_intstackbase, object
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
need keep the old code after disscussion
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -957,21 +957,21 @@ arm_vectorfiq:
* Name: g_intstackalloc/g_intstackbase
************************************************************************************/
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
- .align 4
+ .balign 8
.globl g_intstackalloc
.type g_intstackalloc, object
.globl g_intstackbase
.type g_intstackbase, object
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -890,9 +890,9 @@ arm_vectorfiq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lfiqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
change 8 to 4
##########
File path: arch/arm/src/armv8-m/arm_lazyexception.S
##########
@@ -373,9 +373,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
need keep
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -179,9 +179,9 @@ arm_vectorirq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
change to -4
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715655091
@ouss4, @davids5, @xiaoxiang781216
Thanks for your comments.
I've just read all discussions and fixed the commits again.
@davids5
Thanks for imforming us the "ARM: Fix off-by-one ..." issue.
I think the PR was posted to the old NuttX repository on bitbucket.
However, the repository had been removed.
So how can we find the 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715316382
> So..
>
> Descending-full then implies:
> SP ->last write.
> push is decrement then store
>
> Correct?
>
Yes, it is correct.
> Then isn't the changes with SP-X wrong? The value at [SP-X] get overwritten by any push's in the call chain of arm_decodeirq.
>
The ! at the end will write back the sp - 4 to sp, so the next push will allocate the new location in the next slot.
> Or am I seeing this incorrectly?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511235795
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -340,9 +340,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
OK and done
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -179,9 +179,9 @@ arm_vectorirq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
Yes and done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510566741
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -192,7 +192,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
OK
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510565196
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
@Ouss4, @xiaoxiang781216
Thanks for the discussion.
Shall we keep this commit (i.e. remove +4) at line 326?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510633932
##########
File path: arch/arm/src/c5471/c5471_vectors.S
##########
@@ -162,7 +162,8 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r1, [sp] /* Save the user stack pointer */
+ sub sp, #4 /* Adjust SP (minus 4-byte offset) */
+ str r1, [sp] /* Save the xcp address */
Review comment:
OK
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510672565
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -261,7 +261,8 @@ arm_vectorirq:
/* Call arm_decodeirq() on the interrupt stack */
setirqstack r1, r3 /* SP = IRQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510635175
##########
File path: arch/arm/src/armv8-m/arm_lazyexception.S
##########
@@ -210,6 +210,7 @@ exception_common:
*/
setintstack r2, r3
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
OK, I will remove the line.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715313224
> > @masayuki2009 - I have tested this. My only 2 concerns are 1) Not rounding UP (see [#2061 (comment)]
>
> The rounddown exist for a long time and nobody complain this behvaiour. if you think the roundup is better, please create a new PR to fix it.
>
> ([#2061 (comment)](https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510786581))), and 2 this change:
>
> > 
> > Would you help me understand if is it correct?
> > Are we using Descending Empty or Descending Full?
>
> We can't select here, ARM require the descending full stack:
> https://static.docs.arm.com/ihi0042/f/IHI0042F_aapcs.pdf
Thanks @xiaoxiang781216
So..
Descending-full then implies:
SP ->last write.
push is decrement then store
Correct?
Then isn't the changes with SP-X wrong? The value at [SP-X] get overwritten by any push's in the call chain of arm_decodeirq.
Or am I seeing this incorrectly?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715285984
> @masayuki2009 - I have tested this. My only 2 concerns are 1) Not rounding UP (see [#2061 (comment)]
The rounddown exist for a long time and nobody complain this behvaiour. if you think the roundup is better, please create a new PR to fix it.
(https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510786581)), and 2 this change:
>
> 
>
> Would you help me understand if is it correct?
>
> Are we using Descending Empty or Descending Full?
We can't select here, ARM require the descending full stack:
https://static.docs.arm.com/ihi0042/f/IHI0042F_aapcs.pdf
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 edited a comment on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 edited a comment on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-714427977
> @masayuki2009 Thank you for the PR and all the information on what was done. Would you please add some back ground as to why these changes are needed?
@davids5
Good question!
I forgot to add the most important information on this PR.
This PR was created based on the discussion at https://github.com/apache/incubator-nuttx/pull/2042.
Anyway, thanks for pointing out.
I will add a comment to the PR summary first.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510562610
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -192,7 +192,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
I thought I added a comment on this.
The reason is that the setinstack load $SP from g_intstackbase at line 91
```
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.macro setintstack, tmp1, tmp2
ldr sp, =g_intstackbase
.endm
#endif
````
In the case of SMP, MCU specific code in chip.h will load $SP as well
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 edited a comment on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 edited a comment on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715207683
@xiaoxiang781216, @MasayukiIshikawa, @Ouss4
I would like to test this on HW.
I also think we need to define Top, bottom, base in terms of addresses.
Thing like this read wrong
`if (sp < istackbase && sp > istackbase - istacksize)`
high address
<- top, bound
<-sp
<- bottom, base
low addresses
I need to review this more carefully, but it look to me that were are adding instructions for alignment when the compiler can do it.
We need to all ways allocate larger for alignment.
Update: `we are adding instructions for alignment` - I was looking not the latest changes @xiaoxiang781216 had asked for.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715339023
@davids5 , from the description +4 is good fix to support 4 bytes and 8 bytes alignment for different arm arch.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510635701
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -197,7 +197,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
OK, I will remove the line.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511236204
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -957,21 +957,21 @@ arm_vectorfiq:
* Name: g_intstackalloc/g_intstackbase
************************************************************************************/
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
.bss
- .align 4
+ .balign 8
.globl g_intstackalloc
.type g_intstackalloc, object
.globl g_intstackbase
.type g_intstackbase, object
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~3) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510672165
##########
File path: arch/arm/src/armv6-m/arm_exception.S
##########
@@ -153,6 +153,7 @@ exception_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr r7, =g_intstackbase /* R7=Base of the interrupt stack */
+ sub r7, #4 /* Adjust R7 (minus 4-byte offset) */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510279488
##########
File path: arch/arm/src/armv7-a/smp.h
##########
@@ -58,7 +58,7 @@
#define SMP_STACK_MASK 7
#define SMP_STACK_SIZE ((CONFIG_SMP_IDLETHREAD_STACKSIZE + 7) & ~7)
#define SMP_STACK_WORDS (SMP_STACK_SIZE >> 2)
-#define SMP_STACK_TOP (SMP_STACK_SIZE - 8)
+#define SMP_STACK_TOP (SMP_STACK_SIZE)
Review comment:
let's replace all SMP_STACK_TOP with SMP_STACK_SIZE?
##########
File path: arch/arm/src/arm/arm_vectors.S
##########
@@ -132,7 +132,8 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #4 /* Adjust SP (minus 4-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
"str r0, [sp, #-4]!"
##########
File path: arch/arm/src/armv8-m/arm_exception.S
##########
@@ -213,6 +213,7 @@ exception_common:
*/
setintstack r2, r3
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
why sub 8?
##########
File path: arch/arm/src/armv7-a/arm_assert.c
##########
@@ -265,24 +265,10 @@ static void up_dumpstate(void)
if (sp > istackbase - istacksize && sp < istackbase)
{
- uint32_t *stackbase;
Review comment:
should we remove -4 at line 255?
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -197,7 +197,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
why sub 8?
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
the alignment need sync with the code in stack setup and dump. for example here is line 70:
```
# if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 8
```
if we select the align up, the above logic is wrong and should change to CONFIG_ARCH_INTERRUPTSTACK < 1.
So, I would like to keep the logic as simple as possible instead bringing up more inconsistentence like this. The round down logic is more suitable choice because I don't think there is much difference betwen 2000 and 2008 if user set CONFIG_ARCH_INTERRUPTSTACK to 2006. The consistent round strategy across all related code is more important.
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -890,9 +891,10 @@ arm_vectorfiq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lfiqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
merge
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -179,9 +179,10 @@ arm_vectorirq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
merge into one instruction like armv7-a
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -192,7 +192,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
why need sub 8 here?
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -261,7 +261,8 @@ arm_vectorirq:
/* Call arm_decodeirq() on the interrupt stack */
setirqstack r1, r3 /* SP = IRQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
merge to "str r0, [sp + #-8]!"
##########
File path: arch/arm/src/armv6-m/arm_exception.S
##########
@@ -153,6 +153,7 @@ exception_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr r7, =g_intstackbase /* R7=Base of the interrupt stack */
+ sub r7, #4 /* Adjust R7 (minus 4-byte offset) */
Review comment:
don't need, since push {r1} at line 158 equal:
sub sp, #4
str r1, [sp]
##########
File path: arch/arm/src/c5471/c5471_vectors.S
##########
@@ -162,7 +162,8 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r1, [sp] /* Save the user stack pointer */
+ sub sp, #4 /* Adjust SP (minus 4-byte offset) */
+ str r1, [sp] /* Save the xcp address */
Review comment:
same as line 136
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1004,7 +1005,8 @@ arm_vectorfiq:
#if CONFIG_ARCH_INTERRUPTSTACK > 7
setfiqstack r1, r4 /* SP = FIQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
same comment as line 265
##########
File path: arch/arm/src/armv8-m/arm_lazyexception.S
##########
@@ -210,6 +210,7 @@ exception_common:
*/
setintstack r2, r3
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
why sub 8?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510690322
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
@Ouss4
Thanks, I keep the commit.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510690993
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1096,7 +1098,7 @@ g_intstackbase:
.type g_fiqstackbase, object
g_fiqstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
As a result of the discussion, we decided to keep the commit.
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1096,7 +1098,7 @@ g_intstackbase:
.type g_fiqstackbase, object
g_fiqstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715320610
@masayuki2009 @xiaoxiang781216
On the alignment please see the https://github.com/apache/incubator-nuttx/commit/86400a252dcbe6e4aef3ecca000b469a0fe96b67 and the blame. I think in this PR we are reverting a change that fixed a real problem.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510690387
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510671335
##########
File path: arch/arm/src/c5471/c5471_vectors.S
##########
@@ -162,7 +162,8 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r1, [sp] /* Save the user stack pointer */
+ sub sp, #4 /* Adjust SP (minus 4-byte offset) */
+ str r1, [sp] /* Save the xcp address */
Review comment:
Done
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -179,9 +179,10 @@ arm_vectorirq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
Done
##########
File path: arch/arm/src/armv7-r/arm_vectors.S
##########
@@ -890,9 +891,10 @@ arm_vectorfiq:
mov fp, #0 /* Init frame pointer */
mov r0, sp /* Get r0=xcp */
-#if CONFIG_ARCH_INTERRUPTSTACK > 3
+#if CONFIG_ARCH_INTERRUPTSTACK > 7
ldr sp, .Lfiqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 edited a comment on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 edited a comment on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715027962
@Ouss4 @xiaoxiang781216
I modified the code and pushed it with -f.
Also, I updated the summary.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511234827
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -261,7 +261,7 @@ arm_vectorirq:
/* Call arm_decodeirq() on the interrupt stack */
setirqstack r1, r3 /* SP = IRQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
Yes
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1004,7 +1004,7 @@ arm_vectorfiq:
#if CONFIG_ARCH_INTERRUPTSTACK > 7
setfiqstack r1, r4 /* SP = FIQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
Yes
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510025654
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1096,7 +1098,7 @@ g_intstackbase:
.type g_fiqstackbase, object
g_fiqstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
@Ouss4
I will apply the align up logic too.
Also, I will check the armv8-m and so on.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-714417476
@masayuki2009 Thank you for the PR and all the information on what was done. Would you please add some back ground as to why these changes are needed?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510525078
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1004,7 +1005,8 @@ arm_vectorfiq:
#if CONFIG_ARCH_INTERRUPTSTACK > 7
setfiqstack r1, r4 /* SP = FIQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
OK
##########
File path: arch/arm/src/arm/arm_vectors.S
##########
@@ -132,7 +132,8 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #4 /* Adjust SP (minus 4-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
OK
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510672227
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -197,7 +197,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715234724
LGTM, but let's wait for David's input.
> I also think we need to define Top, bottom, base in terms of addresses.
In terms of address, "base" is "top" for a push-down stack, this is what's making things a bit confusing. However, I believe it's used consistently: `xx_alloc` = `bottom` and `xx_base` = `top` or `bottom` depending on the stack.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510671879
##########
File path: arch/arm/src/armv8-m/arm_exception.S
##########
@@ -213,6 +213,7 @@ exception_common:
*/
setintstack r2, r3
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510562610
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -192,7 +192,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
I thought I added a comment on this.
The reason is that the setinstack load $SP from g_intstackbase
```
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.macro setintstack, tmp1, tmp2
ldr sp, =g_intstackbase
.endm
#endif
````
In the case of SMP, MCU specific code in chip.h will load $SP as well
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r509993414
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1096,7 +1098,7 @@ g_intstackbase:
.type g_fiqstackbase, object
g_fiqstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Should we keep the `.skip` in the base below?
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Shouldn't we align up here? `((CONFIG_ARCH_INTERRUPTSTACK + 7) & ~7)`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510518398
##########
File path: arch/arm/src/armv7-a/smp.h
##########
@@ -58,7 +58,7 @@
#define SMP_STACK_MASK 7
#define SMP_STACK_SIZE ((CONFIG_SMP_IDLETHREAD_STACKSIZE + 7) & ~7)
#define SMP_STACK_WORDS (SMP_STACK_SIZE >> 2)
-#define SMP_STACK_TOP (SMP_STACK_SIZE - 8)
+#define SMP_STACK_TOP (SMP_STACK_SIZE)
Review comment:
@xiaoxiang781216
Thanks for the advice.
OK, to reduce complexity, I will replace them and remove SMP_STACK_TOP.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715908175
> LGTM, @davids5 please help verify and merge the change.
@xiaoxiang781216 I will, but it will Monday.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510528620
##########
File path: arch/arm/src/armv8-m/arm_lazyexception.S
##########
@@ -210,6 +210,7 @@ exception_common:
*/
setintstack r2, r3
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
The same reason as what I commented on arch/arm/src/armv7-m/gnu/arm_lazyexception.S
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715207683
@xiaoxiang781216, @MasayukiIshikawa, @Ouss4
I would like to test this on HW.
I also think we need to define Top, bottom, base in terms of addresses.
Thing like this read wrong
`if (sp < istackbase && sp > istackbase - istacksize)`
high address
<- top, bound
<-sp
<- bottom, base
low addresses
I need to review this more carefully, but it look to me that were are adding instructions for alignment when the compiler can do it.
We need to all ways allocate larger for alignment.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510562610
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -192,7 +192,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
I thought I added a comment on this.
The reason is that the setinstack load $SP from g_intstackbase
```
#if !defined(CONFIG_SMP) && CONFIG_ARCH_INTERRUPTSTACK > 7
.macro setintstack, tmp1, tmp2
ldr sp, =g_intstackbase
.endm
#endif
````
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715752868
LGTM, @davids5 please help verify and merge the change.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511234827
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -261,7 +261,7 @@ arm_vectorirq:
/* Call arm_decodeirq() on the interrupt stack */
setirqstack r1, r3 /* SP = IRQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ str r0, [sp, #-8]! /* Save the xcp address at SP-8 then update SP */
Review comment:
Yes and done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510629040
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1096,7 +1098,7 @@ g_intstackbase:
.type g_fiqstackbase, object
g_fiqstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
I will follow the discussion results for arch/arm/src/armv7-m/gnu/arm_exception.S
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510517612
##########
File path: arch/arm/src/armv7-a/arm_assert.c
##########
@@ -265,24 +265,10 @@ static void up_dumpstate(void)
if (sp > istackbase - istacksize && sp < istackbase)
{
- uint32_t *stackbase;
Review comment:
@xiaoxiang781216
I think so too, because in arm_syscall.c we can find the following code.
```
#ifdef CONFIG_ARCH_KERNEL_STACK
/* If this is the first SYSCALL and if there is an allocated
* kernel stack, then switch to the kernel stack.
*/
if (index == 0 && rtcb->xcp.kstack != NULL)
{
rtcb->xcp.ustkptr = (FAR uint32_t *)regs[REG_SP];
regs[REG_SP] = (uint32_t)rtcb->xcp.kstack +
ARCH_KERNEL_STACKSIZE;
}
#endif
```
However, if we remove -4 at line 255, I think I should add a separate commit to this PR,
instead of amending the existing commit. What do you think?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510671073
##########
File path: arch/arm/src/armv7-a/arm_assert.c
##########
@@ -265,24 +265,10 @@ static void up_dumpstate(void)
if (sp > istackbase - istacksize && sp < istackbase)
{
- uint32_t *stackbase;
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510786581
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Here is the thing. Nuttx does not support nested interrupt. If a design is super low on memory (it happens) the interrupt stack allocation has to not round down. If know the CONFIG (FPU etc) the size of the int stack is a fixed number . If I ask for That number and get a stack that is less it will over write memory. This will be a debugging nightmare! Please round it UP
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510560007
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
If the intension is aligned up, CONFIG_ARCH_INTERRUPTSTACK> 0 && CONFIG_ARCH_INTERRUPTSTACK < 7 is a correct stack value(even it's crazy that the stack has 8 bytes, but it correct from logic). Yes, as I mention before the key point is to use the alignup or aligndown consistently in all place, but since algindown is use in many place and there isn't real difference between alignup and aligndown, I would prefer to use the aligndown across the related 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511235347
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1096,7 +1096,7 @@ g_intstackbase:
.type g_fiqstackbase, object
g_fiqstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK & ~7) - 4)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510375552
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
@xiaoxiang781216 why would that line be wrong? We use `INTERRUPTSTACK < ALIGN_REQUIREMENT` to mean that there is no interrupt stack. We are not changing `CONFIG_ARCH_INTERRUPTSTACK`.
But yes, when dumping the stack we always use the align down. Not sure why, if we have a consistent INTSTACK_SIZE (whether aligned up or down) wouldn't that suffice?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510671222
##########
File path: arch/arm/src/arm/arm_vectors.S
##########
@@ -132,7 +132,8 @@ arm_vectorirq:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr sp, .Lirqstackbase /* SP = interrupt stack base */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #4 /* Adjust SP (minus 4-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510564978
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -192,7 +192,8 @@ exception_common:
* here prohibits nested interrupts without some additional logic!
*/
- setintstack r2, r3
+ setintstack r2, r3 /* SP = IRQ stack top */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
Review comment:
Yes, but it's right to let sp point to the pass of the end stack, because AAPCS require all stack push must substract sp first before store the value to stack.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 edited a comment on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715328711
> @masayuki2009 @xiaoxiang781216
>
> On the alignment please see the [86400a2](https://github.com/apache/incubator-nuttx/commit/86400a252dcbe6e4aef3ecca000b469a0fe96b67) and the blame. I think in this PR we are reverting a change that fixed a real problem.
from the change, the stack space allocation round to the near(may roundup or rounddown), but the sp always point to the rounddown location. So I can't understand what problem he want to fix without the detail commit message. At least, the change isn't consistent with other related code(init sp and stack check).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510673805
##########
File path: arch/arm/src/armv7-a/arm_assert.c
##########
@@ -265,24 +265,10 @@ static void up_dumpstate(void)
if (sp > istackbase - istacksize && sp < istackbase)
{
- uint32_t *stackbase;
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
Ouss4 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510688666
##########
File path: arch/arm/src/armv7-m/gnu/arm_exception.S
##########
@@ -321,9 +322,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
If `CONFIG_ARCH_INTERRUPTSTACK> 0 && CONFIG_ARCH_INTERRUPTSTACK < 7` we won't align anything since we consider this value as "no interrupt stack".
But I understand and I agree with the rest of what you are saying. We have to be consistent either aligning up or down. BTW, I decided to go with aligning up in my Xtensa PR (#2014)
> Shall we keep this commit (i.e. remove +4) at line 326?
Yes, I think we should keep the commit.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715265904
> Yes, the term usage is strange, but it is an unrelated issue. It's better to create new PR to fix the term issue.
@xiaoxiang781216 Agreed it can be changes in another PR.
> In terms of address, "base" is "top" for a push-down stack, this is what's making things a bit confusing. However, I believe it's used consistently: xx_alloc = bottom and xx_base = top or bottom depending on the stack.
Yes Memory allocations are base that is understood. The other is a visual thing for me. (I was indoctrinated by my first debugger http://www.pestingers.net/pdfs/s100-computers/vector-graphics/vector-raid-man.pdf - I withe there were pics)
I find it incorrect and confusing on descending stack arch.
Please read this with a smile....it it written with one......
Where do we put the lamp shade on a lamp? On the top or the base.
If we hang fly paper from a pole? On the base it hits the floor. On the top it does not, and it grows downward
What is the base address of a UART?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] davids5 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
davids5 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715331077
> > @masayuki2009 @xiaoxiang781216
> > On the alignment please see the [86400a2](https://github.com/apache/incubator-nuttx/commit/86400a252dcbe6e4aef3ecca000b469a0fe96b67) and the blame. I think in this PR we are reverting a change that fixed a real problem.
>
> from the change, the stack space allocation round to the near(may roundup or rounddown), but the sp always point to the rounddown location. So I can't understand what problem he want to fix without the detail commit message.

----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-714427977
> @masayuki2009 Thank you for the PR and all the information on what was done. Would you please add some back ground as to why these changes are needed?
@davids5
Good question!
I forgot to add the most important information on this.
This PR was created based on the discussion at https://github.com/apache/incubator-nuttx/pull/2042.
Anyway thanks for pointing out.
I will add a comment to the PR summary first.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510671156
##########
File path: arch/arm/src/armv7-a/arm_vectors.S
##########
@@ -1004,7 +1005,8 @@ arm_vectorfiq:
#if CONFIG_ARCH_INTERRUPTSTACK > 7
setfiqstack r1, r4 /* SP = FIQ stack top */
- str r0, [sp] /* Save the user stack pointer */
+ sub sp, #8 /* Adjust SP (minus 8-byte offset) */
+ str r0, [sp] /* Save the xcp address */
Review comment:
Done
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715027962
@Ouss4 @xiaoxiang781216
I modified the code and pushed it with -f.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510531250
##########
File path: arch/arm/src/armv6-m/arm_exception.S
##########
@@ -153,6 +153,7 @@ exception_common:
#if CONFIG_ARCH_INTERRUPTSTACK > 3
ldr r7, =g_intstackbase /* R7=Base of the interrupt stack */
+ sub r7, #4 /* Adjust R7 (minus 4-byte offset) */
Review comment:
Thanks!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-716860571
> @masayuki2009 - I have tested this on an M7 and M3 core. AOK!
@davids5
Thanks!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on a change in pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#discussion_r511235795
##########
File path: arch/arm/src/armv7-m/gnu/arm_lazyexception.S
##########
@@ -340,9 +340,9 @@ exception_common:
.bss
.global g_intstackalloc
.global g_intstackbase
- .align 8
+ .balign 8
g_intstackalloc:
- .skip ((CONFIG_ARCH_INTERRUPTSTACK + 4) & ~7)
+ .skip (CONFIG_ARCH_INTERRUPTSTACK & ~7)
Review comment:
OK
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #2061: Refactor arm interrupt stack related code
Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #2061:
URL: https://github.com/apache/incubator-nuttx/pull/2061#issuecomment-715285984
> @masayuki2009 - I have tested this. My only 2 concerns are 1) Not rounding UP (see [#2061 (comment)](https://github.com/apache/incubator-nuttx/pull/2061#discussion_r510786581)), and 2 this change:
>
> 
>
> Would you help me understand if is it correct?
>
> Are we using Descending Empty or Descending Full?
We can't select here, ARM require the descending full stack:
https://static.docs.arm.com/ihi0042/f/IHI0042F_aapcs.pdf
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org