source: rtems/cpukit/score/src/wkspace.c @ 976162a6

4.104.114.9
Last change on this file since 976162a6 was 976162a6, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 3, 2007 at 10:23:13 PM

2007-12-03 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/malloc.c, libmisc/monitor/mon-command.c, posix/preinstall.am, posix/include/rtems/posix/cond.h, posix/include/rtems/posix/mqueue.h, posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/pthread.h, posix/include/rtems/posix/semaphore.h, posix/src/conddestroy.c, posix/src/mutexdestroy.c, posix/src/mutexinit.c, posix/src/mutexsetprioceiling.c, posix/src/mutexunlock.c, sapi/include/confdefs.h, sapi/include/rtems/config.h, sapi/include/rtems/init.h, sapi/include/rtems/sptables.h, sapi/src/exinit.c, score/include/rtems/system.h, score/include/rtems/score/mpci.h, score/src/mpci.c, score/src/thread.c, score/src/threadcreateidle.c, score/src/threadstackallocate.c, score/src/threadstackfree.c, score/src/wkspace.c: Moved most of the remaining CPU Table fields to the Configuration Table. This included pretasking_hook, predriver_hook, postdriver_hook, idle_task, do_zero_of_workspace, extra_mpci_receive_server_stack, stack_allocate_hook, and stack_free_hook. As a side-effect of this effort some multiprocessing code was made conditional and some style clean up occurred.
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  Workspace Handler
3 *
4 *  COPYRIGHT (c) 1989-2007.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 *
11 *  $Id$
12 */
13
14#if HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/system.h>
19#include <rtems/score/wkspace.h>
20#include <rtems/score/interr.h>
21#include <rtems/config.h>
22
23#include <string.h>  /* for memset */
24
25/*PAGE
26 *
27 *  _Workspace_Handler_initialization
28 */
29
30void _Workspace_Handler_initialization(
31  void       *starting_address,
32  size_t      size
33)
34{
35  uint32_t    memory_available;
36
37  if ( !starting_address || !_Addresses_Is_aligned( starting_address ) )
38    _Internal_error_Occurred(
39      INTERNAL_ERROR_CORE,
40      TRUE,
41      INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS
42    );
43
44  if ( _Configuration_Table->do_zero_of_workspace )
45   memset( starting_address, 0, size );
46
47  memory_available = _Heap_Initialize(
48    &_Workspace_Area,
49    starting_address,
50    size,
51    CPU_HEAP_ALIGNMENT
52  );
53
54  if ( memory_available == 0 )
55    _Internal_error_Occurred(
56      INTERNAL_ERROR_CORE,
57      TRUE,
58      INTERNAL_ERROR_TOO_LITTLE_WORKSPACE
59    );
60}
61
62/*PAGE
63 *
64 *  _Workspace_Allocate_or_fatal_error
65 *
66 */
67
68void *_Workspace_Allocate_or_fatal_error(
69  size_t      size
70)
71{
72  void        *memory;
73
74  memory = _Workspace_Allocate( size );
75
76  if ( memory == NULL )
77    _Internal_error_Occurred(
78      INTERNAL_ERROR_CORE,
79      TRUE,
80      INTERNAL_ERROR_WORKSPACE_ALLOCATION
81    );
82
83  return memory;
84}
Note: See TracBrowser for help on using the repository browser.