[Devel] [C/R v20][PATCH 90/96] powerpc: wire up checkpoint and restart syscalls
Oren Laadan
orenl at cs.columbia.edu
Wed Mar 17 09:09:18 PDT 2010
From: Nathan Lynch <ntl at pobox.com>
Changelog [v19]:
- checkpoint/powerpc: fix up checkpoint syscall, tidy restart
Signed-off-by: Nathan Lynch <ntl at pobox.com>
Acked-by: Serge E. Hallyn <serue at us.ibm.com>
---
arch/powerpc/include/asm/systbl.h | 2 ++
arch/powerpc/include/asm/unistd.h | 4 +++-
arch/powerpc/kernel/entry_32.S | 23 +++++++++++++++++++++++
arch/powerpc/kernel/entry_64.S | 16 ++++++++++++++++
arch/powerpc/kernel/process.c | 19 +++++++++++++++++++
5 files changed, 63 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index ee41254..2c1dd27 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -327,3 +327,5 @@ COMPAT_SYS_SPU(preadv)
COMPAT_SYS_SPU(pwritev)
COMPAT_SYS(rt_tgsigqueueinfo)
PPC_SYS(eclone)
+PPC_SYS(checkpoint)
+PPC_SYS(restart)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 37357a2..1551242 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -346,10 +346,12 @@
#define __NR_pwritev 321
#define __NR_rt_tgsigqueueinfo 322
#define __NR_eclone 323
+#define __NR_checkpoint 324
+#define __NR_restart 325
#ifdef __KERNEL__
-#define __NR_syscalls 324
+#define __NR_syscalls 326
#define __NR__exit __NR_exit
#define NR_syscalls __NR_syscalls
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 579f1da..853814b 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -594,6 +594,29 @@ ppc_eclone:
stw r0,_TRAP(r1) /* register set saved */
b sys_eclone
+/* To handle self-checkpoint we must save nvpgprs */
+ .globl ppc_checkpoint
+ppc_checkpoint:
+ SAVE_NVGPRS(r1)
+ lwz r0,_TRAP(r1)
+ rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
+ stw r0,_TRAP(r1) /* register set saved */
+ b sys_checkpoint
+
+/* The full register set must be restored upon return from restart.
+ * Save nvgprs unconditionally so the caller's state is
+ * restored correctly in case of error.
+ */
+ .globl ppc_restart
+ppc_restart:
+ SAVE_NVGPRS(r1)
+ lwz r0,_TRAP(r1)
+ rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
+ stw r0,_TRAP(r1) /* register set saved */
+ bl sys_restart
+ REST_NVGPRS(r1)
+ b ret_from_syscall
+
.globl ppc_swapcontext
ppc_swapcontext:
SAVE_NVGPRS(r1)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 899f485..87ebb04 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -349,6 +349,22 @@ _GLOBAL(ppc_eclone)
bl .sys_eclone
b syscall_exit
+/* To handle self-checkpoint we must save nvpgprs */
+_GLOBAL(ppc_checkpoint)
+ bl .save_nvgprs
+ bl .sys_checkpoint
+ b syscall_exit
+
+/* The full register set must be restored upon return from restart.
+ * Save nvgprs unconditionally so the caller's state is
+ * restored correctly in case of error.
+ */
+_GLOBAL(ppc_restart)
+ bl .save_nvgprs
+ bl .sys_restart
+ REST_NVGPRS(r1)
+ b syscall_exit
+
_GLOBAL(ppc32_swapcontext)
bl .save_nvgprs
bl .compat_sys_swapcontext
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 4bbc21f..6457530 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -30,6 +30,7 @@
#include <linux/init_task.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
+#include <linux/checkpoint.h>
#include <linux/mqueue.h>
#include <linux/hardirq.h>
#include <linux/utsname.h>
@@ -978,6 +979,24 @@ out:
return error;
}
+int sys_checkpoint(unsigned long pid, unsigned long fd, unsigned long flags,
+ unsigned long logfd, unsigned long p5, unsigned long p6,
+ struct pt_regs *regs)
+{
+ CHECK_FULL_REGS(regs);
+
+ return do_sys_checkpoint(pid, fd, flags, logfd);
+}
+
+int sys_restart(unsigned long pid, unsigned long fd, unsigned long flags,
+ unsigned long logfd, unsigned long p5, unsigned long p6,
+ struct pt_regs *regs)
+{
+ CHECK_FULL_REGS(regs);
+
+ return do_sys_restart(pid, fd, flags, logfd);
+}
+
#ifdef CONFIG_IRQSTACKS
static inline int valid_irq_stack(unsigned long sp, struct task_struct *p,
unsigned long nbytes)
--
1.6.3.3
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list