Changeset 34 for trunk/hal


Ignore:
Timestamp:
Jun 22, 2017, 7:58:20 AM (8 years ago)
Author:
max@…
Message:

Update the types (from i386/).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/hal_types.h

    r32 r34  
    5454
    5555typedef uint64_t                    vaddr_t; // XXX
     56typedef uint64_t                 pt_entry_t; // XXX
    5657
    5758/***************************************************************************
     
    144145typedef struct cache_line_s
    145146{
    146   union
    147   {
    148     uint32_t values[CONFIG_CACHE_LINE_SIZE>>2];
    149     uint32_t value;
    150   };
     147        union
     148        {
     149                uint32_t values[CONFIG_CACHE_LINE_SIZE>>2];
     150                uint32_t value;
     151        };
    151152}
    152153__attribute__((packed)) cacheline_t;
    153154
    154 /***************************************************************************
    155  *  Address types and macros         !!!  hardware dependant  !!!
     155#define CACHELINE_ALIGNED __attribute__((aligned(CONFIG_CACHE_LINE_SIZE)))
     156
     157/***************************************************************************
     158 *  Address types and macros        !!! hardware dependent !!!
    156159 ***************************************************************************
    157  * An extended pointer a 64 bits integer, structured in two fields :
     160 * An extended pointer is a 64 bits integer, structured in two fields :
    158161 * - cxy : cluster identifier.
    159162 * - ptr : pointer in the virtual space of a single cluster.
    160163 *
    161  * In TSAR (MIPS32), the kernel virtual space has 4 Gbytes per cluster
    162  * - the cxy field occupies bits[47:32]
    163  * - the ptr field occupies bits[31:0]
     164 * In Intel 64 bits, the kernel virtual space has 256 Tbytes per cluster
     165 * - the cxy field occupies bits[63:48]
     166 * - the ptr field occupies bits[47:0]
    164167 ***************************************************************************
    165168 * A physical address is a 64 bits integer, structured in two fields :
     
    167170 * - lpa : local physical address inside cluster.
    168171 *
    169  * In TSAR (MIPS32), the physical space has 4Gbytes per cluster.
    170  * - the cxy field occupies bits[39:32]
    171  * - the lpa field occupies bits[31:0]
    172  **************************************************************************/
    173 
    174 typedef uint32_t               reg_t;         // core register
    175 
    176 typedef uint64_t               xptr_t;        // extended pointer
    177 
    178 typedef uint16_t               cxy_t;         // cluster identifier
    179 
    180 typedef uint64_t               paddr_t;       // global physical address
    181 
    182 typedef uint32_t               lpa_t;         // local physical address
    183 
    184 typedef uint64_t               intptr_t;      // local pointer stored as integer
    185 
    186 typedef uint32_t               ppn_t;         // Physical Page Number
    187 
    188 typedef uint32_t               vpn_t;         // Virtual Page number
     172 * In Intel 64 bits, the physical space has 256 Gbytes per cluster.
     173 * - the cxy field occupies bits[63:48]
     174 * - the lpa field occupies bits[47:0]
     175 **************************************************************************/
     176
     177typedef uint64_t               reg_t;         // core register
     178
     179typedef uint64_t               xptr_t;         // extended pointer
     180
     181typedef uint16_t               cxy_t;          // cluster identifier
     182
     183typedef uint64_t               paddr_t;        // global physical address (64 bits)
     184
     185typedef uint64_t               lpa_t;          // local physical address
     186
     187typedef uint64_t               intptr_t;       // local pointer stored as integer
     188
     189typedef uint64_t               ppn_t;          // Physical Page Number
     190
     191typedef uint64_t               vpn_t;          // Virtual Page number
    189192
    190193#define XPTR_NULL              0
    191194
    192 #define PTR_MASK               0x00000000FFFFFFFFULL
    193 
    194 #define GET_CXY(xp)            ((cxy_t)((xp) >> 32))
    195 
    196 #define GET_PTR(xp)            ((void*)(uint32_t)((xp) & PTR_MASK))
    197 
    198 #define XPTR(cxy,ptr)          (((uint64_t)(cxy) << 32) | (((uint32_t)(ptr)) & PTR_MASK))
    199 
    200 #define LPA_MASK               0x00000000FFFFFFFFULL
    201 
    202 #define CXY_FROM_PADDR(paddr)  ((cxy_t)((paddr) >> 32))
     195#define PTR_MASK               0x0000FFFFFFFFFFFFULL
     196
     197#define GET_CXY(xp)            ((cxy_t)((xp) >> 48))
     198
     199#define GET_PTR(xp)            ((void*)((xp) & PTR_MASK))
     200
     201#define XPTR(cxy,ptr)          (((uint64_t)(cxy) << 48) | (((uint64_t)(ptr)) & PTR_MASK))
     202
     203#define LPA_MASK               0X0000FFFFFFFFFFFFULL
     204
     205#define CXY_FROM_PADDR(paddr)  ((cxy_t)((paddr) >> 48))
    203206
    204207#define LPA_FROM_PADDR(paddr)  (lpa_t)((paddr & LPA_MASK)
    205208
    206 #define PADDR(cxy,lpa)         (((uint64_t)(cxy) << 32) | (((uint64_t)(lpa)) & LPA_MASK))
    207 
    208 
     209#define PADDR(cxy,lad)         (((uint64_t)(cxy) << 48) | (((uint64_t)(ptr)) & LPA_MASK))
    209210
    210211#endif  /* HAL_TYPES_H_ */
Note: See TracChangeset for help on using the changeset viewer.