2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-01 06:45:35 +00:00

restorer: Add lea_args_off helper

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov
2011-10-25 00:01:27 +04:00
parent 57b45ea5eb
commit c706e8c6e2

View File

@@ -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)
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;
/* /*