diff --git a/arch/arm/src/common/arm_checkstack.c b/arch/arm/src/common/arm_checkstack.c index 87384c56e742b..08dd03a0b4879 100644 --- a/arch/arm/src/common/arm_checkstack.c +++ b/arch/arm/src/common/arm_checkstack.c @@ -168,12 +168,13 @@ void arm_stack_color(FAR void *stackbase, size_t nbytes) uintptr_t end; size_t nwords; FAR uint32_t *ptr; + uintptr_t sp; /* Take extra care that we do not write outside the stack boundaries */ start = INT32_ALIGN_UP((uintptr_t)stackbase); end = nbytes ? INT32_ALIGN_DOWN((uintptr_t)stackbase + nbytes) : - up_getsp(); /* 0: colorize the running stack */ + (uintptr_t)&sp; /* 0: colorize the running stack */ /* Get the adjusted size based on the top and bottom of the stack */ diff --git a/arch/ceva/src/common/up_createstack.c b/arch/ceva/src/common/up_createstack.c index 1eab7ad0d9c29..d0ba7d28ac006 100644 --- a/arch/ceva/src/common/up_createstack.c +++ b/arch/ceva/src/common/up_createstack.c @@ -232,10 +232,15 @@ void up_stack_color(FAR void *stackbase, size_t nbytes) { /* Take extra care that we do not write outsize the stack boundaries */ - uint32_t *stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~3); - uintptr_t stkend = nbytes ? (((uintptr_t)stackbase + nbytes) & ~3) : - up_getsp(); /* 0: colorize the running stack */ - size_t nwords = (stkend - (uintptr_t)stackbase) >> 2; + uint32_t *stkptr; + uintptr_t stkend; + size_t nwords; + uintptr_t sp; + + stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~3); + stkend = nbytes ? (((uintptr_t)stackbase + nbytes) & ~3) : + (uintptr_t)&sp; /* 0: colorize the running stack */ + nwords = (stkend - (uintptr_t)stackbase) >> 2; /* Set the entire stack to the coloration value */ diff --git a/arch/or1k/src/common/up_createstack.c b/arch/or1k/src/common/up_createstack.c index b65531b760c9b..731c5b64b00fb 100644 --- a/arch/or1k/src/common/up_createstack.c +++ b/arch/or1k/src/common/up_createstack.c @@ -205,10 +205,15 @@ void up_stack_color(FAR void *stackbase, size_t nbytes) { /* Take extra care that we do not write outsize the stack boundaries */ - uint32_t *stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~3); - uintptr_t stkend = nbytes ? (((uintptr_t)stackbase + nbytes) & ~3) : - up_getsp(); /* 0: colorize the running stack */ - size_t nwords = (stkend - (uintptr_t)stackbase) >> 2; + uint32_t *stkptr; + uintptr_t stkend; + size_t nwords; + uintptr_t sp; + + stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~3); + stkend = nbytes ? (((uintptr_t)stackbase + nbytes) & ~3) : + (uintptr_t)&sp; /* 0: colorize the running stack */ + nwords = (stkend - (uintptr_t)stackbase) >> 2; /* Set the entire stack to the coloration value */ diff --git a/arch/risc-v/src/common/riscv_createstack.c b/arch/risc-v/src/common/riscv_createstack.c index 29dd8b96a6897..d8a27bcb4295f 100644 --- a/arch/risc-v/src/common/riscv_createstack.c +++ b/arch/risc-v/src/common/riscv_createstack.c @@ -217,12 +217,13 @@ void riscv_stack_color(void *stackbase, size_t nbytes) uintptr_t end; size_t nwords; uint32_t *ptr; + uintptr_t sp; /* Take extra care that we do not write outside the stack boundaries */ start = STACK_ALIGN_UP((uintptr_t)stackbase); end = nbytes ? STACK_ALIGN_DOWN((uintptr_t)stackbase + nbytes) : - up_getsp(); /* 0: colorize the running stack */ + (uintptr_t)&sp; /* 0: colorize the running stack */ /* Get the adjusted size based on the top and bottom of the stack */ diff --git a/arch/sim/src/sim/up_createstack.c b/arch/sim/src/sim/up_createstack.c index 6e540afd37696..71381f3b29850 100644 --- a/arch/sim/src/sim/up_createstack.c +++ b/arch/sim/src/sim/up_createstack.c @@ -161,10 +161,15 @@ void nostackprotect_function up_stack_color(FAR void *stackbase, { /* Take extra care that we do not write outsize the stack boundaries */ - uint32_t *stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~3); - uintptr_t stkend = nbytes ? (((uintptr_t)stackbase + nbytes) & ~3) : - up_getsp(); /* 0: colorize the running stack */ - size_t nwords = (stkend - (uintptr_t)stackbase) >> 2; + uint32_t *stkptr; + uintptr_t stkend; + size_t nwords; + uintptr_t sp; + + stkptr = (uint32_t *)(((uintptr_t)stackbase + 3) & ~3); + stkend = nbytes ? (((uintptr_t)stackbase + nbytes) & ~3) : + (uintptr_t)&sp; /* 0: colorize the running stack */ + nwords = (stkend - (uintptr_t)stackbase) >> 2; /* Set the entire stack to the coloration value */ diff --git a/arch/sparc/src/common/up_checkstack.c b/arch/sparc/src/common/up_checkstack.c index b2302683e4bf1..b1d9cca52046a 100644 --- a/arch/sparc/src/common/up_checkstack.c +++ b/arch/sparc/src/common/up_checkstack.c @@ -169,12 +169,13 @@ void up_stack_color(FAR void *stackbase, size_t nbytes) uintptr_t end; size_t nwords; FAR uint32_t *ptr; + uintptr_t sp; /* Take extra care that we do not write outside the stack boundaries */ start = INT32_ALIGN_UP((uintptr_t)stackbase); end = nbytes ? INT32_ALIGN_DOWN((uintptr_t)stackbase + nbytes) : - up_getsp(); /* 0: colorize the running stack */ + (uintptr_t)&sp; /* 0: colorize the running stack */ /* Get the adjusted size based on the top and bottom of the stack */ diff --git a/arch/xtensa/src/common/xtensa_createstack.c b/arch/xtensa/src/common/xtensa_createstack.c index 4dc601d227f58..aeea6c2c8aabb 100644 --- a/arch/xtensa/src/common/xtensa_createstack.c +++ b/arch/xtensa/src/common/xtensa_createstack.c @@ -223,12 +223,13 @@ void xtensa_stack_color(void *stackbase, size_t nbytes) uintptr_t end; size_t nwords; uint32_t *ptr; + uintptr_t sp; /* Take extra care that we do not write outside the stack boundaries */ start = STACK_ALIGN_UP((uintptr_t)stackbase); end = nbytes ? STACK_ALIGN_DOWN((uintptr_t)stackbase + nbytes) : - up_getsp(); /* 0: colorize the running stack */ + (uintptr_t)&sp; /* 0: colorize the running stack */ /* Get the adjusted size based on the top and bottom of the stack */