/* * The lucky hart to first increment this variable will boot the other cores. * This is used before the kernel initializes the BSS so it can't be in the * BSS.
*/
atomic_t hart_lottery __section(".sdata") #ifdef CONFIG_XIP_KERNEL
= ATOMIC_INIT(0xC001BEEF) #endif
; unsignedlong boot_cpu_hartid;
EXPORT_SYMBOL_GPL(boot_cpu_hartid);
/* * Place kernel memory regions on the resource tree so that * kexec-tools can retrieve them from /proc/iomem. While there * also add "System RAM" regions for compatibility with other * archs, and the rest of the known regions for completeness.
*/ staticstruct resource kimage_res = { .name = "Kernel image", }; staticstruct resource code_res = { .name = "Kernel code", }; staticstruct resource data_res = { .name = "Kernel data", }; staticstruct resource rodata_res = { .name = "Kernel rodata", }; staticstruct resource bss_res = { .name = "Kernel bss", }; #ifdef CONFIG_CRASH_DUMP staticstruct resource elfcorehdr_res = { .name = "ELF Core hdr", }; #endif
staticint __init add_resource(struct resource *parent, struct resource *res)
{ int ret = 0;
ret = insert_resource(parent, res); if (ret < 0) {
pr_err("Failed to add a %s resource at %llx\n",
res->name, (unsignedlonglong) res->start); return ret;
}
return 1;
}
staticint __init add_kernel_resources(void)
{ int ret = 0;
/* * The memory region of the kernel image is continuous and * was reserved on setup_bootmem, register it here as a * resource, with the various segments of the image as * child nodes.
*/
/* * Start by adding the reserved regions, if they overlap * with /memory regions, insert_resource later on will take * care of it.
*/
ret = add_kernel_resources(); if (ret < 0) goto error;
/* * Ignore any other reserved regions within * system memory.
*/ if (memblock_is_memory(res->start)) { /* Re-use this pre-allocated resource */
res_idx++; continue;
}
ret = add_resource(&iomem_resource, res); if (ret < 0) goto error;
}
/* Add /memory regions to the resource tree */
for_each_mem_region(region) {
res = &mem_res[res_idx--];
non_resv_res++;
staticvoid __init parse_dtb(void)
{ /* Early scan of device tree from init memory */ if (early_init_dt_scan(dtb_early_va, dtb_early_pa)) { constchar *name = of_flat_dt_get_machine_name();
if (name) {
pr_info("Machine model: %s\n", name);
dump_stack_set_arch_desc("%s (DT)", name);
}
} else {
pr_err("No DTB passed to the kernel\n");
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.