diff --git a/arch/arm/src/common/arm_stackframe.c b/arch/arm/src/common/arm_stackframe.c index a4285f8eb8..a564a4fe5d 100644 --- a/arch/arm/src/common/arm_stackframe.c +++ b/arch/arm/src/common/arm_stackframe.c @@ -111,8 +111,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -126,8 +124,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -136,5 +133,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/avr/src/avr/up_stackframe.c b/arch/avr/src/avr/up_stackframe.c index 821d2411cd..b23860e8cf 100644 --- a/arch/avr/src/avr/up_stackframe.c +++ b/arch/avr/src/avr/up_stackframe.c @@ -99,7 +99,9 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; + /* Align the frame_size */ + + frame_size = STACK_ALIGN_UP(frame_size); /* Is there already a stack allocated? Is it big enough? */ @@ -110,8 +112,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Set the initial stack pointer to the "base" of the allocated stack */ @@ -121,5 +122,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint8_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/avr/src/avr32/up_stackframe.c b/arch/avr/src/avr32/up_stackframe.c index 168de8e665..d4a546058e 100644 --- a/arch/avr/src/avr32/up_stackframe.c +++ b/arch/avr/src/avr32/up_stackframe.c @@ -111,8 +111,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -126,8 +124,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -136,5 +133,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/hc/src/common/up_stackframe.c b/arch/hc/src/common/up_stackframe.c index b022dc8251..d3b767fe00 100644 --- a/arch/hc/src/common/up_stackframe.c +++ b/arch/hc/src/common/up_stackframe.c @@ -111,8 +111,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -126,8 +124,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -137,5 +134,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint16_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/mips/src/common/mips_stackframe.c b/arch/mips/src/common/mips_stackframe.c index 7c0185be16..e545456d13 100644 --- a/arch/mips/src/common/mips_stackframe.c +++ b/arch/mips/src/common/mips_stackframe.c @@ -114,8 +114,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -129,8 +127,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -139,5 +136,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/misoc/src/lm32/lm32_stackframe.c b/arch/misoc/src/lm32/lm32_stackframe.c index 0791201b4e..c436f5aa42 100644 --- a/arch/misoc/src/lm32/lm32_stackframe.c +++ b/arch/misoc/src/lm32/lm32_stackframe.c @@ -107,8 +107,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -122,8 +120,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -132,5 +129,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/misoc/src/minerva/minerva_stackframe.c b/arch/misoc/src/minerva/minerva_stackframe.c index fb56a226bc..ba8b5cbda4 100644 --- a/arch/misoc/src/minerva/minerva_stackframe.c +++ b/arch/misoc/src/minerva/minerva_stackframe.c @@ -107,8 +107,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -122,8 +120,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t) tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -132,5 +129,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/or1k/src/common/up_stackframe.c b/arch/or1k/src/common/up_stackframe.c index ca53256418..9ccae0d984 100644 --- a/arch/or1k/src/common/up_stackframe.c +++ b/arch/or1k/src/common/up_stackframe.c @@ -103,8 +103,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -118,8 +116,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -128,5 +125,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/renesas/src/common/up_stackframe.c b/arch/renesas/src/common/up_stackframe.c index c61f17af91..32776096f9 100644 --- a/arch/renesas/src/common/up_stackframe.c +++ b/arch/renesas/src/common/up_stackframe.c @@ -109,8 +109,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -124,8 +122,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial state */ @@ -134,5 +131,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return a pointer to allocated memory */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/risc-v/src/common/riscv_stackframe.c b/arch/risc-v/src/common/riscv_stackframe.c index 5478cad760..099c97d9a4 100644 --- a/arch/risc-v/src/common/riscv_stackframe.c +++ b/arch/risc-v/src/common/riscv_stackframe.c @@ -114,8 +114,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -129,8 +127,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -139,5 +136,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr); + return tcb->adj_stack_ptr; } diff --git a/arch/sim/src/sim/up_stackframe.c b/arch/sim/src/sim/up_stackframe.c index 7458ed21ec..f23fec5503 100644 --- a/arch/sim/src/sim/up_stackframe.c +++ b/arch/sim/src/sim/up_stackframe.c @@ -103,8 +103,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -118,8 +116,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial state */ @@ -128,5 +125,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return a pointer to the allocated memory */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/x86/src/i486/up_stackframe.c b/arch/x86/src/i486/up_stackframe.c index b9eebd9cfd..4d41b5b4c7 100644 --- a/arch/x86/src/i486/up_stackframe.c +++ b/arch/x86/src/i486/up_stackframe.c @@ -112,8 +112,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -127,8 +125,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -137,5 +134,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/x86_64/src/intel64/up_stackframe.c b/arch/x86_64/src/intel64/up_stackframe.c index e8bcea4958..b8256de41d 100644 --- a/arch/x86_64/src/intel64/up_stackframe.c +++ b/arch/x86_64/src/intel64/up_stackframe.c @@ -97,8 +97,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -112,8 +110,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -122,6 +119,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint64_t)); + return tcb->adj_stack_ptr; } - diff --git a/arch/xtensa/src/common/xtensa_stackframe.c b/arch/xtensa/src/common/xtensa_stackframe.c index e00ba6b63a..3e88f51d37 100644 --- a/arch/xtensa/src/common/xtensa_stackframe.c +++ b/arch/xtensa/src/common/xtensa_stackframe.c @@ -106,8 +106,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -121,8 +119,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer (A1) */ @@ -131,5 +128,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return the pointer to the allocated region */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/z16/src/common/z16_stackframe.c b/arch/z16/src/common/z16_stackframe.c index 0b6a20e157..a42170470c 100644 --- a/arch/z16/src/common/z16_stackframe.c +++ b/arch/z16/src/common/z16_stackframe.c @@ -88,8 +88,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -103,8 +101,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial stack pointer */ @@ -113,5 +110,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return a pointer to the allocated memory */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; } diff --git a/arch/z80/src/common/z80_stackframe.c b/arch/z80/src/common/z80_stackframe.c index 5c0c20ece5..d01d937034 100644 --- a/arch/z80/src/common/z80_stackframe.c +++ b/arch/z80/src/common/z80_stackframe.c @@ -87,8 +87,6 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { - uintptr_t topaddr; - /* Align the frame_size */ frame_size = STACK_ALIGN_UP(frame_size); @@ -102,8 +100,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* Save the adjusted stack values in the struct tcb_s */ - topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size; - tcb->adj_stack_ptr = (FAR void *)topaddr; + tcb->adj_stack_ptr = (uint8_t *)tcb->adj_stack_ptr - frame_size; tcb->adj_stack_size -= frame_size; /* Reset the initial state */ @@ -112,5 +109,5 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) /* And return a pointer to the allocated memory */ - return (FAR void *)(topaddr + sizeof(uint32_t)); + return tcb->adj_stack_ptr; }