[CRIU] [PATCH 1/2] arm: fixup the parasite arguments automatically
Alexander Kartashov
alekskartashov at parallels.com
Mon Mar 4 01:21:11 EST 2013
The ARM parasite head uses a pad of 228 bytes
to make the offset of the symbol __export_parasite_stack
representable in the ARM instruction set. This value
needs to be changed every time the value of the macro
PARASITE_STACK_SIZE changes.
This patch makes this manual interference redundant.
Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
arch/arm/parasite-head.S | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/arch/arm/parasite-head.S b/arch/arm/parasite-head.S
index 74fd4cb..c345ccd 100644
--- a/arch/arm/parasite-head.S
+++ b/arch/arm/parasite-head.S
@@ -3,20 +3,34 @@
.section .head.text, "ax"
ENTRY(__export_parasite_head_start)
- adr %sp, __export_parasite_stack
+ sub %r2, %pc, #8 @ get the address of this instruction
+
+ adr %sp, parasite_stack_ptr
+ ldr %sp, [%sp]
+ add %sp, %sp, %r2 @ fixup __export_parasite_stack
+ bic %sp, %sp, #7 @ align the stack
+
adr %r0, __export_parasite_cmd
ldr %r0, [%r0]
- adr %r1, __export_parasite_args
+
+ adr %r1, parasite_args_ptr
+ ldr %r1, [%r1]
+ add %r1, %r1, %r2 @ fixup __export_parasite_args
+
bl parasite_service
.byte 0xf0, 0x01, 0xf0, 0xe7 @ the instruction UDF #32 generates the signal SIGTRAP in Linux
+parasite_args_ptr:
+ .long __export_parasite_args
+
+parasite_stack_ptr:
+ .long __export_parasite_stack
+
__export_parasite_cmd:
.long 0
-__export_parasite_args:
.space PARASITE_STACK_SIZE,0
- .space 228, 0
-
+.align 3
__export_parasite_stack:
.long 0
END(__export_parasite_head_start)
--
1.7.10.4
More information about the CRIU
mailing list