290 void __init __no_sanitize_address setup_arch(char **cmdline_p)
291 {
292         setup_initial_init_mm(_stext, _etext, _edata, _end);

더보기

 

 48 void setup_initial_init_mm(void *start_code, void *end_code,
 49                            void *end_data, void *brk)
 50 {
 51         init_mm.start_code = (unsigned long)start_code;
 52         init_mm.end_code = (unsigned long)end_code;
 53         init_mm.end_data = (unsigned long)end_data;
 54         init_mm.brk = (unsigned long)brk;
 55 }

 

init_mm에 _stext, _etext, _edata, _end 저장


293
294         *cmdline_p = boot_command_line;

boot_command_line을 cmdline_p 에 연결


295
296         /*
297          * If know now we are going to need KPTI then use non-global
298          * mappings from the start, avoiding the cost of rewriting
299          * everything later.
300          */
301         arm64_use_ng_mappings = kaslr_requires_kpti();

https://isun2501.tistory.com/62
302
303         early_fixmap_init();

https://isun2501.tistory.com/66
304         early_ioremap_init();

https://isun2501.tistory.com/71
305
306         setup_machine_fdt(__fdt_pointer);

__fdt_pointer 는 head.S에서 fdt의 위치를 보관함


307
308         /*
309          * Initialise the static keys early as they may be enabled by the
310          * cpufeature code and early parameters.
311          */
312         jump_label_init();
313         parse_early_param();
314
315         /*
316          * Unmask asynchronous aborts and fiq after bringing up possible
317          * earlycon. (Report possible System Errors once we can report this
318          * occurred).
319          */
320         local_daif_restore(DAIF_PROCCTX_NOIRQ);
321
322         /*
323          * TTBR0 is only used for the identity mapping at this stage. Make it
324          * point to zero page to avoid speculatively fetching new entries.
325          */
326         cpu_uninstall_idmap();
327
328         xen_early_init();
329         efi_init();
330

331         if (!efi_enabled(EFI_BOOT) && ((u64)_text % MIN_KIMG_ALIGN) != 0)
332              pr_warn(FW_BUG "Kernel image misaligned at boot, please fix your bootloader!");
333
334         arm64_memblock_init();
335
336         paging_init();
337

338         acpi_table_upgrade();
339
340         /* Parse the ACPI tables for possible boot-time configuration */
341         acpi_boot_table_init();
342
343         if (acpi_disabled)
344                 unflatten_device_tree();
345
346         bootmem_init();
347
348         kasan_init();
349
350         request_standard_resources();
351
352         early_ioremap_reset();
353
354         if (acpi_disabled)
355                 psci_dt_init();
356         else
357                 psci_acpi_init();
358
359         init_bootcpu_ops();
360         smp_init_cpus();
361         smp_build_mpidr_hash();
362
363         /* Init percpu seeds for random tags after cpus are set up. */
364         kasan_init_sw_tags();
365
366 #ifdef CONFIG_ARM64_SW_TTBR0_PAN
367         /*
368          * Make sure init_thread_info.ttbr0 always generates translation
369          * faults in case uaccess_enable() is inadvertently called by the init
370          * thread.
371          */
372         init_task.thread_info.ttbr0 = phys_to_ttbr(__pa_symbol(reserved_pg_dir));
373 #endif
374

375         if (boot_args[1] || boot_args[2] || boot_args[3]) {
376                 pr_err("WARNING: x1-x3 nonzero in violation of boot protocol:\n"
377                         "\tx1: %016llx\n\tx2: %016llx\n\tx3: %016llx\n"
378                         "This indicates a broken bootloader or old kernel\n",
379                         boot_args[1], boot_args[2], boot_args[3]);
380         }
381 }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

'linux' 카테고리의 다른 글

6.1/early_ioremap_init(void)  (0) 2025.03.29
6.1/fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot)  (0) 2023.12.19
6.1/early_fixmap_init(void)  (0) 2023.12.18
6.1/early_fdt_map(u64 dt_phys)  (0) 2023.12.18
6.1/Head.S  (0) 2023.11.16

+ Recent posts