Changeset 7 for trunk/kernel/mm/ppm.h


Ignore:
Timestamp:
Apr 26, 2017, 2:15:50 PM (7 years ago)
Author:
alain
Message:

Various bugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/ppm.h

    r1 r7  
    3535
    3636/*****************************************************************************************
    37  * This structure defines the list of blocks of a given size for the "buddy"
    38  * allocation algorithm implemented by the ppm_t manager.
    39  ****************************************************************************************/
    40 typedef struct buddy_list_s
    41 {
    42         list_entry_t  root;       // root of the list
    43         uint32_t      pages_nr;   // number of blocks
    44 }
    45 buddy_list_t;
    46 
    47 /*****************************************************************************************
    4837 * This structure defines the Physical Memory Manager in a cluster.
    4938 * In all clusters, the physical memory bank starts at address 0.
     
    5140 * The physical page descriptors array is implemented just after this offset zone.
    5241 * The main service provided by the PMM is the dynamic allocation of physical pages.
    53  * This low-level allocator implements the buddy algorithm.
     42 * This low-level allocator implements the buddy algorithm: an allocated block is
     43 * is an integer number n of 4 Kbytes pages, and n (called order) is a power of 2.
    5444 ****************************************************************************************/
    5545typedef struct ppm_s
     
    7161/*****************************************************************************************
    7262 * This function initializes a PPM (Physical Pages Manager) in a cluster.
    73  * The physical memory base address in all cluster is zero.
     63 * The physical memory base address in all clusters is zero.
    7464 * The physical memory size is NOT constrained to be smaller than 4 Gbytes.
     65 *****************************************************************************************
    7566 * @ ppm          : pointer on physical pages manager.
    7667 * @ pages_nr     : total physical memory size (number of 4 Kbytes pages).
     
    8677 * In normal use, you don't need to call it directly, as the recommanded way to get
    8778 * physical pages is to call the generic allocator defined in kmem.h.
     79 *****************************************************************************************
    8880 * @ order        : ln2( number of 4 Kbytes pages)
    8981 * @ returns a pointer on the page descriptor if success / NULL otherwise
     
    9587 * In normal use, you do not need to call it directly, as the recommanded way to free
    9688 * physical pages is to call the generic allocator defined in kmem.h.
     89 *****************************************************************************************
    9790 * @ page         : pointer to the page descriptor to be released
    9891 ****************************************************************************************/
     
    10194/*****************************************************************************************
    10295 * This function check if a page descriptor is valid.
     96 *****************************************************************************************
    10397 * @ page         : pointer on a page descriptor
    10498 * @ returns true if valid / false otherwise.
     
    108102/*****************************************************************************************
    109103 * Get the page base address from the page descriptor pointer.
     104 *****************************************************************************************
    110105 * @ page         : pointer to page descriptor
    111106 * @ returns page base address
     
    115110/*****************************************************************************************
    116111 * Get the page descriptor pointer from the page base address.
     112 *****************************************************************************************
    117113 * @ vaddr        : page base address
    118114 * @ returns pointer on page descriptor
     
    122118/*****************************************************************************************
    123119 * Get the PPN from the page descriptor pointer.
     120 *****************************************************************************************
    124121 * @ page         : pointer to page descriptor
    125122 * @ returns physical page number
     
    129126/*****************************************************************************************
    130127 * Get the page descriptor pointer from the PPN.
     128 *****************************************************************************************
    131129 * @ ppn          : physical page number
    132130 * @ returns pointer on page descriptor
     
    136134/*****************************************************************************************
    137135 * Get the page base address from the PPN.
     136 *****************************************************************************************
    138137 * @ ppn          : physical page number
    139138 * @ returns page base address
     
    143142/*****************************************************************************************
    144143 * Get the PPN from the page base address.
     144 *****************************************************************************************
    145145 * @ vaddr        : page base address
    146146 * @ returns physical page number
     
    150150/*****************************************************************************************
    151151 * This function prints the PPM allocator status.
     152 *****************************************************************************************
    152153 * @ ppm      : pointer on PPM allocator.
     154 * @ string   : define context of display.
    153155 ****************************************************************************************/
    154 void ppm_print( ppm_t * ppm );
     156void ppm_print( ppm_t * ppm,
     157                char  * string );
    155158
    156159/*****************************************************************************************
    157160 * This function checks PPM allocator consistency.
     161 *****************************************************************************************
    158162 * @ ppm      : pointer on PPM allocator.
    159163 ****************************************************************************************/
Note: See TracChangeset for help on using the changeset viewer.