Commit 5b6748b4 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restore: Call for sigreturn

Prepare the stack value and do a syscall.
Still it fails because of stack corruption
I think and due to lack of setup of several
important values on thread-info area.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent a50600c7
...@@ -301,8 +301,6 @@ self_len_end: ...@@ -301,8 +301,6 @@ self_len_end:
sys_close(fd_core); sys_close(fd_core);
goto core_restore_end;
/* /*
* We need to prepare a valid sigframe here, so * We need to prepare a valid sigframe here, so
* after sigreturn the kernel will pick up the * after sigreturn the kernel will pick up the
...@@ -355,8 +353,22 @@ self_len_end: ...@@ -355,8 +353,22 @@ self_len_end:
/* FIXME: What with cr2 and friends which are rest there? */ /* FIXME: What with cr2 and friends which are rest there? */
/* Finally call for sigreturn */ write_hex_n(__LINE__);
sys_rt_sigreturn();
/*
* Prepare the stack and call for sigreturn,
* pure assembly since we don't need any additional
* code insns from gcc.
*/
asm volatile(
"movq %0, %%rax \t\n"
"movq %%rax, %%rsp \t\n"
"movl $"__stringify(__NR_rt_sigreturn)", %%eax \t\n"
"syscall \t\n"
:
: "r"((long)rt_sigframe + sizeof(*rt_sigframe))
: "rax","rsp","memory");
core_restore_end: core_restore_end:
write_hex_n(sys_getpid()); write_hex_n(sys_getpid());
......
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