Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kexec_file.c Create Date:2022-07-28 11:04:13
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:SYSCALL_DEFINE5

Proto:SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd, unsigned long, cmdline_len, const char __user *, cmdline_ptr, unsigned long, flags)

Type:

Parameter:Nothing

374  ret = 0
378  If Not Check operation authority || kexec_load_disabled Then Return -EPERM
382  If prefix, newline flags != (prefix, newline flags & List of defined/legal kexec file flags ) Then Return -EINVAL
385  image = NULL
387  If Not mutex_trylock - try to acquire the mutex, without waiting*@lock: the mutex to be acquired* Try to acquire the mutex atomically Then Return -EBUSY
390  dest_image = kexec_image
391  If prefix, newline flags & KEXEC_FILE_ON_CRASH Then
392  dest_image = kexec_crash_image
393  If kexec_crash_image Then arch_kexec_unprotect_crashkres()
397  If prefix, newline flags & Kexec file load interface flags.* KEXEC_FILE_UNLOAD : Unload already loaded kexec/kdump image.* KEXEC_FILE_ON_CRASH : Load/unload operation belongs to kdump image.* KEXEC_FILE_NO_INITRAMFS : No initramfs is being loaded. Ignore the initrd* fd field. Then Go to exchange
405  If prefix, newline flags & KEXEC_FILE_ON_CRASH Then kimage_free(xchg( & kexec_crash_image, NULL))
408  ret = kimage_file_alloc_init( & image, kernel_fd, initrd_fd, cmdline_ptr, cmdline_len, prefix, newline flags )
410  If ret Then Go to out
413  ret = A architecture hook called to validate the* proposed image and prepare the control pages* as needed
414  If ret Then Go to out
421  ret = kimage_crash_copy_vmcoreinfo(image)
422  If ret Then Go to out
425  ret = kexec_calculate_store_digests(image)
426  If ret Then Go to out
429  When i < nr_segments cycle
432  ksegment = segment[i]
433  pr_debug("Loading segment %d: buf=0x%p bufsz=0x%zx mem=0x%lx memsz=0x%zx\n", i, buf, bufsz, mem, memsz)
437  ret = kimage_load_segment(image, & segment[i])
438  If ret Then Go to out
442  kimage_terminate(image)
448  Free up memory used by kernel, initrd, and command line. This is temporary* memory allocation which is not needed any more after these buffers have* been loaded into separate segments and have been copied elsewhere.
449  exchange :
450  image = xchg(dest_image, image)
451  out :
452  If prefix, newline flags & KEXEC_FILE_ON_CRASH && kexec_crash_image Then Protection mechanism for crashkernel reserved memory after* the kdump kernel is loaded.* Provide an empty default implementation here -- architecture* code may override this
455  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
456  kimage_free(image)
457  Return ret