source: rtems-schedsim/schedsim/rtems/wkspace.c @ e5e757b

Last change on this file since e5e757b was b1b31c0, checked in by Jennifer Averett <jennifer.averett@…>, on May 8, 2014 at 2:53:43 PM

schedsim: turn off workspace debug.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  BASED UPON SOURCE IN RTEMS, MODIFIED FOR SIMULATOR
3 *
4 *  Workspace Handler
5 *
6 *  COPYRIGHT (c) 1989-2013.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
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
22#include <stdlib.h>
23#include <malloc.h>
24
25// #define DEBUG_WORKSPACE
26#if defined(DEBUG_WORKSPACE)
27  #include <stdio.h>
28#endif
29
30/*
31 *  _Workspace_Handler_initialization
32 */
33void _Workspace_Handler_initialization(
34  Heap_Area *areas,
35  size_t area_count,
36  Heap_Initialization_or_extend_handler extend
37)
38{
39}
40
41/*
42 *  _Workspace_Allocate
43 */
44void *_Workspace_Allocate(
45  size_t   size
46)
47{
48  void *memory;
49
50  memory = calloc( 1, size );
51  #if defined(DEBUG_WORKSPACE)
52    fprintf(
53      stderr,
54      "Workspace_Allocate(%d) from %p/%p -> %p\n",
55      size,
56      __builtin_return_address( 0 ),
57      __builtin_return_address( 1 ),
58      memory
59    );
60  #endif
61  return memory;
62}
63
64void *_Workspace_Allocate_aligned( size_t size, size_t alignment )
65{
66  void *memory;
67  int   sc;
68
69  memory = memalign( alignment, size );
70  #if defined(DEBUG_WORKSPACE)
71    fprintf(
72      stderr,
73      "Workspace_Allocate_aligned(%d, %d) from %p/%p -> %p\n",
74      size,
75      alignment,
76      __builtin_return_address( 0 ),
77      __builtin_return_address( 1 ),
78      memory
79    );
80  #endif
81  return memory;
82}
83
84
85/*
86 *  _Workspace_Free
87 */
88void _Workspace_Free(
89  void *block
90)
91{
92  #if defined(DEBUG_WORKSPACE)
93    fprintf(
94      stderr,
95      block,
96      __builtin_return_address( 0 ),
97      __builtin_return_address( 1 )
98    );
99  #endif
100  free( block );
101}
102
103/*
104 *  _Workspace_Allocate_or_fatal_error
105 */
106void *_Workspace_Allocate_or_fatal_error(
107  size_t      size
108)
109{
110  void *memory;
111
112  memory = calloc( 1, size );
113  #if defined(DEBUG_WORKSPACE)
114    fprintf(
115      stderr,
116      "Workspace_Allocate_or_fatal_error(%d) from %p/%p -> %p\n",
117      size,
118      __builtin_return_address( 0 ),
119      __builtin_return_address( 1 ),
120      memory
121    );
122  #endif
123
124  return memory;
125}
Note: See TracBrowser for help on using the repository browser.