@@ -120,26 +120,6 @@ extern "C" {
120120 1 << (31 - __builtin_clz(x) + 1) : \
121121 1 << (31 - __builtin_clz(x)))
122122
123- /**
124- * @brief Declare a top level thread stack memory region
125- *
126- * This declares a region of memory suitable for use as a thread's stack.
127- *
128- * This is the generic, historical definition. Align to STACK_ALIGN_SIZE and
129- * put in * 'noinit' section so that it isn't zeroed at boot
130- *
131- * The declared symbol will always be a character array which can be passed to
132- * k_thread_create, but should otherwise not be manipulated.
133- *
134- * It is legal to precede this definition with the 'static' keyword.
135- *
136- * It is NOT legal to take the sizeof(sym) and pass that to the stackSize
137- * parameter of k_thread_create(), it may not be the same as the
138- * 'size' parameter. Use K_THREAD_STACK_SIZEOF() instead.
139- *
140- * @param sym Thread stack symbol name
141- * @param size Size of the stack memory region
142- */
143123#if defined(CONFIG_USERSPACE ) && \
144124 defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT )
145125#define Z_ARCH_THREAD_STACK_DEFINE (sym , size ) \
@@ -151,36 +131,13 @@ extern "C" {
151131 sym[size+MPU_GUARD_ALIGN_AND_SIZE]
152132#endif
153133
154- /**
155- * @brief Calculate size of stacks to be allocated in a stack array
156- *
157- * This macro calculates the size to be allocated for the stacks
158- * inside a stack array. It accepts the indicated "size" as a parameter
159- * and if required, pads some extra bytes (e.g. for MPU scenarios). Refer
160- * K_THREAD_STACK_ARRAY_DEFINE definition to see how this is used.
161- *
162- * @param size Size of the stack memory region
163- */
164134#if defined(CONFIG_USERSPACE ) && \
165135 defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT )
166136#define Z_ARCH_THREAD_STACK_LEN (size ) (POW2_CEIL(size))
167137#else
168138#define Z_ARCH_THREAD_STACK_LEN (size ) ((size)+MPU_GUARD_ALIGN_AND_SIZE)
169139#endif
170140
171- /**
172- * @brief Declare a top level array of thread stack memory regions
173- *
174- * Create an array of equally sized stacks. See K_THREAD_STACK_DEFINE
175- * definition for additional details and constraints.
176- *
177- * This is the generic, historical definition. Align to STACK_ALIGN_SIZE and
178- * put in * 'noinit' section so that it isn't zeroed at boot
179- *
180- * @param sym Thread stack symbol name
181- * @param nmemb Number of stacks to declare
182- * @param size Size of the stack memory region
183- */
184141#if defined(CONFIG_USERSPACE ) && \
185142 defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT )
186143#define Z_ARCH_THREAD_STACK_ARRAY_DEFINE (sym , nmemb , size ) \
@@ -194,18 +151,6 @@ extern "C" {
194151 sym[nmemb][Z_ARCH_THREAD_STACK_LEN(size)]
195152#endif
196153
197- /**
198- * @brief Declare an embedded stack memory region
199- *
200- * Used for stacks embedded within other data structures. Use is highly
201- * discouraged but in some cases necessary. For memory protection scenarios,
202- * it is very important that any RAM preceding this member not be writable
203- * by threads else a stack overflow will lead to silent corruption. In other
204- * words, the containing data structure should live in RAM owned by the kernel.
205- *
206- * @param sym Thread stack symbol name
207- * @param size Size of the stack memory region
208- */
209154#if defined(CONFIG_USERSPACE ) && \
210155 defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT )
211156#define Z_ARCH_THREAD_STACK_MEMBER (sym , size ) \
@@ -217,42 +162,8 @@ extern "C" {
217162 sym[size+MPU_GUARD_ALIGN_AND_SIZE]
218163#endif
219164
220- /**
221- * @brief Return the size in bytes of a stack memory region
222- *
223- * Convenience macro for passing the desired stack size to k_thread_create()
224- * since the underlying implementation may actually create something larger
225- * (for instance a guard area).
226- *
227- * The value returned here is guaranteed to match the size of the stack that
228- * is available for the thread, i.e. excluding the size of areas that are not
229- * to be used (for instance the guard area).
230- *
231- * The value returned here is NOT guaranteed to match the 'size' parameter
232- * passed to K_THREAD_STACK_DEFINE and related macros.
233- *
234- * In the case of CONFIG_USERSPACE=y and
235- * CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT=y, the returned size will be
236- * smaller than the requested 'size'.
237- *
238- * In all other configurations, the size will be correct.
239- *
240- * @param sym Stack memory symbol
241- * @return Actual size of the stack available for the thread
242- */
243165#define Z_ARCH_THREAD_STACK_SIZEOF (sym ) (sizeof(sym) - MPU_GUARD_ALIGN_AND_SIZE)
244166
245- /**
246- * @brief Get a pointer to the physical stack buffer
247- *
248- * Convenience macro to get at the real underlying stack buffer used by
249- * the CPU. Guaranteed to be a character pointer of size K_THREAD_STACK_SIZEOF.
250- * This is really only intended for diagnostic tools which want to examine
251- * stack memory contents.
252- *
253- * @param sym Declared stack symbol name
254- * @return The buffer itself, a char *
255- */
256167#define Z_ARCH_THREAD_STACK_BUFFER (sym ) \
257168 ((char *)(sym) + MPU_GUARD_ALIGN_AND_SIZE)
258169
0 commit comments