Skip to content

Commit 22823db

Browse files
kolyshkinxemul
authored andcommitted
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 <[email protected]> Dmitry Safonov <[email protected]> Signed-off-by: Kir Kolyshkin <[email protected]> Reviewed-by: Christopher Covington <[email protected]> Signed-off-by: Pavel Emelyanov <[email protected]>
1 parent fa2b8f6 commit 22823db

File tree

6 files changed

+52
-52
lines changed

6 files changed

+52
-52
lines changed

compel/arch/arm/plugins/std/syscalls/syscall-aux.S

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ nr_sys_mmap:
22
.long 192
33

44
ENTRY(sys_mmap)
5-
push {%r4, %r5, %r7, %lr}
6-
ldr %r4, [%sp, #16]
7-
ldr %r5, [%sp, #20]
8-
lsr %r5, #12
9-
adr %r7, nr_sys_mmap
10-
ldr %r7, [%r7]
5+
push {r4, r5, r7, lr}
6+
ldr r4, [sp, #16]
7+
ldr r5, [sp, #20]
8+
lsr r5, #12
9+
adr r7, nr_sys_mmap
10+
ldr r7, [r7]
1111
svc 0x00000000
12-
pop {%r4, %r5, %r7, %pc}
12+
pop {r4, r5, r7, pc}
1313
END(sys_mmap)

compel/arch/arm/plugins/std/syscalls/syscall-common.S

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@
88
@ between parasite_service() and sys_munmap().
99

1010
syscall_common:
11-
ldr %r7, [%r7]
12-
add %r8, %sp, #24
13-
ldm %r8, {%r4, %r5, %r6}
11+
ldr r7, [r7]
12+
add r8, sp, #24
13+
ldm r8, {r4, r5, r6}
1414
svc 0x00000000
15-
pop {%r4, %r5, %r6, %r7, %r8, %pc}
15+
pop {r4, r5, r6, r7, r8, pc}
1616

1717

1818
.macro syscall name, nr
1919
.nr_\name :
2020
.long \nr
2121

2222
ENTRY(\name)
23-
push {%r4, %r5, %r6, %r7, %r8, %lr}
24-
adr %r7, .nr_\name
23+
push {r4, r5, r6, r7, r8, lr}
24+
adr r7, .nr_\name
2525
b syscall_common
2626
END(\name)
2727
.endm
2828

2929

3030
ENTRY(__cr_restore_rt)
31-
adr %r7, .nr_sys_rt_sigreturn
32-
ldr %r7, [%r7]
31+
adr r7, .nr_sys_rt_sigreturn
32+
ldr r7, [r7]
3333
svc #0
3434
END(__cr_restore_rt)

criu/arch/arm/include/asm/restore.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
#define JUMP_TO_RESTORER_BLOB(new_sp, restore_task_exec_start, \
99
task_args) \
1010
asm volatile( \
11-
"mov %%sp, %%%0 \n" \
12-
"mov %%r1, %%%1 \n" \
13-
"mov %%r0, %%%2 \n" \
14-
"bx %%r1 \n" \
11+
"mov sp, %0 \n" \
12+
"mov r1, %1 \n" \
13+
"mov r0, %2 \n" \
14+
"bx r1 \n" \
1515
: \
1616
: "r"(new_sp), \
1717
"r"(restore_task_exec_start), \

criu/arch/arm/include/asm/restorer.h

+24-24
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@
1010
thread_args, clone_restore_fn) \
1111
asm volatile( \
1212
"clone_emul: \n" \
13-
"ldr %%r1, %2 \n" \
14-
"sub %%r1, #16 \n" \
15-
"mov %%r0, %%%6 \n" \
16-
"str %%r0, [%%r1, #4] \n" \
17-
"mov %%r0, %%%5 \n" \
18-
"str %%r0, [%%r1] \n" \
19-
"mov %%r0, %%%1 \n" \
20-
"mov %%r2, %%%3 \n" \
21-
"mov %%r3, %%%4 \n" \
22-
"mov %%r7, #"__stringify(__NR_clone)" \n" \
13+
"ldr r1, %2 \n" \
14+
"sub r1, #16 \n" \
15+
"mov r0, %6 \n" \
16+
"str r0, [r1, #4] \n" \
17+
"mov r0, %5 \n" \
18+
"str r0, [r1] \n" \
19+
"mov r0, %1 \n" \
20+
"mov r2, %3 \n" \
21+
"mov r3, %4 \n" \
22+
"mov r7, #"__stringify(__NR_clone)" \n" \
2323
"svc #0 \n" \
2424
\
25-
"cmp %%r0, #0 \n" \
25+
"cmp r0, #0 \n" \
2626
"beq thread_run \n" \
2727
\
28-
"mov %%%0, %%r0 \n" \
28+
"mov %0, r0 \n" \
2929
"b clone_end \n" \
3030
\
3131
"thread_run: \n" \
32-
"pop { %%r1 } \n" \
33-
"pop { %%r0 } \n" \
34-
"bx %%r1 \n" \
32+
"pop { r1 } \n" \
33+
"pop { r0 } \n" \
34+
"bx r1 \n" \
3535
\
3636
"clone_end: \n" \
3737
: "=r"(ret) \
@@ -45,9 +45,9 @@
4545

4646
#define ARCH_FAIL_CORE_RESTORE \
4747
asm volatile( \
48-
"mov %%sp, %0 \n" \
49-
"mov %%r0, #0 \n" \
50-
"bx %%r0 \n" \
48+
"mov sp, %0 \n" \
49+
"mov r0, #0 \n" \
50+
"bx r0 \n" \
5151
: \
5252
: "r"(ret) \
5353
: "memory")
@@ -61,12 +61,12 @@ int restore_nonsigframe_gpregs(UserArmRegsEntry *r);
6161

6262
static inline void restore_tls(tls_t *ptls) {
6363
asm (
64-
"mov %%r7, #15 \n"
65-
"lsl %%r7, #16 \n"
66-
"mov %%r0, #5 \n"
67-
"add %%r7, %%r0 \n" /* r7 = 0xF005 */
68-
"ldr %%r0, [%0] \n"
69-
"svc #0 \n"
64+
"mov r7, #15 \n"
65+
"lsl r7, #16 \n"
66+
"mov r0, #5 \n"
67+
"add r7, r0 \n" /* r7 = 0xF005 */
68+
"ldr r0, [%0] \n"
69+
"svc #0 \n"
7070
:
7171
: "r"(ptls)
7272
: "r0", "r7"

criu/arch/arm/include/asm/sigframe.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ struct rt_sigframe {
6666

6767
#define ARCH_RT_SIGRETURN(new_sp, rt_sigframe) \
6868
asm volatile( \
69-
"mov %%sp, %0 \n" \
70-
"mov %%r7, #"__stringify(__NR_rt_sigreturn)" \n" \
69+
"mov sp, %0 \n" \
70+
"mov r7, #"__stringify(__NR_rt_sigreturn)" \n" \
7171
"svc #0 \n" \
7272
: \
7373
: "r"(new_sp) \

criu/arch/arm/parasite-head.S

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33

44
.section .head.text, "ax"
55
ENTRY(__export_parasite_head_start)
6-
sub %r2, %pc, #8 @ get the address of this instruction
6+
sub r2, pc, #8 @ get the address of this instruction
77

8-
adr %r0, __export_parasite_cmd
9-
ldr %r0, [%r0]
8+
adr r0, __export_parasite_cmd
9+
ldr r0, [r0]
1010

11-
adr %r1, parasite_args_ptr
12-
ldr %r1, [%r1]
13-
add %r1, %r1, %r2 @ fixup __export_parasite_args
11+
adr r1, parasite_args_ptr
12+
ldr r1, [r1]
13+
add r1, r1, r2 @ fixup __export_parasite_args
1414

1515
bl parasite_service
16-
.byte 0xf0, 0x01, 0xf0, 0xe7 @ the instruction UDF #32 generates the signal SIGTRAP in Linux
16+
.byte 0xf0, 0x01, 0xf0, 0xe7 @ the instruction UDF #32 generates the signal SIGTRAP in Linux
1717

1818
parasite_args_ptr:
1919
.long __export_parasite_args

0 commit comments

Comments
 (0)