blob: 3020f767add98147745c87c7e296a6648093f75a [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 45a80fe7d247898d83edfeabe32b9de80a50a6be Mon Sep 17 00:00:00 2001
2From: Andrea Adami <andrea.adami@gmail.com>
3Date: Fri, 31 Aug 2018 11:33:51 +0200
4Subject: [PATCH] kexec-syscall.h: work around missing syscall() wrapper
5
6Fix
7
8 kexec-syscall.h: In function 'kexec_load':
9 kexec-syscall.h:80:16: warning: implicit declaration of function 'syscall'
10
11Upstream-Status: Inappropriate [klibc specific]
12Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
13
14---
15 kexec/kexec-syscall.h | 21 +++++++++++++++++++++
16 1 file changed, 21 insertions(+)
17
18diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
19index 33638c2..204007d 100644
20--- a/kexec/kexec-syscall.h
21+++ b/kexec/kexec-syscall.h
22@@ -74,11 +74,16 @@
23
24 struct kexec_segment;
25
26+#ifndef __KLIBC__
27 static inline long kexec_load(void *entry, unsigned long nr_segments,
28 struct kexec_segment *segments, unsigned long flags)
29 {
30 return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags);
31 }
32+#else
33+extern long kexec_load(void *entry, unsigned long nr_segments,
34+ struct kexec_segment *segments, unsigned long flags);
35+#endif
36
37 static inline int is_kexec_file_load_implemented(void) {
38 if (__NR_kexec_file_load != 0xffffffff)
39@@ -86,6 +91,21 @@ static inline int is_kexec_file_load_implemented(void) {
40 return 0;
41 }
42
43+#ifdef __KLIBC__
44+/* Stub provided by klibc only for the following archs */
45+#if defined (__x86_64__) || defined (__powerpc_64__) || defined (__s390x__)
46+extern long kexec_file_load(int kernel_fd, int initrd_fd,
47+ unsigned long cmdline_len, const char *cmdline_ptr,
48+ unsigned long flags);
49+#else
50+static inline long kexec_file_load(int kernel_fd, int initrd_fd,
51+ unsigned long cmdline_len, const char *cmdline_ptr,
52+ unsigned long flags)
53+{
54+ return -1;
55+}
56+#endif
57+#else
58 static inline long kexec_file_load(int kernel_fd, int initrd_fd,
59 unsigned long cmdline_len, const char *cmdline_ptr,
60 unsigned long flags)
61@@ -93,6 +113,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,
62 return (long) syscall(__NR_kexec_file_load, kernel_fd, initrd_fd,
63 cmdline_len, cmdline_ptr, flags);
64 }
65+#endif
66
67 #define KEXEC_ON_CRASH 0x00000001
68 #define KEXEC_PRESERVE_CONTEXT 0x00000002
69--
702.7.4
71