Changeset 23 for trunk/kernel/mm/page.h
- Timestamp:
- Jun 18, 2017, 10:06:41 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/page.h
r22 r23 49 49 #define PG_DIRTY 0x0040 // page has been written 50 50 #define PG_LOCKED 0x0080 // page is locked 51 #define PG_COW 0x0100 // page is copy-on-write 51 52 52 53 #define PG_ALL 0xFFFF // All flags … … 54 55 /************************************************************************************* 55 56 * This structure defines a physical page descriptor. 56 * Size is 6 0bytes for a 32 bits core...57 * Size is 64 bytes for a 32 bits core... 57 58 ************************************************************************************/ 58 59 59 60 typedef struct page_s 60 61 { 61 uint16_t flags; /*! flags defined above (2) */ 62 uint16_t order; /*! log2( number of 4Kbytes pages) (2) */ 63 62 uint32_t flags; /*! flags defined above (4) */ 63 uint32_t order; /*! log2( number of 4Kbytes pages) (4) */ 64 64 struct mapper_s * mapper; /*! local pointer on associated mapper (4) */ 65 65 uint32_t index; /*! page index in mapper (4) */ 66 67 union /*! (4) */68 {69 uint32_t private; /*! TODO ??? [AG] */70 void * data; /*! TODO ??? [AG] */71 slist_entry_t root; /*! TODO ??? [AG] */72 };73 74 66 list_entry_t list; /*! for both dirty pages and free pages (8) */ 75 76 67 xlist_entry_t wait_root; /*! root of list of waiting threads (16) */ 77 78 68 uint32_t refcount; /*! reference counter (4) */ 69 uint32_t fork_nr; /*! number of forked processes (4) */ 79 70 spinlock_t lock; /*! only used to set the PG_LOCKED flag (16) */ 80 71 } … … 83 74 /************************************************************************************* 84 75 * This function initializes one page descriptor. 76 ************************************************************************************* 85 77 * @ page : pointer to page descriptor 86 78 ************************************************************************************/ … … 88 80 89 81 /************************************************************************************* 90 * This function sets one or several flags in page descriptor flags. 82 * This function atomically set one or several flags in page descriptor flags. 83 ************************************************************************************* 91 84 * @ page : pointer to page descriptor. 92 85 * @ value : all non zero bits in value will be set. 93 86 ************************************************************************************/ 94 87 inline void page_set_flag( page_t * page, 95 uint 16_t value );88 uint32_t value ); 96 89 97 90 /************************************************************************************* 98 * This function clears one or several flags in page descriptor flags. 91 * This function atomically reset one or several flags in page descriptor flags. 92 ************************************************************************************* 99 93 * @ page : pointer to page descriptor. 100 94 * @ value : all non zero bits in value will be cleared. 101 95 ************************************************************************************/ 102 96 inline void page_clear_flag( page_t * page, 103 uint 16_t value );97 uint32_t value ); 104 98 105 99 /************************************************************************************* 106 100 * This function tests the value of one or several flags in page descriptor flags. 101 ************************************************************************************* 107 102 * @ page : pointer to page descriptor. 108 103 * @ value : all non zero bits will be tested. … … 110 105 ************************************************************************************/ 111 106 inline bool_t page_is_flag( page_t * page, 112 uint 16_t value );107 uint32_t value ); 113 108 114 109 /************************************************************************************* … … 121 116 * This function sets the PG_DIRTY flag in the page descriptor, 122 117 * and registers the page in the dirty list in PPM. 118 ************************************************************************************* 123 119 * @ page : pointer on page descriptor. 124 120 * @ returns true if page was not dirty / returns false if page was dirty … … 129 125 * This function resets the PG_DIRTY flag in the page descriptor, 130 126 * and removes the page from the dirty list in PPM. 127 ************************************************************************************* 131 128 * @ page : pointer on page descriptor. 132 129 * @ returns true if page was dirty / returns false if page was not dirty … … 136 133 /************************************************************************************* 137 134 * This function makes a local copy of the content of a src page to a dst page. 135 ************************************************************************************* 138 136 * @ dst : pointer on destination page descriptor. 139 137 * @ src : pointer on source page descriptor. … … 144 142 /************************************************************************************* 145 143 * This function resets to 0 all bytes in a given page. 144 ************************************************************************************* 146 145 * @ page : pointer on page descriptor. 147 146 ************************************************************************************/ … … 152 151 * It deschedule if the page has already been locked by another thread, 153 152 * and returns only when the flag has been successfully set. 153 ************************************************************************************* 154 154 * @ page : pointer on page descriptor. 155 155 ************************************************************************************/ … … 160 160 * other waiting thread. If there is waiting thread(s), it activates the first 161 161 * waiting thread without modifying the PG_LOCKED flag. 162 ************************************************************************************* 162 163 * @ page : pointer on page descriptor. 163 164 ************************************************************************************/ … … 166 167 /************************************************************************************* 167 168 * This blocking function atomically increments the page refcount. 169 ************************************************************************************* 168 170 * @ page : pointer on page descriptor. 169 171 ************************************************************************************/ … … 172 174 /************************************************************************************* 173 175 * This blocking function atomically decrements the page refcount. 176 ************************************************************************************* 174 177 * @ page : pointer on page descriptor. 175 178 ************************************************************************************/ … … 178 181 /************************************************************************************* 179 182 * This function display the values contained in a page descriptor. 183 ************************************************************************************* 184 * @ page : pointer on page descriptor. 180 185 ************************************************************************************/ 181 186 void page_print( page_t * page );
Note: See TracChangeset
for help on using the changeset viewer.