source: soft/giet_vm/giet_common/kernel_malloc.h @ 817

Last change on this file since 817 was 754, checked in by cfuguet, 8 years ago
  • Support to have a single terminal (NB_TTY_CHANNEL = 1). In this case, the terminal is shared by the system and the applications.
  • Support platforms without NIC and CMA.
  • In the MMC driver, do not initialize the distributed driver structure in clusters without memory cache (IO clusters in the LETI platform).
  • Property svn:executable set to *
File size: 2.4 KB
Line 
1//////////////////////////////////////////////////////////////////////////////////
2// File     : kernel_malloc.h
3// Date     : 05/12/2014
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6//////////////////////////////////////////////////////////////////////////////////
7// The kernel_malloc.c and kernel_malloc.h files are part of the giet_vm kernel.
8//////////////////////////////////////////////////////////////////////////////////
9
10#ifndef KERNEL_MALLOC_H_
11#define KERNEL_MALLOC_H_
12
13#include "kernel_locks.h"
14#include "hard_config.h"
15
16
17#define MIN_BLOCK_SIZE      0x40
18
19
20//////////////////////////////////////////////////////////////////////////////////
21//             heap descriptor (one per cluster)
22//////////////////////////////////////////////////////////////////////////////////
23
24typedef struct kernel_heap_s
25{
26    spin_lock_t    lock;            // lock protecting exclusive access
27    unsigned int   heap_base;       // heap base address
28    unsigned int   heap_size;       // heap size (bytes)
29    unsigned int   alloc_base;      // alloc[] array base address
30    unsigned int   alloc_size;      // alloc[] array size (bytes)
31    unsigned int   free[32];        // array of base addresses of free blocks
32                                    // (address of first block of a given size)
33} kernel_heap_t;
34
35//////////////////////////////////////////////////////////////////////////////////
36//             global variables
37//////////////////////////////////////////////////////////////////////////////////
38
39extern kernel_heap_t  kernel_heap[X_SIZE][Y_SIZE];
40
41//////////////////////////////////////////////////////////////////////////////////
42//  access functions
43//////////////////////////////////////////////////////////////////////////////////
44
45extern void* _malloc( unsigned int size );
46
47extern void* _remote_malloc( unsigned int size, 
48                             unsigned int x,
49                             unsigned int y );
50
51extern void _free( void* ptr );
52
53extern void _heap_init();
54
55extern unsigned int _get_heap_info( unsigned int* heap_base,
56                             unsigned int* heap_size,
57                             unsigned int  x,
58                             unsigned int  y );
59
60
61#endif
62
63// Local Variables:
64// tab-width: 4
65// c-basic-offset: 4
66// c-file-offsets:((innamespace . 0)(inline-open . 0))
67// indent-tabs-mode: nil
68// End:
69// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
70
Note: See TracBrowser for help on using the repository browser.