source:
rtems/cpukit/score/src/threadstackallocate.c
@
25f5730f
Last change on this file since 25f5730f was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47 | |
---|---|
|
|
File size: 949 bytes |
Rev | Line | |
---|---|---|
[bf54252] | 1 | /** |
2 | * @file | |
3 | * | |
4 | * @brief Stack Allocate Helper | |
5 | * @ingroup ScoreThread | |
6 | */ | |
7 | ||
8 | ||
[05df0a8] | 9 | /* |
[16d7b65] | 10 | * COPYRIGHT (c) 1989-2010. |
[05df0a8] | 11 | * On-Line Applications Research Corporation (OAR). |
12 | * | |
13 | * The license and distribution terms for this file may be | |
[dcf3687] | 14 | * found in the file LICENSE in this distribution or at |
[c499856] | 15 | * http://www.rtems.org/license/LICENSE. |
[05df0a8] | 16 | */ |
17 | ||
[a8eed23] | 18 | #if HAVE_CONFIG_H |
19 | #include "config.h" | |
20 | #endif | |
21 | ||
[5618c37a] | 22 | #include <rtems/score/threadimpl.h> |
[218286bc] | 23 | #include <rtems/score/stackimpl.h> |
[976162a6] | 24 | #include <rtems/config.h> |
[05df0a8] | 25 | |
[728a0bd3] | 26 | size_t _Thread_Stack_Allocate( |
[05df0a8] | 27 | Thread_Control *the_thread, |
[728a0bd3] | 28 | size_t stack_size |
[05df0a8] | 29 | ) |
30 | { | |
31 | void *stack_addr = 0; | |
[16d7b65] | 32 | size_t the_stack_size; |
[9fa3cf0d] | 33 | rtems_stack_allocate_hook stack_allocate_hook = |
34 | rtems_configuration_get_stack_allocate_hook(); | |
[05279b84] | 35 | |
[ecf0f4c] | 36 | the_stack_size = _Stack_Ensure_minimum( stack_size ); |
[05279b84] | 37 | |
[9fa3cf0d] | 38 | stack_addr = (*stack_allocate_hook)( the_stack_size ); |
[05279b84] | 39 | |
[05df0a8] | 40 | if ( !stack_addr ) |
[8a4a349e] | 41 | the_stack_size = 0; |
[05279b84] | 42 | |
[05df0a8] | 43 | the_thread->Start.stack = stack_addr; |
[05279b84] | 44 | |
[8a4a349e] | 45 | return the_stack_size; |
[05df0a8] | 46 | } |
Note: See TracBrowser
for help on using the repository browser.