mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-23 01:59:04 +00:00
compel: x86 parasite_service entry point simplification
We don't need to push 0 on the stack. This seems to be a remnant of the
initial commit of 2011 that had a `pushq $0`.
The 16 bytes %rsp alignment was added with commit 2a0cea29 in 2012.
This is no longer necessary as we already guarantee that %rsp is 16
bytes aligned. A BUG_ON() is added to enforce this guarantee.
Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
This commit is contained in:
parent
d7353b9bb7
commit
ea263bc472
2 changed files with 13 additions and 10 deletions
|
|
@ -6,14 +6,6 @@
|
|||
# error 64-bit parasite should compile with CONFIG_X86_64
|
||||
#endif
|
||||
|
||||
.macro PARASITE_ENTRY num
|
||||
subq $16, %rsp
|
||||
andq $~15, %rsp
|
||||
pushq $\num
|
||||
movq %rsp, %rbp
|
||||
call parasite_service
|
||||
.endm
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
.code32
|
||||
ENTRY(__export_parasite_head_start_compat)
|
||||
|
|
@ -21,7 +13,7 @@ ENTRY(__export_parasite_head_start_compat)
|
|||
jmp $__USER_CS,$1f
|
||||
1:
|
||||
.code64
|
||||
PARASITE_ENTRY 0
|
||||
call parasite_service
|
||||
pushq $__USER32_CS
|
||||
xor %r11, %r11
|
||||
movl $2f, %r11d
|
||||
|
|
@ -43,6 +35,6 @@ END(__export_parasite_head_start_compat)
|
|||
#endif
|
||||
|
||||
ENTRY(__export_parasite_head_start)
|
||||
PARASITE_ENTRY 0
|
||||
call parasite_service
|
||||
int $0x03
|
||||
END(__export_parasite_head_start)
|
||||
|
|
|
|||
|
|
@ -948,6 +948,17 @@ int compel_infect(struct parasite_ctl *ctl, unsigned long nr_threads, unsigned l
|
|||
p += PARASITE_STACK_SIZE;
|
||||
ctl->rstack = ctl->remote_map + p;
|
||||
|
||||
/*
|
||||
* x86-64 ABI requires a 16 bytes aligned stack.
|
||||
* It is already the case as RESTORE_STACK_SIGFRAME is a multiple of
|
||||
* 64, and PARASITE_STACK_SIZE is 0x4000.
|
||||
*/
|
||||
if ((unsigned long)ctl->rstack & (16-1)) {
|
||||
pr_err("BUG: stack is not 16 bytes aligned: %p\n", ctl->rstack);
|
||||
ctl->rstack = (void *)round_down((unsigned long)ctl->rstack, 16);
|
||||
}
|
||||
|
||||
|
||||
if (nr_threads > 1) {
|
||||
p += PARASITE_STACK_SIZE;
|
||||
ctl->r_thread_stack = ctl->remote_map + p;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue