Commit c450028f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] reserve syscall slots for kexec

From: "Randy.Dunlap" <rddunlap@osdl.org>

kexec is a fairly major and popular feature.  People are shipping it in
products, although it is not known if Linux distributors plan to ship it.

The patch reserves the kexec syscall slots to pin the ABI down for
everyone.


- add kexec_load prototype to syscalls.h

- add LINUX_REBOOT_CMD_KEXEC to reboot.h

- add kexec_load syscall for ia32, ia64, x86_64, ppc32, ppc64
parent d06d15d2
...@@ -885,5 +885,6 @@ ENTRY(sys_call_table) ...@@ -885,5 +885,6 @@ ENTRY(sys_call_table)
.long sys_mq_timedreceive /* 280 */ .long sys_mq_timedreceive /* 280 */
.long sys_mq_notify .long sys_mq_notify
.long sys_mq_getsetattr .long sys_mq_getsetattr
.long sys_ni_syscall /* reserved for kexec */
syscall_table_size=(.-sys_call_table) syscall_table_size=(.-sys_call_table)
...@@ -1510,7 +1510,7 @@ sys_call_table: ...@@ -1510,7 +1510,7 @@ sys_call_table:
data8 sys_mq_timedreceive // 1265 data8 sys_mq_timedreceive // 1265
data8 sys_mq_notify data8 sys_mq_notify
data8 sys_mq_getsetattr data8 sys_mq_getsetattr
data8 sys_ni_syscall data8 sys_ni_syscall // reserved for kexec_load
data8 sys_ni_syscall data8 sys_ni_syscall
data8 sys_ni_syscall // 1270 data8 sys_ni_syscall // 1270
data8 sys_ni_syscall data8 sys_ni_syscall
......
...@@ -857,7 +857,7 @@ fsyscall_table: ...@@ -857,7 +857,7 @@ fsyscall_table:
data8 0 // mq_timedreceive // 1265 data8 0 // mq_timedreceive // 1265
data8 0 // mq_notify data8 0 // mq_notify
data8 0 // mq_getsetattr data8 0 // mq_getsetattr
data8 0 data8 0 // kexec_load
data8 0 data8 0
data8 0 // 1270 data8 0 // 1270
data8 0 data8 0
......
...@@ -1397,3 +1397,4 @@ _GLOBAL(sys_call_table) ...@@ -1397,3 +1397,4 @@ _GLOBAL(sys_call_table)
.long sys_mq_timedreceive /* 265 */ .long sys_mq_timedreceive /* 265 */
.long sys_mq_notify .long sys_mq_notify
.long sys_mq_getsetattr .long sys_mq_getsetattr
.long sys_ni_syscall /* 268 reserved for sys_kexec_load */
...@@ -850,6 +850,7 @@ _GLOBAL(sys_call_table32) ...@@ -850,6 +850,7 @@ _GLOBAL(sys_call_table32)
.llong .compat_sys_mq_timedreceive /* 265 */ .llong .compat_sys_mq_timedreceive /* 265 */
.llong .compat_sys_mq_notify .llong .compat_sys_mq_notify
.llong .compat_sys_mq_getsetattr .llong .compat_sys_mq_getsetattr
.llong .sys_ni_syscall /* 268 reserved for sys_kexec_load */
.balign 8 .balign 8
_GLOBAL(sys_call_table) _GLOBAL(sys_call_table)
...@@ -1121,3 +1122,4 @@ _GLOBAL(sys_call_table) ...@@ -1121,3 +1122,4 @@ _GLOBAL(sys_call_table)
.llong .sys_mq_timedreceive /* 265 */ .llong .sys_mq_timedreceive /* 265 */
.llong .sys_mq_notify .llong .sys_mq_notify
.llong .sys_mq_getsetattr .llong .sys_mq_getsetattr
.llong .sys_ni_syscall /* 268 reserved for sys_kexec_load */
...@@ -288,8 +288,9 @@ ...@@ -288,8 +288,9 @@
#define __NR_mq_timedreceive (__NR_mq_open+3) #define __NR_mq_timedreceive (__NR_mq_open+3)
#define __NR_mq_notify (__NR_mq_open+4) #define __NR_mq_notify (__NR_mq_open+4)
#define __NR_mq_getsetattr (__NR_mq_open+5) #define __NR_mq_getsetattr (__NR_mq_open+5)
#define __NR_sys_kexec_load 283
#define NR_syscalls 283 #define NR_syscalls 284
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */ /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
......
...@@ -257,6 +257,7 @@ ...@@ -257,6 +257,7 @@
#define __NR_mq_timedreceive 1265 #define __NR_mq_timedreceive 1265
#define __NR_mq_notify 1266 #define __NR_mq_notify 1266
#define __NR_mq_getsetattr 1267 #define __NR_mq_getsetattr 1267
#define __NR_kexec_load 1268
#ifdef __KERNEL__ #ifdef __KERNEL__
......
...@@ -272,8 +272,9 @@ ...@@ -272,8 +272,9 @@
#define __NR_mq_timedreceive 265 #define __NR_mq_timedreceive 265
#define __NR_mq_notify 266 #define __NR_mq_notify 266
#define __NR_mq_getsetattr 267 #define __NR_mq_getsetattr 267
#define __NR_kexec_load 268
#define __NR_syscalls 268 #define __NR_syscalls 269
#define __NR(n) #n #define __NR(n) #n
......
...@@ -278,8 +278,9 @@ ...@@ -278,8 +278,9 @@
#define __NR_mq_timedreceive 265 #define __NR_mq_timedreceive 265
#define __NR_mq_notify 266 #define __NR_mq_notify 266
#define __NR_mq_getsetattr 267 #define __NR_mq_getsetattr 267
#define __NR_kexec_load 268
#define __NR_syscalls 268 #define __NR_syscalls 269
#ifdef __KERNEL__ #ifdef __KERNEL__
#define NR_syscalls __NR_syscalls #define NR_syscalls __NR_syscalls
#endif #endif
......
...@@ -552,8 +552,10 @@ __SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive) ...@@ -552,8 +552,10 @@ __SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
__SYSCALL(__NR_mq_notify, sys_mq_notify) __SYSCALL(__NR_mq_notify, sys_mq_notify)
#define __NR_mq_getsetattr 245 #define __NR_mq_getsetattr 245
__SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr) __SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)
#define __NR_kexec_load 246
__SYSCALL(__NR_kexec_load, sys_ni_syscall)
#define __NR_syscall_max __NR_mq_getsetattr #define __NR_syscall_max __NR_kexec_load
#ifndef __NO_STUBS #ifndef __NO_STUBS
/* user-visible error numbers are in the range -1 - -4095 */ /* user-visible error numbers are in the range -1 - -4095 */
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* POWER_OFF Stop OS and remove all power from system, if possible. * POWER_OFF Stop OS and remove all power from system, if possible.
* RESTART2 Restart system using given command string. * RESTART2 Restart system using given command string.
* SW_SUSPEND Suspend system using software suspend if compiled in. * SW_SUSPEND Suspend system using software suspend if compiled in.
* KEXEC Restart system using a previously loaded Linux kernel
*/ */
#define LINUX_REBOOT_CMD_RESTART 0x01234567 #define LINUX_REBOOT_CMD_RESTART 0x01234567
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC #define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC
#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2 #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
#define LINUX_REBOOT_CMD_KEXEC 0x45584543
#ifdef __KERNEL__ #ifdef __KERNEL__
......
...@@ -19,6 +19,7 @@ struct io_event; ...@@ -19,6 +19,7 @@ struct io_event;
struct iovec; struct iovec;
struct itimerspec; struct itimerspec;
struct itimerval; struct itimerval;
struct kexec_segment;
struct linux_dirent; struct linux_dirent;
struct linux_dirent64; struct linux_dirent64;
struct list_head; struct list_head;
...@@ -154,6 +155,8 @@ asmlinkage long sys_shutdown(int, int); ...@@ -154,6 +155,8 @@ asmlinkage long sys_shutdown(int, int);
asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd,
void __user *arg); void __user *arg);
asmlinkage long sys_restart_syscall(void); asmlinkage long sys_restart_syscall(void);
asmlinkage long sys_kexec_load(void *entry, unsigned long nr_segments,
struct kexec_segment *segments, unsigned long flags);
asmlinkage long sys_exit(int error_code); asmlinkage long sys_exit(int error_code);
asmlinkage void sys_exit_group(int error_code); asmlinkage void sys_exit_group(int error_code);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment