Lines Matching refs:stack
29 * Kernel stack management routines.
70 static unsigned int stack_new_count; /* total new stack allocations */
75 * The next field is at the base of the stack,
78 #define stack_next(stack) \
79 (*((vm_offset_t *)((stack) + KERNEL_STACK_SIZE) - 1))
87 panic("stack_init: stack size %d not a multiple of page size %d\n", KERNEL_STACK_SIZE, PAGE_SIZE);
95 * Allocate a stack for a thread, may
102 vm_offset_t stack;
110 stack = stack_free_list;
111 if (stack != 0) {
112 stack_free_list = stack_next(stack);
124 if (stack == 0) {
127 * Request guard pages on either side of the stack. Ask
133 if (kernel_memory_allocate(kernel_map, &stack,
141 * The stack address that comes back is the address of the lower
142 * guard page. Skip past it to get the actual stack base address.
145 stack += PAGE_SIZE;
148 machine_stack_attach(thread, stack);
154 * Detach and free the stack for a thread.
160 vm_offset_t stack = machine_stack_detach(thread);
162 assert(stack);
163 if (stack != thread->reserved_stack)
164 stack_free_stack(stack);
169 vm_offset_t stack)
177 stack_next(stack) = cache->free;
178 cache->free = stack;
183 stack_next(stack) = stack_free_list;
184 stack_free_list = stack;
197 * stack for a thread.
208 vm_offset_t stack;
211 stack = cache->free;
212 if (stack != 0) {
213 cache->free = stack_next(stack);
219 stack = stack_free_list;
220 if (stack != 0) {
221 stack_free_list = stack_next(stack);
229 if (stack != 0 || (stack = thread->reserved_stack) != 0) {
230 machine_stack_attach(thread, stack);
250 vm_offset_t stack;
260 stack = stack_free_list;
261 stack_free_list = stack_next(stack);
267 * Get the stack base address, then decrement by one page
270 * that were originally requested when the stack was allocated
274 stack = vm_map_trunc_page(stack);
275 stack -= PAGE_SIZE;
278 stack,
279 stack + KERNEL_STACK_SIZE+(2*PAGE_SIZE),
283 stack = 0;
305 * Limits stack collection to once per
368 * Return info on stack usage for threads in a specific processor set