Changeset 7 for trunk/kernel/mm/ppm.h
- Timestamp:
- Apr 26, 2017, 2:15:50 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/ppm.h
r1 r7 35 35 36 36 /***************************************************************************************** 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_s41 {42 list_entry_t root; // root of the list43 uint32_t pages_nr; // number of blocks44 }45 buddy_list_t;46 47 /*****************************************************************************************48 37 * This structure defines the Physical Memory Manager in a cluster. 49 38 * In all clusters, the physical memory bank starts at address 0. … … 51 40 * The physical page descriptors array is implemented just after this offset zone. 52 41 * 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. 54 44 ****************************************************************************************/ 55 45 typedef struct ppm_s … … 71 61 /***************************************************************************************** 72 62 * 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. 74 64 * The physical memory size is NOT constrained to be smaller than 4 Gbytes. 65 ***************************************************************************************** 75 66 * @ ppm : pointer on physical pages manager. 76 67 * @ pages_nr : total physical memory size (number of 4 Kbytes pages). … … 86 77 * In normal use, you don't need to call it directly, as the recommanded way to get 87 78 * physical pages is to call the generic allocator defined in kmem.h. 79 ***************************************************************************************** 88 80 * @ order : ln2( number of 4 Kbytes pages) 89 81 * @ returns a pointer on the page descriptor if success / NULL otherwise … … 95 87 * In normal use, you do not need to call it directly, as the recommanded way to free 96 88 * physical pages is to call the generic allocator defined in kmem.h. 89 ***************************************************************************************** 97 90 * @ page : pointer to the page descriptor to be released 98 91 ****************************************************************************************/ … … 101 94 /***************************************************************************************** 102 95 * This function check if a page descriptor is valid. 96 ***************************************************************************************** 103 97 * @ page : pointer on a page descriptor 104 98 * @ returns true if valid / false otherwise. … … 108 102 /***************************************************************************************** 109 103 * Get the page base address from the page descriptor pointer. 104 ***************************************************************************************** 110 105 * @ page : pointer to page descriptor 111 106 * @ returns page base address … … 115 110 /***************************************************************************************** 116 111 * Get the page descriptor pointer from the page base address. 112 ***************************************************************************************** 117 113 * @ vaddr : page base address 118 114 * @ returns pointer on page descriptor … … 122 118 /***************************************************************************************** 123 119 * Get the PPN from the page descriptor pointer. 120 ***************************************************************************************** 124 121 * @ page : pointer to page descriptor 125 122 * @ returns physical page number … … 129 126 /***************************************************************************************** 130 127 * Get the page descriptor pointer from the PPN. 128 ***************************************************************************************** 131 129 * @ ppn : physical page number 132 130 * @ returns pointer on page descriptor … … 136 134 /***************************************************************************************** 137 135 * Get the page base address from the PPN. 136 ***************************************************************************************** 138 137 * @ ppn : physical page number 139 138 * @ returns page base address … … 143 142 /***************************************************************************************** 144 143 * Get the PPN from the page base address. 144 ***************************************************************************************** 145 145 * @ vaddr : page base address 146 146 * @ returns physical page number … … 150 150 /***************************************************************************************** 151 151 * This function prints the PPM allocator status. 152 ***************************************************************************************** 152 153 * @ ppm : pointer on PPM allocator. 154 * @ string : define context of display. 153 155 ****************************************************************************************/ 154 void ppm_print( ppm_t * ppm ); 156 void ppm_print( ppm_t * ppm, 157 char * string ); 155 158 156 159 /***************************************************************************************** 157 160 * This function checks PPM allocator consistency. 161 ***************************************************************************************** 158 162 * @ ppm : pointer on PPM allocator. 159 163 ****************************************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.