Commit 3ad5e0c3 authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

arm: fixup the parasite arguments automatically

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: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent fd0d3801
......@@ -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)
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