mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 15:06:53 +07:00
cb1052581e
Previous patch provided the interface definition and this patch prvides implementation of new syscall. Previously segment list was prepared in user space. Now user space just passes kernel fd, initrd fd and command line and kernel will create a segment list internally. This patch contains generic part of the code. Actual segment preparation and loading is done by arch and image specific loader. Which comes in next patch. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Cc: Borislav Petkov <bp@suse.de> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Yinghai Lu <yinghai@kernel.org> Cc: Eric Biederman <ebiederm@xmission.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Greg Kroah-Hartman <greg@kroah.com> Cc: Dave Young <dyoung@redhat.com> Cc: WANG Chao <chaowang@redhat.com> Cc: Baoquan He <bhe@redhat.com> Cc: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
67 lines
2.0 KiB
C
67 lines
2.0 KiB
C
#ifndef _UAPILINUX_KEXEC_H
|
|
#define _UAPILINUX_KEXEC_H
|
|
|
|
/* kexec system call - It loads the new kernel to boot into.
|
|
* kexec does not sync, or unmount filesystems so if you need
|
|
* that to happen you need to do that yourself.
|
|
*/
|
|
|
|
#include <linux/types.h>
|
|
|
|
/* kexec flags for different usage scenarios */
|
|
#define KEXEC_ON_CRASH 0x00000001
|
|
#define KEXEC_PRESERVE_CONTEXT 0x00000002
|
|
#define KEXEC_ARCH_MASK 0xffff0000
|
|
|
|
/*
|
|
* 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.
|
|
*/
|
|
#define KEXEC_FILE_UNLOAD 0x00000001
|
|
#define KEXEC_FILE_ON_CRASH 0x00000002
|
|
#define KEXEC_FILE_NO_INITRAMFS 0x00000004
|
|
|
|
/* These values match the ELF architecture values.
|
|
* Unless there is a good reason that should continue to be the case.
|
|
*/
|
|
#define KEXEC_ARCH_DEFAULT ( 0 << 16)
|
|
#define KEXEC_ARCH_386 ( 3 << 16)
|
|
#define KEXEC_ARCH_68K ( 4 << 16)
|
|
#define KEXEC_ARCH_X86_64 (62 << 16)
|
|
#define KEXEC_ARCH_PPC (20 << 16)
|
|
#define KEXEC_ARCH_PPC64 (21 << 16)
|
|
#define KEXEC_ARCH_IA_64 (50 << 16)
|
|
#define KEXEC_ARCH_ARM (40 << 16)
|
|
#define KEXEC_ARCH_S390 (22 << 16)
|
|
#define KEXEC_ARCH_SH (42 << 16)
|
|
#define KEXEC_ARCH_MIPS_LE (10 << 16)
|
|
#define KEXEC_ARCH_MIPS ( 8 << 16)
|
|
|
|
/* The artificial cap on the number of segments passed to kexec_load. */
|
|
#define KEXEC_SEGMENT_MAX 16
|
|
|
|
#ifndef __KERNEL__
|
|
/*
|
|
* This structure is used to hold the arguments that are used when
|
|
* loading kernel binaries.
|
|
*/
|
|
struct kexec_segment {
|
|
const void *buf;
|
|
size_t bufsz;
|
|
const void *mem;
|
|
size_t memsz;
|
|
};
|
|
|
|
/* Load a new kernel image as described by the kexec_segment array
|
|
* consisting of passed number of segments at the entry-point address.
|
|
* The flags allow different useage types.
|
|
*/
|
|
extern int kexec_load(void *, size_t, struct kexec_segment *,
|
|
unsigned long int);
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* _UAPILINUX_KEXEC_H */
|