MCPcopy Create free account
hub / github.com/apache/nuttx / up_stack_frame

Function up_stack_frame

arch/ceva/src/common/ceva_stackframe.c:70–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68 ****************************************************************************/
69
70void *up_stack_frame(struct tcb_s *tcb, size_t frame_size)
71{
72 void *ret;
73
74 /* Align the frame_size */
75
76 frame_size = STACKFRAME_ALIGN_UP(frame_size);
77
78 /* Is there already a stack allocated? Is it big enough? */
79
80 if (!tcb->stack_alloc_ptr || tcb->adj_stack_size < frame_size)
81 {
82 return NULL;
83 }
84
85 /* Save the adjusted stack values in the struct tcb_s */
86
87 ret = tcb->stack_base_ptr;
88 memset(ret, 0, frame_size);
89
90 /* Save the adjusted stack values in the struct tcb_s */
91
92 tcb->stack_base_ptr = (uint8_t *)tcb->stack_base_ptr + frame_size;
93 tcb->adj_stack_size -= frame_size;
94
95 /* And return the pointer to the allocated region */
96
97 return ret;
98}

Callers 1

ceva_forkFunction · 0.70

Calls 1

memsetFunction · 0.50

Tested by

no test coverage detected