[368] | 1 | ////////////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File : remote_malloc.h |
---|
| 3 | // Date : 01/08/2014 |
---|
| 4 | // Author : alain greiner |
---|
| 5 | // Copyright (c) UPMC-LIP6 |
---|
| 6 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 7 | // The remote_malloc.c and remote_malloc.h files are part of the GIET nano-kernel. |
---|
| 8 | // These files define a very simple user-level memory allocator: |
---|
| 9 | // - There is no free() : an allocated memory block is never released. |
---|
| 10 | // - For each vspace, it can exist one heap[(x,y) per cluster, and the user |
---|
| 11 | // can explicitely select the target cluster(x,y). |
---|
| 12 | // - Each heap(x,y) must be declared as a specific vobj in the mapping. |
---|
| 13 | // - There is no constraint on the requested block size as long as it fit |
---|
| 14 | // in the selected heap. |
---|
| 15 | // - For each requested block, the user can specify an alignment constraint. |
---|
| 16 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 17 | // IMPLEMENTATION NOTE |
---|
| 18 | // As the distributed heap(x,y) are global variables that can be accessed |
---|
| 19 | // concurrently by all tasks of a given vspace, each heap(x,y) is protected |
---|
| 20 | // by a specific lock (defined in remote_malloc.c file. |
---|
| 21 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 22 | |
---|
| 23 | #ifndef _REMOTE_MALLOC_H |
---|
| 24 | #define _REMOTE_MALLOC_H |
---|
| 25 | |
---|
| 26 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 27 | // This function returne the virtual base address of the allocated block. |
---|
| 28 | // - length is the block length (number of bytes). |
---|
| 29 | // - align is the alignment constrain (vbase multiple of Ox1 << align). |
---|
| 30 | // - If (x < X_SIZE) and (y < Y_SIZE), it uses the heap in cluster(x,y). |
---|
| 31 | // - It uses the heap in cluster running the calling task, if x or y are too large. |
---|
| 32 | // The calling task exit with an error message if the request cannot be satisfied. |
---|
| 33 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 34 | extern void* remote_malloc( unsigned int length, |
---|
| 35 | unsigned int align, |
---|
| 36 | unsigned int x, |
---|
| 37 | unsigned int y ); |
---|
| 38 | |
---|
| 39 | #endif |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | // Local Variables: |
---|
| 43 | // tab-width: 4 |
---|
| 44 | // c-basic-offset: 4 |
---|
| 45 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 46 | // indent-tabs-mode: nil |
---|
| 47 | // End: |
---|
| 48 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | |
---|