Changeset 23 for trunk/kernel/mm/page.h


Ignore:
Timestamp:
Jun 18, 2017, 10:06:41 PM (7 years ago)
Author:
alain
Message:

Introduce syscalls.

File:
1 edited

Legend:

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

    r22 r23  
    4949#define PG_DIRTY            0x0040     // page has been written
    5050#define PG_LOCKED       0x0080     // page is locked
     51#define PG_COW          0x0100     // page is copy-on-write
    5152
    5253#define PG_ALL          0xFFFF     // All flags
     
    5455/*************************************************************************************
    5556 * This structure defines a physical page descriptor.
    56  * Size is 60 bytes for a 32 bits core...
     57 * Size is 64 bytes for a 32 bits core...
    5758 ************************************************************************************/
    5859
    5960typedef struct page_s
    6061{
    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)  */
    6464    struct mapper_s * mapper;         /*! local pointer on associated mapper   (4)  */
    6565    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 
    7466        list_entry_t      list;           /*! for both dirty pages and free pages  (8)  */
    75 
    7667    xlist_entry_t     wait_root;      /*! root of list of waiting threads      (16) */
    77 
    7868        uint32_t          refcount;       /*! reference counter                    (4)  */
     69        uint32_t          fork_nr;        /*! number of forked processes           (4)  */
    7970        spinlock_t        lock;           /*! only used to set the PG_LOCKED flag  (16) */
    8071}
     
    8374/*************************************************************************************
    8475 * This function initializes one page descriptor.
     76 *************************************************************************************
    8577 * @ page    : pointer to page descriptor
    8678 ************************************************************************************/
     
    8880
    8981/*************************************************************************************
    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 *************************************************************************************
    9184 * @ page    : pointer to page descriptor.
    9285 * @ value   : all non zero bits in value will be set.
    9386 ************************************************************************************/
    9487inline void page_set_flag( page_t   * page,
    95                            uint16_t   value );
     88                           uint32_t   value );
    9689
    9790/*************************************************************************************
    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 *************************************************************************************
    9993 * @ page    : pointer to page descriptor.
    10094 * @ value   : all non zero bits in value will be cleared.
    10195 ************************************************************************************/
    10296inline void page_clear_flag( page_t   * page,
    103                              uint16_t   value );
     97                             uint32_t   value );
    10498
    10599/*************************************************************************************
    106100 * This function tests the value of one or several flags in page descriptor flags.
     101 *************************************************************************************
    107102 * @ page    : pointer to page descriptor.
    108103 * @ value   : all non zero bits will be tested.
     
    110105 ************************************************************************************/
    111106inline bool_t page_is_flag( page_t   * page,
    112                             uint16_t   value );
     107                            uint32_t   value );
    113108
    114109/*************************************************************************************
     
    121116 * This function sets the PG_DIRTY flag in the page descriptor,
    122117 * and registers the page in the dirty list in PPM.
     118 *************************************************************************************
    123119 * @ page     : pointer on page descriptor.
    124120 * @ returns true if page was not dirty / returns false if page was dirty
     
    129125 * This function resets the PG_DIRTY flag in the page descriptor,
    130126 * and removes the page from the dirty list in PPM.
     127 *************************************************************************************
    131128 * @ page     : pointer on page descriptor.
    132129 * @ returns true if page was dirty / returns false if page was not dirty
     
    136133/*************************************************************************************
    137134 * This function makes a local copy of the content of a src page to a dst page.
     135 *************************************************************************************
    138136 * @ dst      : pointer on destination page descriptor.
    139137 * @ src      : pointer on source page descriptor.
     
    144142/*************************************************************************************
    145143 * This function resets to 0 all bytes in a given page.
     144 *************************************************************************************
    146145 * @ page     : pointer on page descriptor.
    147146 ************************************************************************************/
     
    152151 * It deschedule if the page has already been locked by another thread,
    153152 * and returns only when the flag has been successfully set.
     153 *************************************************************************************
    154154 * @ page     : pointer on page descriptor.
    155155 ************************************************************************************/
     
    160160 * other waiting thread. If there is waiting thread(s), it activates the first
    161161 * waiting thread without modifying the PG_LOCKED flag.
     162 *************************************************************************************
    162163 * @ page     : pointer on page descriptor.
    163164 ************************************************************************************/
     
    166167/*************************************************************************************
    167168 * This blocking function atomically increments the page refcount.
     169 *************************************************************************************
    168170 * @ page     : pointer on page descriptor.
    169171 ************************************************************************************/
     
    172174/*************************************************************************************
    173175 * This blocking function atomically decrements the page refcount.
     176 *************************************************************************************
    174177 * @ page     : pointer on page descriptor.
    175178 ************************************************************************************/
     
    178181/*************************************************************************************
    179182 * This function display the values contained in a page descriptor.
     183 *************************************************************************************
     184 * @ page     : pointer on page descriptor.
    180185 ************************************************************************************/
    181186void page_print( page_t * page );
Note: See TracChangeset for help on using the changeset viewer.