Commit de9df910 authored by Laurent Dufour's avatar Laurent Dufour Committed by Pavel Emelyanov

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: 's avatarLaurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 303b8758
...@@ -30,4 +30,7 @@ ...@@ -30,4 +30,7 @@
int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core); 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__ */ #endif /* __CR_ASM_RESTORE_H__ */
...@@ -90,6 +90,18 @@ ...@@ -90,6 +90,18 @@
#include "cr-errno.h" #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 struct pstree_item *current;
static int restore_task_with_children(void *); static int restore_task_with_children(void *);
...@@ -2750,14 +2762,9 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core) ...@@ -2750,14 +2762,9 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
* Prepare a memory map for restorer. Note a thread space * Prepare a memory map for restorer. Note a thread space
* might be completely unused so it's here just for convenience. * might be completely unused so it's here just for convenience.
*/ */
restore_thread_exec_start = restorer_sym(exec_mem_hint, __export_restore_thread); restore_thread_exec_start = restorer_sym(exec_mem_hint, arch_export_restore_thread);
#ifdef CONFIG_PPC64 restore_task_exec_start = restorer_sym(exec_mem_hint, arch_export_restore_task);
restore_task_exec_start = restorer_sym(exec_mem_hint, __export_restore_task_trampoline); rsti(current)->munmap_restorer = restorer_sym(exec_mem_hint, arch_export_unmap);
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
exec_mem_hint += restorer_len; exec_mem_hint += restorer_len;
......
...@@ -195,6 +195,8 @@ enum { ...@@ -195,6 +195,8 @@ enum {
/* the restorer_blob_offset__ prefix is added by gen_offsets.sh */ /* 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__ */ #endif /* __CR_RESTORER_H__ */
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