Changeset 47 for trunk/hal/x86_64
- Timestamp:
- Jun 26, 2017, 11:48:28 AM (7 years ago)
- Location:
- trunk/hal/x86_64
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/hal_boot.h
r44 r47 24 24 #define PGSHIFT 12 25 25 26 #define KERNBASE 0xfffff fff8000000027 #define KERNBASE_HI 0xfffff fff28 #define KERNBASE_LO 0x 8000000026 #define KERNBASE 0xfffff00000000000 27 #define KERNBASE_HI 0xfffff000 28 #define KERNBASE_LO 0x00000000 29 29 30 #define KERNTEXTOFF 0xfffff fff8020000031 #define KERNTEXTOFF_HI 0xfffff fff32 #define KERNTEXTOFF_LO 0x 8020000030 #define KERNTEXTOFF 0xfffff00000200000 31 #define KERNTEXTOFF_HI 0xfffff000 32 #define KERNTEXTOFF_LO 0x00200000 33 33 34 34 /* -------------------------------------------------------------------------- */ … … 109 109 110 110 #define L4_SLOT_PTE 255 111 #define L4_SLOT_KERN 256 112 #define L4_SLOT_KERNBASE 511 111 #define L4_SLOT_KERNBASE 480 113 112 114 113 /* … … 116 115 * L2 = (KERNBASE % NBPD_L3) / NBPD_L2 117 116 */ 118 #define L3_SLOT_KERNBASE 510117 #define L3_SLOT_KERNBASE 0 119 118 #define L2_SLOT_KERNBASE 0 120 119 121 #define PDIR_SLOT_KERN L4_SLOT_KERN122 120 #define PDIR_SLOT_PTE L4_SLOT_PTE 123 121 … … 132 130 /* -------------------------------------------------------------------------- */ 133 131 134 /* 135 * There are two arrays: one for the heap, one for the kernel image. They are 136 * separated by 64TB of VA, which is more than enough to avoid collision. 137 */ 138 #define CLUSTERS_HEAP_BASE_VA 0xffff800000000000 139 #define CLUSTERS_KIMG_BASE_VA 0xffffc00000000000 132 #define KERNEL_VA_SIZE (NKL2_KIMG_ENTRIES * NBPD_L2) 133 #define CLUSTERS_BASE_VA 0xffff800000000000 140 134 141 135 /* These parameters are configurable. */ 142 #define CLUSTER_ HEAP_VA_SIZE 0x100000000 /* 4GB */143 #define CLUSTER_ HEAP_PA_SIZE 0x200000000 /* 8GB */136 #define CLUSTER_VA_SIZE 0x100000000 /* 4GB */ 137 #define CLUSTER_PA_SIZE 0x200000000 /* 8GB */ 144 138 145 /* These parameters are *not* configurable. */ 146 #define CLUSTER_KIMG_VA_SIZE 0x80000000 /* 2GB */ 139 /* Macros to get the VA ranges for a cluster */ 140 #define CLUSTER_MIN_VA(n) \ 141 (CLUSTERS_BASE_VA + n * CLUSTER_VA_SIZE) 142 #define CLUSTER_MAX_VA(n) \ 143 (CLUSTER_MIN_VA(n) + CLUSTER_VA_SIZE) 147 144 148 /* Macros to get the heap/kimg ranges for a cluster */149 #define CLUSTER_HEAP_MIN_VA(n) \150 (CLUSTERS_HEAP_BASE_VA + n * CLUSTER_HEAP_VA_SIZE)151 #define CLUSTER_HEAP_MAX_VA(n) \152 (CLUSTER_HEAP_MIN_VA(n) + CLUSTER_HEAP_VA_SIZE)153 #define CLUSTER_KIMG_MIN_VA(n) \154 (CLUSTERS_KIMG_BASE_VA + n * CLUSTER_KIMG_VA_SIZE)155 #define CLUSTER_KIMG_MAX_VA(n) \156 (CLUSTER_KIMG_MIN_VA(n) + CLUSTER_KIMG_VA_SIZE)157 -
trunk/hal/x86_64/hal_gpt.c
r45 r47 71 71 void hal_gpt_bootstrap_reset() 72 72 { 73 size_t npages = (va_avail - CLUSTER_HEAP_MIN_VA(0)) / PAGE_SIZE;74 hal_gpt_leave_range(CLUSTER_ HEAP_MIN_VA(0), npages);73 size_t npages = (va_avail - (CLUSTER_MIN_VA(0) + KERNEL_VA_SIZE)) / PAGE_SIZE; 74 hal_gpt_leave_range(CLUSTER_MIN_VA(0) + KERNEL_VA_SIZE, npages); 75 75 } 76 76 … … 211 211 /* Initialize global values */ 212 212 pa_avail = firstpa; 213 va_avail = CLUSTER_ HEAP_MIN_VA(0);213 va_avail = CLUSTER_MIN_VA(0) + KERNEL_VA_SIZE; 214 214 kimg_size = ((uint64_t)&__kernel_end - KERNBASE); 215 215 XASSERT(kimg_size % PAGE_SIZE == 0); … … 217 217 218 218 /* Create cluster0's heap entry. */ 219 hal_gpt_maptree_area(CLUSTER_HEAP_MIN_VA(0), CLUSTER_HEAP_MAX_VA(0)); 220 221 /* Create cluster0's kimg entry. */ 222 hal_gpt_maptree_area(CLUSTER_KIMG_MIN_VA(0), CLUSTER_KIMG_MAX_VA(0)); 219 hal_gpt_maptree_area(CLUSTER_MIN_VA(0), CLUSTER_MAX_VA(0)); 223 220 224 221 /* Manually enter cluster0's kimg */ 225 hal_gpt_enter_range(CLUSTER_ KIMG_MIN_VA(0), kimg_min_pa, kimg_size);222 hal_gpt_enter_range(CLUSTER_MIN_VA(0), kimg_min_pa, kimg_size); 226 223 } 227 224 -
trunk/hal/x86_64/hal_init.c
r46 r47 88 88 x86_printf("[+] cpu_attach called\n"); 89 89 90 x86_printf("[+] bootloader: %s\n", mb_loader_name);90 x86_printf("[+] bootloader: '%s'\n", mb_loader_name); 91 91 92 92 dump_memmap(); … … 109 109 110 110 x86_printf("-> mytest = %z\n", mytest); 111 size_t *myptr = XPTR_KIMG(0, &mytest) + CLUSTER_KIMG_MIN_VA(0);111 size_t *myptr = CLUSTER_MIN_VA(0) + XPTR(0, &mytest); 112 112 *myptr = 1; 113 113 x86_printf("-> mytest = %z\n", mytest); -
trunk/hal/x86_64/x86_printf.c
r39 r47 214 214 x86_printf("0x%s", buf); 215 215 } else if (c == 's') { 216 x86_printf((char *) va_arg(ap, int));216 x86_printf((char *) va_arg(ap, uint64_t)); 217 217 } 218 218 } else
Note: See TracChangeset
for help on using the changeset viewer.