mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
Per architecture restorer trampolines
Some architectures like ppc64 requires a trampoline to be called prior to the standard restorer services. This patch introduces 3 trampolines which can be overwritten by architectures in arch/x/include/asm/restore.h: - arch_export_restore_thread - arch_export_restore_task - arch_export_unmap The architecture which doesn't need to overwrite them, has nothing to do. Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
303b875892
commit
de9df91002
@@ -30,4 +30,7 @@
|
||||
|
||||
int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core);
|
||||
|
||||
#define arch_export_restore_task __export_restore_task_trampoline
|
||||
#define arch_export_unmap __export_unmap_trampoline
|
||||
|
||||
#endif /* __CR_ASM_RESTORE_H__ */
|
||||
|
23
cr-restore.c
23
cr-restore.c
@@ -90,6 +90,18 @@
|
||||
|
||||
#include "cr-errno.h"
|
||||
|
||||
#ifndef arch_export_restore_thread
|
||||
#define arch_export_restore_thread __export_restore_thread
|
||||
#endif
|
||||
|
||||
#ifndef arch_export_restore_task
|
||||
#define arch_export_restore_task __export_restore_task
|
||||
#endif
|
||||
|
||||
#ifndef arch_export_unmap
|
||||
#define arch_export_unmap __export_unmap
|
||||
#endif
|
||||
|
||||
static struct pstree_item *current;
|
||||
|
||||
static int restore_task_with_children(void *);
|
||||
@@ -2750,14 +2762,9 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
|
||||
* Prepare a memory map for restorer. Note a thread space
|
||||
* might be completely unused so it's here just for convenience.
|
||||
*/
|
||||
restore_thread_exec_start = restorer_sym(exec_mem_hint, __export_restore_thread);
|
||||
#ifdef CONFIG_PPC64
|
||||
restore_task_exec_start = restorer_sym(exec_mem_hint, __export_restore_task_trampoline);
|
||||
rsti(current)->munmap_restorer = restorer_sym(exec_mem_hint, __export_unmap_trampoline);
|
||||
#else
|
||||
restore_task_exec_start = restorer_sym(exec_mem_hint, __export_restore_task);
|
||||
rsti(current)->munmap_restorer = restorer_sym(exec_mem_hint, __export_unmap);
|
||||
#endif
|
||||
restore_thread_exec_start = restorer_sym(exec_mem_hint, arch_export_restore_thread);
|
||||
restore_task_exec_start = restorer_sym(exec_mem_hint, arch_export_restore_task);
|
||||
rsti(current)->munmap_restorer = restorer_sym(exec_mem_hint, arch_export_unmap);
|
||||
|
||||
exec_mem_hint += restorer_len;
|
||||
|
||||
|
@@ -195,6 +195,8 @@ enum {
|
||||
|
||||
|
||||
/* the restorer_blob_offset__ prefix is added by gen_offsets.sh */
|
||||
#define restorer_sym(rblob, name) ((void *)(rblob) + restorer_blob_offset__##name)
|
||||
#define __blob_offset(name) restorer_blob_offset__ ## name
|
||||
#define _blob_offset(name) __blob_offset(name)
|
||||
#define restorer_sym(rblob, name) (void*)(rblob + _blob_offset(name))
|
||||
|
||||
#endif /* __CR_RESTORER_H__ */
|
||||
|
Reference in New Issue
Block a user