Commit c706e8c6 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

restorer: Add lea_args_off helper

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent 57b45ea5
...@@ -15,6 +15,16 @@ ...@@ -15,6 +15,16 @@
#include "restorer.h" #include "restorer.h"
#define lea_args_off(p) \
do { \
asm volatile( \
"leaq restore_args__(%%rip), %%rax \n\t" \
"movq %%rax, %0 \n\t" \
: "=m"(p) \
: \
: "memory"); \
} while (0)
long restorer(long cmd) long restorer(long cmd)
{ {
long ret; long ret;
...@@ -34,26 +44,16 @@ long restorer(long cmd) ...@@ -34,26 +44,16 @@ long restorer(long cmd)
char *str = NULL; char *str = NULL;
int size = 0; int size = 0;
asm volatile( lea_args_off(str);
"leaq restore_args__(%%rip), %%rax \n\t"
"movq %%rax, %0 \n\t"
: "=m"(str)
:
: "memory");
while (str[size]) while (str[size])
size++; size++;
sys_write(1, str, size); sys_write(1, str, size);
} }
break; break;
case RESTORER_CMD__GET_ARG_OFFSET: case RESTORER_CMD__GET_ARG_OFFSET:
asm volatile( lea_args_off(ret);
"leaq restore_args__(%%rip), %%rax \n\t"
"movq %%rax, %0 \n\t"
: "=m"(ret)
:
: "memory");
break; break;
/* /*
......
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