[160] | 1 | //////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File : mapping_info.h |
---|
| 3 | // Date : 01/04/2012 |
---|
| 4 | // Author : alain greiner |
---|
| 5 | // Copyright (c) UPMC-LIP6 |
---|
| 6 | //////////////////////////////////////////////////////////////////////////// |
---|
| 7 | // The MAPPING_INFO data structure can be used with the GIET. |
---|
| 8 | // It contains the mapping directive for one or several virtual spaces. |
---|
| 9 | // Ech virtual space contains a variable number of virtual segments |
---|
| 10 | // and a variable number of tasks. The number of virtual space can be one. |
---|
| 11 | // |
---|
| 12 | // The mapping table data structure is organised as the concatenation of |
---|
| 13 | // a fixed size header, and 6 variable size arrays: |
---|
| 14 | // |
---|
| 15 | // - mapping_header_t header (MAPPING_HEADER_SIZE) |
---|
| 16 | // - mapping_cluster_t cluster[clusters] (MAPPING_CLUSTER_SIZE * clusters) |
---|
| 17 | // - mapping_pseg_t pseg[psegs] (MAPPING_PSEG_SIZE * psegs) |
---|
| 18 | // - mapping_vspace_t vspace[vspaces] (MAPPING_VSPACE_SIZE * vspaces) |
---|
| 19 | // - mapping_vseg_t vseg[vsegs] (MAPPING_VSEG_SIZE * vsegs) |
---|
| 20 | // - mapping_vseg_t vobj[vsegs] (MAPPING_VOBJ_SIZE * vsegs) |
---|
| 21 | // - mapping_task_t task[tasks] (MAPPING_TASK_SIZE * tasks) |
---|
| 22 | // |
---|
| 23 | // The number of clusters and the number of vspaces are defined in the header. |
---|
| 24 | // The number of psegs are defined in each cluster. |
---|
| 25 | // The number of vsegs, tasks ans mwmrs are defined in each vspace. |
---|
| 26 | // |
---|
| 27 | // It is intended to be stored in the boot ROM at address MAPPING_BOOT_BASE. |
---|
| 28 | // For each cluster, the base address of the first pseg descriptor |
---|
| 29 | // is defined by a pseg_offset relative to MAPPING_BOOT_BASE. |
---|
| 30 | // For each vspace, the base address of the first vseg descriptor |
---|
| 31 | // is defined by a vseg_offset relative to MAPPING_BOOT_BASE. |
---|
| 32 | // For each vspace, the base address of the first task desciptor |
---|
| 33 | // is defined by a task_offset relative to MAPPING_BOOT_BASE. |
---|
| 34 | // For each vspace, the base address of the first mwmr desciptor |
---|
| 35 | // is defined by a mwmr_offset relative to MAPPING_BOOT_BASE. |
---|
| 36 | //////////////////////////////////////////////////////////////////////////// |
---|
| 37 | |
---|
| 38 | #ifndef _MAPPING_INFO_H_ |
---|
| 39 | #define _MAPPING_INFO_H_ |
---|
| 40 | |
---|
| 41 | #define MAPPING_HEADER_SIZE sizeof(mapping_header_t) |
---|
| 42 | #define MAPPING_CLUSTER_SIZE sizeof(mapping_cluster_t) |
---|
| 43 | #define MAPPING_VSPACE_SIZE sizeof(mapping_vspace_t) |
---|
| 44 | #define MAPPING_VSEG_SIZE sizeof(mapping_vseg_t) |
---|
| 45 | #define MAPPING_VOBJ_SIZE sizeof(mapping_vobj_t) |
---|
| 46 | #define MAPPING_PSEG_SIZE sizeof(mapping_pseg_t) |
---|
| 47 | #define MAPPING_TASK_SIZE sizeof(mapping_task_t) |
---|
| 48 | |
---|
| 49 | #define C_MODE_MASK 0b1000 // cacheable |
---|
| 50 | #define X_MODE_MASK 0b0100 // executable |
---|
| 51 | #define W_MODE_MASK 0b0010 // writable |
---|
| 52 | #define U_MODE_MASK 0b0001 // user access |
---|
| 53 | |
---|
| 54 | #define IN_MAPPING_SIGNATURE 0xDEADBEEF |
---|
| 55 | #define OUT_MAPPING_SIGNATURE 0xBABEF00D |
---|
| 56 | |
---|
| 57 | enum |
---|
| 58 | { |
---|
| 59 | ELF = 0, //loadable code object |
---|
| 60 | PTAB, //page table |
---|
| 61 | SCHED, //schedulers |
---|
| 62 | PERI, //hardware component |
---|
| 63 | MWMR, //MWMR channel |
---|
| 64 | LOCK, //Lock |
---|
| 65 | BUFFER, //Any "no intialiasation needed" objects (stacks...) |
---|
| 66 | BARRIER //Barrier |
---|
| 67 | }; |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | /////////////////////////////// |
---|
| 71 | typedef struct mapping_header_s |
---|
| 72 | { |
---|
| 73 | unsigned int signature; // must contain MAPPING_SIGNATURE |
---|
| 74 | unsigned int clusters; // number of clusters |
---|
| 75 | unsigned int psegs; // number of psegs |
---|
| 76 | unsigned int ttys; // number of TTY terminals |
---|
| 77 | unsigned int globals; // number of vsegs mapped in all vspaces |
---|
| 78 | unsigned int vspaces; // number of virtual spaces |
---|
| 79 | unsigned int vsegs; // total number of virtual segments (for all vspaces) |
---|
| 80 | unsigned int vobjs; // total number of virtual memory objects (for all vspaces) |
---|
| 81 | unsigned int tasks; // total number of tasks (for all vspaces) |
---|
| 82 | char name[32]; // mapping name |
---|
| 83 | } mapping_header_t; |
---|
| 84 | |
---|
| 85 | //////////////////////////////// |
---|
| 86 | typedef struct mapping_cluster_s |
---|
| 87 | { |
---|
| 88 | unsigned int procs; // number of processors in cluster |
---|
| 89 | unsigned int timers; // number of timers in cluster |
---|
| 90 | unsigned int dmas; // number of DMA channels in cluster |
---|
| 91 | } mapping_cluster_t; |
---|
| 92 | |
---|
| 93 | ///////////////////////////// |
---|
| 94 | typedef struct mapping_pseg_s |
---|
| 95 | { |
---|
| 96 | char name[32]; // pseg name (unique in a cluster) |
---|
| 97 | unsigned int base; // base address in physical space |
---|
| 98 | unsigned int length; // size (bytes) |
---|
| 99 | unsigned int next_free_page; // physical page allocator |
---|
| 100 | } mapping_pseg_t; |
---|
| 101 | |
---|
| 102 | /////////////////////////////// |
---|
| 103 | typedef struct mapping_vspace_s |
---|
| 104 | { |
---|
| 105 | char name[32]; // virtual space name |
---|
| 106 | unsigned int funcs_offset; // offset of the vobj containing the function entry table (relative to vobj_offset) |
---|
| 107 | unsigned int vsegs; // number of private virtual segments |
---|
| 108 | unsigned int vobjs; // number of vobjs channels |
---|
| 109 | unsigned int tasks; // number of tasks |
---|
| 110 | unsigned int ttys; // number of required TTY terminals |
---|
| 111 | unsigned int vseg_offset; // index of first vseg in vspace |
---|
| 112 | unsigned int vobj_offset; // index of first vobjs in vspace |
---|
| 113 | unsigned int task_offset; // index of first task in vspace |
---|
| 114 | } mapping_vspace_t; |
---|
| 115 | |
---|
| 116 | ///////////////////////////// |
---|
| 117 | typedef struct mapping_vseg_s |
---|
| 118 | { |
---|
| 119 | char name[32]; // vseg name (unique in vspace) |
---|
| 120 | unsigned int vbase; // base address in virtual space (hexa) |
---|
| 121 | unsigned int pbase; // base address in physical space (hexa) |
---|
| 122 | unsigned int length; // size (bytes) |
---|
| 123 | unsigned int psegid; // physical segment index |
---|
| 124 | unsigned char mode; // C-X-W-U flags |
---|
| 125 | unsigned char ident; // identity mapping if non zero |
---|
| 126 | unsigned int vobjs; // number of vobjs channels |
---|
| 127 | unsigned int vobj_offset; // index of first vobjs in vspace |
---|
| 128 | unsigned char reserved; // unused |
---|
| 129 | } mapping_vseg_t; |
---|
| 130 | |
---|
| 131 | ///////////////////////////// |
---|
| 132 | typedef struct mapping_task_s |
---|
| 133 | { |
---|
| 134 | char name[32]; // task name (unique in vspace) |
---|
| 135 | unsigned int clusterid; // physical cluster index |
---|
| 136 | unsigned int proclocid; // processor local index (inside cluster) |
---|
| 137 | unsigned int vobjlocid; // stack vobj index in vspace |
---|
| 138 | unsigned int startid; // index in start_vector (in seg_data) |
---|
| 139 | unsigned int ttylocid; // tty index (inside the vspace) |
---|
| 140 | } mapping_task_t; |
---|
| 141 | |
---|
| 142 | ///////////////////////////// |
---|
| 143 | typedef struct mapping_vobj_s |
---|
| 144 | { |
---|
| 145 | char name[32]; // vobj name (unique in a vspace) |
---|
| 146 | char binpath[64]; // path for the binary code ("*.bin") |
---|
| 147 | unsigned int type; // type of vobj |
---|
| 148 | unsigned int length; // size (bytes) |
---|
| 149 | unsigned int align; // required alignement (logarithm of 2) |
---|
| 150 | unsigned int vaddr; // virtual addresse of the vobj location (bytes) |
---|
| 151 | unsigned int paddr; // physical addresse of the vobj location (bytes) |
---|
| 152 | } mapping_vobj_t; |
---|
| 153 | |
---|
| 154 | #endif |
---|
| 155 | |
---|
| 156 | // Local Variables: |
---|
| 157 | // tab-width: 4 |
---|
| 158 | // c-basic-offset: 4 |
---|
| 159 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 160 | // indent-tabs-mode: nil |
---|
| 161 | // End: |
---|
| 162 | |
---|
| 163 | // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 164 | |
---|