Function report |
Source Code:arch\x86\kernel\kexec-bzimage64.c |
Create Date:2022-07-28 08:37:47 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:bzImage64_load
Proto:static void *bzImage64_load(struct kimage *image, char *kernel, unsigned long kernel_len, char *initrd, unsigned long initrd_len, char *cmdline, unsigned long cmdline_len)
Type:void
Parameter:
Type | Parameter | Name |
---|---|---|
struct kimage * | image | |
char * | kernel | |
unsigned long | kernel_len | |
char * | initrd | |
unsigned long | initrd_len | |
char * | cmdline | |
unsigned long | cmdline_len |
342 | ret = 0 |
349 | setup_hdr_offset = offsetof(structboot_params, hdr) |
356 | header = kernel + setup_hdr_offset |
357 | setup_sects = setup_sects |
358 | If setup_sects == 0 Then setup_sects = 4 |
361 | kern16_size = (setup_sects + 1) * 512 |
362 | If kernel_len < kern16_size Then |
367 | If cmdline_len > cmdline_size Then |
376 | If cmdline_len + lfcorehdr=0x<64bit-value> > cmdline_size Then |
377 | pr_debug("Appending elfcorehdr=<addr> to command line exceeds maximum allowed length\n") |
382 | If Flags to indicate special processing == KEXEC_TYPE_CRASH Then |
392 | ret = kexec_load_purgatory(image, & pbuf) |
393 | If ret Then |
409 | efi_map_sz = efi_get_runtime_map_size() |
410 | params_cmdline_sz = size of boot_params + cmdline_len + lfcorehdr=0x<64bit-value> |
413 | bufsz = params_cmdline_sz + @a is a power of 2 value (efi_map_sz, 16) + sizeof(structsetup_data) + sizeof(structefi_setup_data) |
417 | params = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
424 | setup_header_size = 0x0202 + kernel[0x0201] - setup_hdr_offset |
427 | memcpy( & setup header , (kernel + setup_hdr_offset), setup_header_size) |
431 | buf_align = 16 |
432 | buf_min = MIN_BOOTPARAM_ADDR |
433 | ret = kexec_add_buffer( & kbuf) |
434 | If ret Then Go to out_free_params |
436 | bootparam_load_addr = mem |
437 | pr_debug("Loaded boot_param, command line and misc at 0x%lx bufsz=0x%lx memsz=0x%lx\n", bootparam_load_addr, bufsz, bufsz) |
441 | buffer = kernel + kern16_size |
442 | bufsz = kernel_len - kern16_size |
444 | buf_align = kernel_alignment |
445 | buf_min = MIN_KERNEL_LOAD_ADDR |
446 | mem = If kexec_buf.mem is set to this value, kexec_locate_mem_hole()* will try to allocate free memory. Arch may overwrite it. |
447 | ret = kexec_add_buffer( & kbuf) |
448 | If ret Then Go to out_free_params |
450 | kernel_load_addr = mem |
452 | pr_debug("Loaded 64bit kernel at 0x%lx bufsz=0x%lx memsz=0x%lx\n", kernel_load_addr, bufsz, memsz) |
456 | If initrd Then |
458 | bufsz = memsz = initrd_len |
460 | buf_min = MIN_INITRD_LOAD_ADDR |
461 | mem = If kexec_buf.mem is set to this value, kexec_locate_mem_hole()* will try to allocate free memory. Arch may overwrite it. |
462 | ret = kexec_add_buffer( & kbuf) |
463 | If ret Then Go to out_free_params |
465 | initrd_load_addr = mem |
467 | pr_debug("Loaded initrd at 0x%lx bufsz=0x%lx memsz=0x%lx\n", initrd_load_addr, initrd_len, initrd_len) |
473 | setup_cmdline(image, params, bootparam_load_addr, size of boot_params , cmdline, cmdline_len) |
477 | type_of_loader = 0x0D << 4 |
478 | loadflags = 0 |
481 | ret = kexec_purgatory_get_set_symbol(image, "entry64_regs", & regs64, size of regs64 , 1) |
483 | If ret Then Go to out_free_params |
486 | rbx = 0 |
487 | rsi = bootparam_load_addr |
488 | rip = kernel_load_addr + 0x200 |
489 | stack = kexec_purgatory_get_symbol_addr(image, "stack_end") |
491 | pr_err("Could not find address of symbol stack_end\n") |
493 | Go to out_free_params |
497 | ret = kexec_purgatory_get_set_symbol(image, "entry64_regs", & regs64, size of regs64 , 0) |
499 | If ret Then Go to out_free_params |
502 | ret = setup_boot_parameters(image, params, bootparam_load_addr, efi_map_offset, efi_map_sz, efi_setup_data_offset) |
505 | If ret Then Go to out_free_params |
509 | ldata = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
510 | If Not ldata Then |
512 | Go to out_free_params |
520 | Temporary buffer to hold bootparams buffer. This should be* freed once the bootparam segment has been loaded. = params |
521 | Return ldata |
523 | out_free_params : |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |