diff --git a/include/restorer.h b/include/restorer.h index 7b8f1e489..a1c33f12c 100644 --- a/include/restorer.h +++ b/include/restorer.h @@ -4,7 +4,7 @@ #include "image.h" #define RESTORER_ARGS_SIZE 512 -#define RESTORER_SIZE 4096 +#define RESTORER_SIZE 8192 long restorer(long cmd); @@ -14,6 +14,7 @@ enum { RESTORER_CMD__NONE, RESTORER_CMD__GET_ARG_OFFSET, RESTORER_CMD__PR_ARG_STRING, + RESTORER_CMD__RESTORE_CORE, RESTORER_CMD__MAX, }; diff --git a/restorer.c b/restorer.c index a156ac0c9..dbcdfb62f 100644 --- a/restorer.c +++ b/restorer.c @@ -56,6 +56,41 @@ long restorer(long cmd) : "memory"); break; + /* + * This one is very special, we never return there + * but use sigreturn facility to restore core registers + * and jump execution to some predefined ip read from + * core file. + */ + case RESTORER_CMD__RESTORE_CORE: + { + /* + * Unmap all but self, note that we reply on + * caller that it has placed this execution + * code at the VMA which we can keep mapped. + */ + + /* + * Map VMAs we will need. + */ + + /* + * Threads here with registers and pids + * we need. + */ + + /* + * Setup a sigreturn frame. + */ + + /* Finally call for sigreturn */ + sys_rt_sigreturn(); + } + break; + + default: + ret = -1; + break; } asm volatile(".align "__stringify(RESTORER_SIZE));