summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2014-02-05 13:48:26 +0000
committerDmitry V. Levin <ldv@altlinux.org>2014-02-05 14:25:20 +0000
commit90aa9f4d72e26581ea0a39c02db625d7bd4e2962 (patch)
tree3bab8cebbe335010cb7ee1402904320e78e649e7 /linux
parentd21f186a94086fae25788e14c584fcce52bd67b6 (diff)
downloadstrace-90aa9f4d72e26581ea0a39c02db625d7bd4e2962.tar.gz
strace-90aa9f4d72e26581ea0a39c02db625d7bd4e2962.tar.bz2
strace-90aa9f4d72e26581ea0a39c02db625d7bd4e2962.tar.xz
Implement kexec_load decoding
* kexec.c: New file. * linux/kexec.h: Likewise. * Makefile.am (strace_SOURCES): Add kexec.c. (EXTRA_DIST): Add linux/kexec.h. * linux/dummy.h (sys_kexec_load): Remove. * linux/syscall.h (sys_kexec_load): New prototype.
Diffstat (limited to 'linux')
-rw-r--r--linux/dummy.h1
-rw-r--r--linux/kexec.h50
-rw-r--r--linux/syscall.h1
3 files changed, 51 insertions, 1 deletions
diff --git a/linux/dummy.h b/linux/dummy.h
index 979ed37..78d264f 100644
--- a/linux/dummy.h
+++ b/linux/dummy.h
@@ -39,7 +39,6 @@
#define sys_ioprio_get printargs
#define sys_ioprio_set printargs
#define sys_kcmp printargs
-#define sys_kexec_load printargs
#define sys_keyctl printargs
#define sys_lookup_dcookie printargs
#define sys_name_to_handle_at printargs
diff --git a/linux/kexec.h b/linux/kexec.h
new file mode 100644
index 0000000..767ccb5
--- /dev/null
+++ b/linux/kexec.h
@@ -0,0 +1,50 @@
+#ifndef LINUX_KEXEC_H
+#define LINUX_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.
+ */
+
+/* kexec flags for different usage scenarios */
+#define KEXEC_ON_CRASH 0x00000001
+#define KEXEC_PRESERVE_CONTEXT 0x00000002
+#define KEXEC_ARCH_MASK 0xffff0000
+
+/* 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_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
+
+/*
+ * 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 /* LINUX_KEXEC_H */
diff --git a/linux/syscall.h b/linux/syscall.h
index d2ba126..d8ce91f 100644
--- a/linux/syscall.h
+++ b/linux/syscall.h
@@ -121,6 +121,7 @@ int sys_io_setup();
int sys_io_submit();
int sys_ioctl();
int sys_ipc();
+int sys_kexec_load();
int sys_kill();
int sys_link();
int sys_linkat();