Ignore:
Timestamp:
Jun 23, 2017, 9:57:35 AM (5 years ago)
Author:
max@…
Message:

Update. We need to use two separate arrays: one for the heap and one for
the kimg. The size of a heap entry is configurable, but that of the kimg
is not (fixed by mcmodel).

As a result, we also need to use two XPTRs: XPTR_HEAP and XPTR_KIMG. For
now we only declare XPTR_KIMG, and are not using it yet.

File:
1 edited

Legend:

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

    r38 r44  
    163163 *
    164164 * In Intel 64 bits, the kernel virtual space has 4 Gbytes per cluster
    165  * - the cxy field occupies bits[63:32]
     165 * - the cxy field occupies bits[34:32]
    166166 * - the ptr field occupies bits[31:0]
    167167 ***************************************************************************
     
    193193#define XPTR_NULL              0
    194194
     195/* virtual (heap) */
    195196#define PTR_MASK               0x00000000FFFFFFFFULL
    196 
     197#define CXY_MASK               0x0000000700000000ULL
    197198#define PTR_SHIFT              32
    198 
    199 #define GET_CXY(xp)            ((cxy_t)((xp) >> PTR_SHIFT))
    200 
     199#define GET_CXY(xp)            ((cxy_t)(((xp) & CXY_MASK) >> PTR_SHIFT))
    201200#define GET_PTR(xp)            ((void*)((xp) & PTR_MASK))
    202 
    203201#define XPTR(cxy,ptr)          (((uint64_t)(cxy) << PTR_SHIFT) | (((uint64_t)(ptr)) & PTR_MASK))
    204202
    205 
    206 
     203/* virtual (kimg). A KIMG entry has 2GB of VA. */
     204#define PTR_KIMG_MASK          0x000000007FFFFFFFULL
     205#define CXY_KIMG_MASK          0x0000000380000000ULL
     206#define PTR_KIMG_SHIFT         31
     207#define GET_KIMG_CXY(xp)       ((cxy_t)(((xp) & CXY_KIMG_MASK) >> PTR_KIMG_SHIFT))
     208#define GET_KIMG_PTR(xp)       ((void*)((xp) & PTR_KIMG_MASK))
     209#define XPTR_KIMG(cxy,ptr)     (((uint64_t)(cxy) << PTR_KIMG_SHIFT) | (((uint64_t)(ptr)) & PTR_KIMG_MASK))
     210
     211/* physical */
    207212#define LPA_MASK               0x00000001FFFFFFFFULL
    208 
    209213#define LPA_SHIFT              33
    210 
    211214#define CXY_FROM_PADDR(paddr)  ((cxy_t)((paddr) >> LPA_SHIFT))
    212 
    213215#define LPA_FROM_PADDR(paddr)  (lpa_t)((paddr & LPA_MASK)
    214 
    215216#define PADDR(cxy,lad)         (((uint64_t)(cxy) << LPA_SHIFT) | (((uint64_t)(ptr)) & LPA_MASK))
    216217
Note: See TracChangeset for help on using the changeset viewer.