Changeset 312 for trunk/hal/x86_64/core/hal_init.c
- Timestamp:
- Aug 2, 2017, 2:36:58 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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);
Note: See TracChangeset
for help on using the changeset viewer.