mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 05:48:05 +00:00
fix asm syntax to be clang-compatible
I'm unsure where all these %%s before register names comes from, but they confuse clang, like this: > criu/arch/arm/parasite-head.S:6:6: error: unexpected token in operand > sub %r2, %pc, #8 @ get the address of this instruction > ^ This patch looks scary, but all it does is removing %s before register names, fixing a few "many spaces instead of a tab" issues along the way. travis-ci: success for Fixes to compile on arm with clang Cc: Christopher Covington <cov@codeaurora.org> Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by: Kir Kolyshkin <kir@openvz.org> Reviewed-by: Christopher Covington <cov@codeaurora.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
d6d034a9d2
commit
6c7eb2ee99
@ -8,10 +8,10 @@
|
|||||||
#define JUMP_TO_RESTORER_BLOB(new_sp, restore_task_exec_start, \
|
#define JUMP_TO_RESTORER_BLOB(new_sp, restore_task_exec_start, \
|
||||||
task_args) \
|
task_args) \
|
||||||
asm volatile( \
|
asm volatile( \
|
||||||
"mov %%sp, %%%0 \n" \
|
"mov sp, %0 \n" \
|
||||||
"mov %%r1, %%%1 \n" \
|
"mov r1, %1 \n" \
|
||||||
"mov %%r0, %%%2 \n" \
|
"mov r0, %2 \n" \
|
||||||
"bx %%r1 \n" \
|
"bx r1 \n" \
|
||||||
: \
|
: \
|
||||||
: "r"(new_sp), \
|
: "r"(new_sp), \
|
||||||
"r"(restore_task_exec_start), \
|
"r"(restore_task_exec_start), \
|
||||||
|
@ -69,8 +69,8 @@ struct rt_sigframe {
|
|||||||
|
|
||||||
#define ARCH_RT_SIGRETURN(new_sp) \
|
#define ARCH_RT_SIGRETURN(new_sp) \
|
||||||
asm volatile( \
|
asm volatile( \
|
||||||
"mov %%sp, %0 \n" \
|
"mov sp, %0 \n" \
|
||||||
"mov %%r7, #"__stringify(__NR_rt_sigreturn)" \n" \
|
"mov r7, #"__stringify(__NR_rt_sigreturn)" \n" \
|
||||||
"svc #0 \n" \
|
"svc #0 \n" \
|
||||||
: \
|
: \
|
||||||
: "r"(new_sp) \
|
: "r"(new_sp) \
|
||||||
@ -80,28 +80,28 @@ struct rt_sigframe {
|
|||||||
thread_args, clone_restore_fn) \
|
thread_args, clone_restore_fn) \
|
||||||
asm volatile( \
|
asm volatile( \
|
||||||
"clone_emul: \n" \
|
"clone_emul: \n" \
|
||||||
"ldr %%r1, %2 \n" \
|
"ldr r1, %2 \n" \
|
||||||
"sub %%r1, #16 \n" \
|
"sub r1, #16 \n" \
|
||||||
"mov %%r0, %%%6 \n" \
|
"mov r0, %6 \n" \
|
||||||
"str %%r0, [%%r1, #4] \n" \
|
"str r0, [r1, #4] \n" \
|
||||||
"mov %%r0, %%%5 \n" \
|
"mov r0, %5 \n" \
|
||||||
"str %%r0, [%%r1] \n" \
|
"str r0, [r1] \n" \
|
||||||
"mov %%r0, %%%1 \n" \
|
"mov r0, %1 \n" \
|
||||||
"mov %%r2, %%%3 \n" \
|
"mov r2, %3 \n" \
|
||||||
"mov %%r3, %%%4 \n" \
|
"mov r3, %4 \n" \
|
||||||
"mov %%r7, #"__stringify(__NR_clone)" \n" \
|
"mov r7, #"__stringify(__NR_clone)" \n" \
|
||||||
"svc #0 \n" \
|
"svc #0 \n" \
|
||||||
\
|
\
|
||||||
"cmp %%r0, #0 \n" \
|
"cmp r0, #0 \n" \
|
||||||
"beq thread_run \n" \
|
"beq thread_run \n" \
|
||||||
\
|
\
|
||||||
"mov %%%0, %%r0 \n" \
|
"mov %0, r0 \n" \
|
||||||
"b clone_end \n" \
|
"b clone_end \n" \
|
||||||
\
|
\
|
||||||
"thread_run: \n" \
|
"thread_run: \n" \
|
||||||
"pop { %%r1 } \n" \
|
"pop { r1 } \n" \
|
||||||
"pop { %%r0 } \n" \
|
"pop { r0 } \n" \
|
||||||
"bx %%r1 \n" \
|
"bx r1 \n" \
|
||||||
\
|
\
|
||||||
"clone_end: \n" \
|
"clone_end: \n" \
|
||||||
: "=r"(ret) \
|
: "=r"(ret) \
|
||||||
@ -115,9 +115,9 @@ struct rt_sigframe {
|
|||||||
|
|
||||||
#define ARCH_FAIL_CORE_RESTORE \
|
#define ARCH_FAIL_CORE_RESTORE \
|
||||||
asm volatile( \
|
asm volatile( \
|
||||||
"mov %%sp, %0 \n" \
|
"mov sp, %0 \n" \
|
||||||
"mov %%r0, #0 \n" \
|
"mov r0, #0 \n" \
|
||||||
"bx %%r0 \n" \
|
"bx r0 \n" \
|
||||||
: \
|
: \
|
||||||
: "r"(ret) \
|
: "r"(ret) \
|
||||||
: "memory")
|
: "memory")
|
||||||
@ -144,12 +144,12 @@ static inline int sigreturn_prep_fpu_frame(struct rt_sigframe *sigframe,
|
|||||||
|
|
||||||
static inline void restore_tls(tls_t *ptls) {
|
static inline void restore_tls(tls_t *ptls) {
|
||||||
asm (
|
asm (
|
||||||
"mov %%r7, #15 \n"
|
"mov r7, #15 \n"
|
||||||
"lsl %%r7, #16 \n"
|
"lsl r7, #16 \n"
|
||||||
"mov %%r0, #5 \n"
|
"mov r0, #5 \n"
|
||||||
"add %%r7, %%r0 \n" /* r7 = 0xF005 */
|
"add r7, r0 \n" /* r7 = 0xF005 */
|
||||||
"ldr %%r0, [%0] \n"
|
"ldr r0, [%0] \n"
|
||||||
"svc #0 \n"
|
"svc #0 \n"
|
||||||
:
|
:
|
||||||
: "r"(ptls)
|
: "r"(ptls)
|
||||||
: "r0", "r7"
|
: "r0", "r7"
|
||||||
|
@ -2,12 +2,12 @@ nr_sys_mmap:
|
|||||||
.long 192
|
.long 192
|
||||||
|
|
||||||
ENTRY(sys_mmap)
|
ENTRY(sys_mmap)
|
||||||
push {%r4, %r5, %r7, %lr}
|
push {r4, r5, r7, lr}
|
||||||
ldr %r4, [%sp, #16]
|
ldr r4, [sp, #16]
|
||||||
ldr %r5, [%sp, #20]
|
ldr r5, [sp, #20]
|
||||||
lsr %r5, #12
|
lsr r5, #12
|
||||||
adr %r7, nr_sys_mmap
|
adr r7, nr_sys_mmap
|
||||||
ldr %r7, [%r7]
|
ldr r7, [r7]
|
||||||
svc 0x00000000
|
svc 0x00000000
|
||||||
pop {%r4, %r5, %r7, %pc}
|
pop {r4, r5, r7, pc}
|
||||||
END(sys_mmap)
|
END(sys_mmap)
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
|
|
||||||
.section .head.text, "ax"
|
.section .head.text, "ax"
|
||||||
ENTRY(__export_parasite_head_start)
|
ENTRY(__export_parasite_head_start)
|
||||||
sub %r2, %pc, #8 @ get the address of this instruction
|
sub r2, pc, #8 @ get the address of this instruction
|
||||||
|
|
||||||
adr %r0, __export_parasite_cmd
|
adr r0, __export_parasite_cmd
|
||||||
ldr %r0, [%r0]
|
ldr r0, [r0]
|
||||||
|
|
||||||
adr %r1, parasite_args_ptr
|
adr r1, parasite_args_ptr
|
||||||
ldr %r1, [%r1]
|
ldr r1, [r1]
|
||||||
add %r1, %r1, %r2 @ fixup __export_parasite_args
|
add r1, r1, r2 @ fixup __export_parasite_args
|
||||||
|
|
||||||
bl parasite_service
|
bl parasite_service
|
||||||
.byte 0xf0, 0x01, 0xf0, 0xe7 @ the instruction UDF #32 generates the signal SIGTRAP in Linux
|
.byte 0xf0, 0x01, 0xf0, 0xe7 @ the instruction UDF #32 generates the signal SIGTRAP in Linux
|
||||||
|
|
||||||
parasite_args_ptr:
|
parasite_args_ptr:
|
||||||
.long __export_parasite_args
|
.long __export_parasite_args
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
@ between parasite_service() and sys_munmap().
|
@ between parasite_service() and sys_munmap().
|
||||||
|
|
||||||
syscall_common:
|
syscall_common:
|
||||||
ldr %r7, [%r7]
|
ldr r7, [r7]
|
||||||
add %r8, %sp, #24
|
add r8, sp, #24
|
||||||
ldm %r8, {%r4, %r5, %r6}
|
ldm r8, {r4, r5, r6}
|
||||||
svc 0x00000000
|
svc 0x00000000
|
||||||
pop {%r4, %r5, %r6, %r7, %r8, %pc}
|
pop {r4, r5, r6, r7, r8, pc}
|
||||||
|
|
||||||
|
|
||||||
.macro syscall name, nr
|
.macro syscall name, nr
|
||||||
@ -20,15 +20,15 @@ syscall_common:
|
|||||||
.long \nr
|
.long \nr
|
||||||
|
|
||||||
ENTRY(\name)
|
ENTRY(\name)
|
||||||
push {%r4, %r5, %r6, %r7, %r8, %lr}
|
push {r4, r5, r6, r7, r8, lr}
|
||||||
adr %r7, .nr_\name
|
adr r7, .nr_\name
|
||||||
b syscall_common
|
b syscall_common
|
||||||
END(\name)
|
END(\name)
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
||||||
ENTRY(__cr_restore_rt)
|
ENTRY(__cr_restore_rt)
|
||||||
adr %r7, .nr_sys_rt_sigreturn
|
adr r7, .nr_sys_rt_sigreturn
|
||||||
ldr %r7, [%r7]
|
ldr r7, [r7]
|
||||||
svc #0
|
svc #0
|
||||||
END(__cr_restore_rt)
|
END(__cr_restore_rt)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user