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_gpt.c

    r42 r44  
    4444#define pl4_i(VA)       (((VA_SIGN_POS(VA)) & L4_FRAME) >> L4_SHIFT)
    4545
     46extern vaddr_t __kernel_end;
     47size_t kimg_size __in_kdata = 0;
     48
    4649paddr_t pa_avail __in_kdata = 0;
    4750vaddr_t va_avail __in_kdata = 0;
     
    176179void hal_gpt_init(paddr_t firstpa)
    177180{
     181        paddr_t kimg_min_pa = 0;
     182
     183        /* Initialize global values */
    178184        pa_avail = firstpa;
    179         va_avail = CLUSTER_MIN_VA(0);
    180         hal_gpt_maptree_area(CLUSTER_MIN_VA(0), CLUSTER_MAX_VA(0));
     185        va_avail = CLUSTER_HEAP_MIN_VA(0);
     186        kimg_size = ((uint64_t)&__kernel_end - KERNBASE);
     187        XASSERT(kimg_size % PAGE_SIZE == 0);
     188        kimg_size = kimg_size / PAGE_SIZE;
     189
     190        /* Create cluster0's heap entry. */
     191        hal_gpt_maptree_area(CLUSTER_HEAP_MIN_VA(0), CLUSTER_HEAP_MAX_VA(0));
     192
     193        /* Create cluster0's kimg entry. */
     194        hal_gpt_maptree_area(CLUSTER_KIMG_MIN_VA(0), CLUSTER_KIMG_MAX_VA(0));
     195
     196        /* Manually enter cluster0's kimg */
     197        hal_gpt_enter_range(CLUSTER_KIMG_MIN_VA(0), kimg_min_pa, kimg_size);
    181198}
    182199
Note: See TracChangeset for help on using the changeset viewer.