Commit efdb52e3 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restore: Add reading core entry

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 0133a23a
...@@ -41,7 +41,7 @@ static void always_inline write_string(char *str) ...@@ -41,7 +41,7 @@ static void always_inline write_string(char *str)
long restorer(long cmd) long restorer(long cmd)
{ {
long ret; long ret = -1;
asm volatile( asm volatile(
"jmp 1f \n\t" "jmp 1f \n\t"
...@@ -56,13 +56,11 @@ long restorer(long cmd) ...@@ -56,13 +56,11 @@ long restorer(long cmd)
case RESTORER_CMD__PR_ARG_STRING: case RESTORER_CMD__PR_ARG_STRING:
{ {
char *str = NULL; char *str = NULL;
int size = 0;
lea_args_off(str); lea_args_off(str);
while (str[size]) write_string(str);
size++;
sys_write(1, str, size); ret = 0;
} }
break; break;
...@@ -90,7 +88,17 @@ long restorer(long cmd) ...@@ -90,7 +88,17 @@ long restorer(long cmd)
write_string("\n"); write_string("\n");
fd_core = sys_open(core_path, O_RDONLY, CR_FD_PERM); fd_core = sys_open(core_path, O_RDONLY, CR_FD_PERM);
return fd_core; if (fd_core < 0)
return fd_core;
sys_lseek(fd_core, MAGIC_OFFSET, SEEK_SET);
ret = sys_read(fd_core, &core_entry, sizeof(core_entry));
sys_close(fd_core);
if (ret != sizeof(core_entry))
return -ret;
return ret;
/* /*
* Unmap all but self, note that we reply on * Unmap all but self, note that we reply on
......
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