Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 1 | From ab24f236cbc0aa8a3eadde5d71d9d7ea1d979a51 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 2 | From: Andrea Adami <andrea.adami@gmail.com> |
| 3 | Date: Fri, 31 Aug 2018 11:33:51 +0200 |
| 4 | Subject: [PATCH] kexec-syscall.h: work around missing syscall() wrapper |
| 5 | |
| 6 | Fix |
| 7 | |
| 8 | kexec-syscall.h: In function 'kexec_load': |
| 9 | kexec-syscall.h:80:16: warning: implicit declaration of function 'syscall' |
| 10 | |
| 11 | Upstream-Status: Inappropriate [klibc specific] |
| 12 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 13 | |
| 14 | --- |
| 15 | kexec/kexec-syscall.h | 21 +++++++++++++++++++++ |
| 16 | 1 file changed, 21 insertions(+) |
| 17 | |
| 18 | diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 19 | index b96e02a..2a3794d 100644 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 20 | --- a/kexec/kexec-syscall.h |
| 21 | +++ b/kexec/kexec-syscall.h |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 22 | @@ -77,11 +77,16 @@ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 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) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 39 | @@ -89,6 +94,21 @@ static inline int is_kexec_file_load_implemented(void) { |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 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) |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame^] | 61 | @@ -96,6 +116,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd, |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 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 |