Changeset 224


Ignore:
Timestamp:
Jul 18, 2017, 10:29:58 AM (4 years ago)
Author:
max@…
Message:

Create a (virtual) copy of the local cluster in 0xffffe00000000000, and
make GET_PTR() point to it. This way we can use pointers from GET_PTR()
directly, instead of reconstructing a XPTR with local_cxy.

Location:
trunk/hal/x86_64/core
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/x86_64/core/hal_boot.h

    r193 r224  
    144144        (CLUSTER_MIN_VA(n) + CLUSTER_VA_SIZE)
    145145
     146/* Macros indicating the VA ranges for the local cluster*/
     147#define LOCAL_CLUSTER_MIN_VA    HAL_VA_LOCAL_CLUSTER
     148#define LOCAL_CLUSTER_MAX_VA    (LOCAL_CLUSTER_MIN_VA + CLUSTER_VA_SIZE)
     149
  • trunk/hal/x86_64/core/hal_gpt.c

    r150 r224  
    224224        XASSERT(kimg_size % PAGE_SIZE == 0);
    225225
    226         /* Create cluster0's page tree */
     226        /*
     227         * Create cluster0's page tree, enter the space, and unmap the area
     228         * below the kernel.
     229         */
    227230        hal_gpt_maptree_area(CLUSTER_MIN_VA(0), CLUSTER_MIN_VA(0) + CLUSTER_PA_SIZE);
    228 
    229         /* Enter cluster0's space */
    230231        hal_gpt_enter_range(CLUSTER_MIN_VA(0), 0, CLUSTER_PA_SIZE / PAGE_SIZE);
    231 
    232         /* Unmap the area below the kernel */
    233232        hal_gpt_leave_range(CLUSTER_MIN_VA(0), (KERNTEXTOFF - KERNBASE) / PAGE_SIZE);
     233
     234        /*
     235         * Do the same, but now in the local cluster map.
     236         */
     237        hal_gpt_maptree_area(LOCAL_CLUSTER_MIN_VA, LOCAL_CLUSTER_MIN_VA + CLUSTER_PA_SIZE);
     238        hal_gpt_enter_range(LOCAL_CLUSTER_MIN_VA, 0, CLUSTER_PA_SIZE / PAGE_SIZE);
     239        hal_gpt_leave_range(LOCAL_CLUSTER_MIN_VA, (KERNTEXTOFF - KERNBASE) / PAGE_SIZE);
    234240}
    235241
  • trunk/hal/x86_64/core/hal_init.c

    r203 r224  
    300300        x86_printf("[+] cput_tls_init called\n");
    301301
     302        mytest = 0;
    302303        x86_printf("-> mytest = %z\n", mytest);
    303304        void *hoho = &init_x86_64;
  • trunk/hal/x86_64/core/hal_types.h

    r145 r224  
    196196
    197197/* virtual */
     198#define HAL_VA_LOCAL_CLUSTER   0xffffe00000000000ULL
    198199#define HAL_VA_BASE            0xffff800000000000ULL
    199200#define PTR_MASK               0x0000000FFFFFFFFFULL
     
    201202#define PTR_SHIFT              36
    202203#define GET_CXY(xp)            ((cxy_t)(((xp) & CXY_MASK) >> PTR_SHIFT))
    203 #define GET_PTR(xp)            ((void*)((xp) & PTR_MASK))
     204#define GET_PTR(xp)            ((void*)(HAL_VA_LOCAL_CLUSTER | ((xp) & PTR_MASK)))
    204205#define XPTR(cxy,ptr)          ((uint64_t)HAL_VA_BASE | \
    205206                                ((uint64_t)(cxy) << PTR_SHIFT) | \
Note: See TracChangeset for help on using the changeset viewer.