Changeset 312 for trunk/hal/x86_64/core
- Timestamp:
- Aug 2, 2017, 2:36:58 PM (7 years ago)
- Location:
- trunk/hal/x86_64/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/core/hal_boot.S
r243 r312 229 229 1: 230 230 231 testl $MULTIBOOT_INFO_HAS_CMDLINE,MB_MI_FLAGS(%ebx) 232 jz 1f 233 movl MB_MI_CMDLINE(%ebx),%esi /* src */ 234 movl $RELOC(mb_cmdline),%edi /* dst */ 235 movl $PAGE_SIZE,%ecx /* len */ 236 237 rep 238 movsb /* copy esi -> edi */ 239 1: 240 231 241 /* 232 242 * There are four levels of pages in amd64: PML4 -> PDP -> PD -> PT. They will -
trunk/hal/x86_64/core/hal_init.c
r310 r312 58 58 char mb_loader_name[PAGE_SIZE] __in_kdata; 59 59 uint8_t mb_mmap[PAGE_SIZE] __in_kdata; 60 60 char mb_cmdline[PAGE_SIZE] __in_kdata; 61 62 bool_t has_smp __in_kdata = true; 61 63 size_t ncpu __in_kdata = 0; 62 64 static boot_info_t btinfo __in_kdata; … … 80 82 /* -------------------------------------------------------------------------- */ 81 83 84 /* XXX XXX XXX libk */ 85 char * 86 strstr(char *s, const char *find) 87 { 88 char c, sc; 89 size_t len; 90 91 if ((c = *find++) != 0) { 92 len = strlen(find); 93 do { 94 do { 95 if ((sc = *s++) == 0) 96 return (NULL); 97 } while (sc != c); 98 } while (strncmp(s, find, len) != 0); 99 s--; 100 } 101 return s; 102 } 103 82 104 static void 83 105 dump_memmap() … … 101 123 102 124 i += mm->mm_size + 4; 125 } 126 127 if (mb_info.mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) { 128 mb_cmdline[PAGE_SIZE-1] = '\0'; 129 if (strstr(mb_cmdline, "--no-smp")) { 130 has_smp = false; 131 x86_printf("[+] SMP disabled\n"); 132 } 103 133 } 104 134 } … … 162 192 } 163 193 164 static void init_bootinfo_core(boot_core_t *core )194 static void init_bootinfo_core(boot_core_t *core, size_t n) 165 195 { 166 196 size_t i; 167 197 168 198 // XXX: not necessarily contiguous 169 for (i = 0; i < n cpu; i++) {199 for (i = 0; i < n; i++) { 170 200 memset(&core[i], 0, sizeof(boot_core_t)); 171 201 … … 240 270 241 271 info->cxy = 0; 242 info->cores_nr = ncpu; 243 init_bootinfo_core((boot_core_t *)&info->core); 272 if (has_smp) { 273 info->cores_nr = ncpu; 274 } else { 275 info->cores_nr = 1; 276 } 277 init_bootinfo_core((boot_core_t *)&info->core, info->cores_nr); 244 278 245 279 info->rsvd_nr = init_bootinfo_rsvd((boot_rsvd_t *)&info->rsvd); … … 396 430 init_bootinfo(&btinfo); 397 431 398 start_secondary_cpus(); 432 if (has_smp) { 433 start_secondary_cpus(); 434 } 399 435 400 436 kernel_init(&btinfo); -
trunk/hal/x86_64/core/hal_multiboot.h
r234 r312 71 71 /* Offsets into the structure */ 72 72 #define MB_MI_FLAGS 0 73 #define MB_MI_CMDLINE 16 73 74 #define MB_MI_MMAP_LENGTH 44 74 75 #define MB_MI_MMAP_ADDR 48
Note: See TracChangeset
for help on using the changeset viewer.