Ignore:
Timestamp:
Jul 8, 2015, 3:40:18 PM (9 years ago)
Author:
alain
Message:

1) Fix a bug in the free() function in the malloc.c
2) Introduce new syscalls to access the FAT in stdio.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_libs/malloc.h

    r550 r588  
    1414//   to MIN_BLOCK_SIZE (typically 128 bytes).
    1515// - All free blocks are aligned.
    16 // - They are pre-classed in NB_SIZES linked lists, where all blocks in the
    17 //   same list have the same size.
     16// - They are pre-classed in NB_SIZES linked lists, where all blocks in a
     17//   given list have the same size.
    1818// - The NEXT pointer implementing those linked lists is written
    1919//   in the 4 first bytes of the block itself, using the unsigned int type.
     
    4040// - This allocation policy has the nice following property:
    4141//   If the heap segment is aligned (the heap_base is a multiple of the
    42 //   heap_base), all allocated blocks are aligned on the actual_size.
     42//   heap_size), all allocated blocks are aligned on the actual_size.
    4343////////////////////////////////////////////////////////////////////////////////
    4444// Free policy:
     
    5252// - The index in this array is computed from the allocated block base address:
    5353//      index = (block_base - heap_base) / MIN_BLOCK_SIZE
    54 // - The allocated[] array is stored at the end of heap segment. This consume
     54// - The alloc[] array is stored at the end of heap segment. This consume
    5555//   (1 / MIN_BLOCK_SIZE) of the total heap storage capacity.
    5656////////////////////////////////////////////////////////////////////////////////
     
    7373// heap(x,y) descriptor (one per cluster)
    7474////////////////////////////////////////////////////////////////////////////////
     75
    7576typedef struct giet_heap_s
    7677{
     78    user_lock_t    lock;            // lock protecting exclusive access
    7779    unsigned int   init;            // initialised <=> value == HEAP_INITIALIZED
    7880    unsigned int   x;               // cluster X coordinate
     
    8284    unsigned int   alloc_base;      // alloc[] array base address
    8385    unsigned int   alloc_size;      // alloc[] array size (bytes)
    84     user_lock_t    lock;            // lock protecting exclusive access
    8586    unsigned int   free[32];        // array of base addresses of free blocks
    8687                                    // (address of first block of a given size)
Note: See TracChangeset for help on using the changeset viewer.