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

Last change on this file since 466 was 466, checked in by alain, 10 years ago

1) Introducing a hierarchical, distributed lock, implemented as a

Sliced Binary Tree (sbt_lock_t) in the locks.c and locks.h files.

2) Introducing a kernel level distributed, remote_malloc() service,

In the kernel_malloc.c and kernel_malloc.h files.
This service requires one heap[x][y] global vseg per cluster.
This service is used by the distributed lock.

  • Property svn:executable set to *
File size: 2.1 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 "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   x;               // cluster X coordinate
28    unsigned int   y;               // cluster Y coordinate
29    unsigned int   heap_base;       // heap base address
30    unsigned int   heap_size;       // heap 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* _remote_malloc( unsigned int size, 
46                             unsigned int x,
47                             unsigned int y );
48
49extern void _heap_init();
50
51
52#endif
53
54// Local Variables:
55// tab-width: 4
56// c-basic-offset: 4
57// c-file-offsets:((innamespace . 0)(inline-open . 0))
58// indent-tabs-mode: nil
59// End:
60// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
61
Note: See TracBrowser for help on using the repository browser.