Changeset 409 for trunk/kernel/mm/vseg.h


Ignore:
Timestamp:
Dec 20, 2017, 4:51:09 PM (6 years ago)
Author:
alain
Message:

Fix bugs in exec

File:
1 edited

Legend:

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

    r408 r409  
    3535struct vmm_s;
    3636
    37 /**********************************************************************************************
     37/*******************************************************************************************
    3838 * This enum defines the vseg types for an user process.
    39  *********************************************************************************************/
     39 ***********************************************************************************VSEG*******/
    4040
    4141typedef enum
    4242{
    43     VSEG_TYPE_CODE   = 0,          /*! executable user code   / private / localized          */
    44     VSEG_TYPE_DATA   = 1,          /*! initialized user data  / public  / distributed        */
    45     VSEG_TYPE_STACK  = 2,          /*! execution user stack   / private / localized          */
    46     VSEG_TYPE_ANON   = 3,          /*! anonymous mmap         / public  / localized          */
    47     VSEG_TYPE_FILE   = 4,          /*! file mmap              / public  / localized          */
    48     VSEG_TYPE_REMOTE = 5,          /*! remote mmap            / public  / localized          */
     43    VSEG_TYPE_CODE   = 0,          /*! executable user code   / private / localized       */
     44    VSEG_TYPE_DATA   = 1,          /*! initialized user data  / public  / distributed     */
     45    VSEG_TYPE_STACK  = 2,          /*! execution user stack   / private / localized       */
     46    VSEG_TYPE_ANON   = 3,          /*! anonymous mmap         / public  / localized       */
     47    VSEG_TYPE_FILE   = 4,          /*! file mmap              / public  / localized       */
     48    VSEG_TYPE_REMOTE = 5,          /*! remote mmap            / public  / localized       */
    4949
    5050    VSEG_TYPE_KDATA  = 10,
     
    5555
    5656
    57 /**********************************************************************************************
     57/*******************************************************************************************
    5858 * These masks define the vseg generic (hardware independent) flags.
    59  *********************************************************************************************/
     59 ******************************************************************************************/
    6060
    61 #define VSEG_USER     0x0001       /*! user accessible                                       */
    62 #define VSEG_WRITE    0x0002       /*! writeable                                             */
    63 #define VSEG_EXEC     0x0004       /*! executable                                            */
    64 #define VSEG_CACHE    0x0008       /*! cachable                                              */
    65 #define VSEG_PRIVATE  0x0010       /*! should not be accessed from another cluster           */
    66 #define VSEG_DISTRIB  0x0020       /*! physically distributed on all clusters                */
     61#define VSEG_USER     0x0001       /*! user accessible                                    */
     62#define VSEG_WRITE    0x0002       /*! writeable                                          */
     63#define VSEG_EXEC     0x0004       /*! executable                                         */
     64#define VSEG_CACHE    0x0008       /*! cachable                                           */
     65#define VSEG_PRIVATE  0x0010       /*! should not be accessed from another cluster        */
     66#define VSEG_DISTRIB  0x0020       /*! physically distributed on all clusters             */
     67#define VSEG_IDENT    0x0040       /*! identity mapping                                   */
    6768
    68 /**********************************************************************************************
     69/*******************************************************************************************
    6970 * This structure defines a virtual segment descriptor.
    7071 * - The VSL contains only local vsegs, but is implemented as an xlist, because it can be
    7172 *   accessed by thread running in a remote cluster.
    7273 * - The zombi list is used by the local MMAP allocator. It is implemented as a local list.
    73  *********************************************************************************************/
     74 ******************************************************************************************/
    7475
    7576typedef struct vseg_s
    7677{
    77         xlist_entry_t     xlist;        /*! all vsegs in same VSL (or same zombi list)           */
    78         list_entry_t      zlist;        /*! all vsegs in same zombi list                         */
    79         struct vmm_s    * vmm;          /*! pointer on associated VM manager                     */
    80     uint32_t          type;         /*! vseg type                                            */
    81         intptr_t          min;          /*! segment min virtual address                          */
    82         intptr_t          max;          /*! segment max virtual address (excluded)               */
    83         vpn_t             vpn_base;     /*! first page of vseg                                   */
    84         vpn_t             vpn_size;     /*! number of pages occupied                             */
    85         uint32_t          flags;        /*! vseg attributes                                      */
    86         xptr_t            mapper_xp;    /*! xptr on remote mapper (for types CODE/DATA/FILE)     */
    87         intptr_t          file_offset;  /*! vseg offset in file (for types CODE/DATA/FILE        */
    88     intptr_t          file_size;    /*! max segment size in mapper (for type CODE/DATA)      */
    89     cxy_t             cxy;          /*! physical mapping (for non distributed vseg)          */
     78        xlist_entry_t     xlist;        /*! all vsegs in same VSL (or same zombi list)        */
     79        list_entry_t      zlist;        /*! all vsegs in same zombi list                      */
     80        struct vmm_s    * vmm;          /*! pointer on associated VM manager                  */
     81    uint32_t          type;         /*! vseg type                                         */
     82        intptr_t          min;          /*! segment min virtual address                       */
     83        intptr_t          max;          /*! segment max virtual address (excluded)            */
     84        vpn_t             vpn_base;     /*! first page of vseg                                */
     85        vpn_t             vpn_size;     /*! number of pages occupied                          */
     86        uint32_t          flags;        /*! vseg attributes                                   */
     87        xptr_t            mapper_xp;    /*! xptr on remote mapper (for types CODE/DATA/FILE)  */
     88        intptr_t          file_offset;  /*! vseg offset in file (for types CODE/DATA/FILE     */
     89    intptr_t          file_size;    /*! max segment size in mapper (for type CODE/DATA)   */
     90    cxy_t             cxy;          /*! physical mapping (for non distributed vseg)       */
    9091}
    9192vseg_t;
    9293
    93 /**********************************************************************************************
     94/*******************************************************************************************
    9495 * This function returns a printable string for the vseg type.
    95  **********************************************************************************************
     96 *******************************************************************************************
    9697 * @ vseg_type  : type of vseg
    9798 * @ return pointer on string
    98  *********************************************************************************************/
     99 ******************************************************************************************/
    99100char * vseg_type_str( uint32_t vseg_type );
    100101
    101 /**********************************************************************************************
     102/*******************************************************************************************
    102103 * This function allocates physical memory for a new vseg descriptor from the local cluster
    103104 * physical memory allocator.
    104  **********************************************************************************************
     105 *******************************************************************************************
    105106 * @ return pointer on allocated vseg descriptor if success / return NULL if failure.
    106  *********************************************************************************************/
     107 ******************************************************************************************/
    107108vseg_t * vseg_alloc();
    108109
    109 /**********************************************************************************************
    110  * This function releases physical memory allocated for a vseg descriptor to the local cluster
    111  * physical memory allocator.
    112  **********************************************************************************************
     110/*******************************************************************************************
     111 * This function releases the physical memory allocated for a vseg descriptor
     112 * to the local cluster physical memory allocator.
     113 *******************************************************************************************
    113114 * @ vseg   : local pointer on released vseg descriptor.
    114  *********************************************************************************************/
     115 ******************************************************************************************/
    115116void vseg_free( vseg_t * vseg );
    116117
    117 /**********************************************************************************************
     118/*******************************************************************************************
    118119 * This function initializes a local vseg descriptor, from the arguments values.
    119120 * It does NOT register the vseg in the local VMM.
    120  **********************************************************************************************
     121 *******************************************************************************************
    121122 * @ vseg      : pointer on the vseg descriptor.
    122123 * @ base      : vseg base address.
     
    126127 * @ type      : vseg type.
    127128 * @ cxy       : target cluster for physical mapping.
    128  *********************************************************************************************/
     129 ******************************************************************************************/
    129130void vseg_init( vseg_t      * vseg,
    130131                    vseg_type_t   type,
     
    138139                cxy_t         cxy );
    139140
    140 /**********************************************************************************************
     141/*******************************************************************************************
    141142 * This function initializes a local vseg descriptor from values contained in a reference
    142143 * remote vseg descriptor. It does NOT register the vseg in the local VMM.
    143  **********************************************************************************************
     144 *******************************************************************************************
    144145 * @ vseg      : pointer on the vseg descriptor.
    145146 * @ ref_xp    : extended pointer on the reference vseg descriptor.
    146  *********************************************************************************************/
     147 ******************************************************************************************/
    147148void vseg_init_from_ref( vseg_t * vseg,
    148149                         xptr_t   ref_xp );
    149150
    150 /**********************************************************************************************
     151/*******************************************************************************************
    151152 * This function adds a vseg descriptor in the set of vsegs controlled by a given VMM,
    152153 * and updates the vmm field in the vseg descriptor.
    153154 * The lock protecting the vsegs list in VMM must be taken by the caller.
    154  **********************************************************************************************
     155 *******************************************************************************************
    155156 * @ vmm       : pointer on the VMM
    156157 * @ vseg      : pointer on the vseg descriptor
    157  *********************************************************************************************/
     158 ******************************************************************************************/
    158159void vseg_attach( struct vmm_s  * vmm,
    159160                  vseg_t        * vseg );
    160161
    161 /**********************************************************************************************
     162/*******************************************************************************************
    162163 * This function removes a vseg descriptor from the set of vsegs controlled by a given VMM,
    163164 * and updates the vmm field in the vseg descriptor. No memory is released.
    164165 * The lock protecting the vsegs list in VMM must be taken by the caller.
    165  **********************************************************************************************
     166 *******************************************************************************************
    166167 * @ vmm       : pointer on the VMM
    167168 * @ vseg      : pointer on the vseg descriptor
    168  *********************************************************************************************/
     169 ******************************************************************************************/
    169170void vseg_detach( struct vmm_s  * vmm,
    170171                  vseg_t        * vseg );
Note: See TracChangeset for help on using the changeset viewer.