修訂 | a7c587f5cd390f92970c2c4b5a538ac27ea3f119 (tree) |
---|---|
時間 | 2022-09-27 19:01:23 |
作者 | Sergey Matyukevich <sergey.matyukevich@syno...> |
Commiter | Waldemar Brodkorb |
arc: add asm macros
Add a header file with assembler macros to be able to handle in one
place the differences between ARCv2 and ARCv3 ISAs. It is a preparatory
step before the introduction of support for ARCv3 CPUs.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
@@ -4,6 +4,7 @@ | ||
4 | 4 | * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. |
5 | 5 | */ |
6 | 6 | |
7 | +#include <asm.h> | |
7 | 8 | #include <sysdep.h> |
8 | 9 | #include <sys/syscall.h> |
9 | 10 |
@@ -12,30 +13,30 @@ | ||
12 | 13 | ; r10-r12 are already clobbered by PLTn, PLT0 thus neednot be saved |
13 | 14 | |
14 | 15 | .macro SAVE_CALLER_SAVED |
15 | - push_s r0 | |
16 | - push_s r1 | |
17 | - push_s r2 | |
18 | - push_s r3 | |
19 | - st.a r4, [sp, -4] | |
20 | - st.a r5, [sp, -4] | |
21 | - st.a r6, [sp, -4] | |
22 | - st.a r7, [sp, -4] | |
23 | - st.a r8, [sp, -4] | |
24 | - st.a r9, [sp, -4] | |
25 | - push_s blink | |
16 | + PUSHR_S r0 | |
17 | + PUSHR_S r1 | |
18 | + PUSHR_S r2 | |
19 | + PUSHR_S r3 | |
20 | + PUSHR r4 | |
21 | + PUSHR r5 | |
22 | + PUSHR r6 | |
23 | + PUSHR r7 | |
24 | + PUSHR r8 | |
25 | + PUSHR r9 | |
26 | + PUSHR_S blink | |
26 | 27 | .endm |
27 | 28 | |
28 | 29 | .macro RESTORE_CALLER_SAVED_BUT_R0 |
29 | - ld.ab blink,[sp, 4] | |
30 | - ld.ab r9, [sp, 4] | |
31 | - ld.ab r8, [sp, 4] | |
32 | - ld.ab r7, [sp, 4] | |
33 | - ld.ab r6, [sp, 4] | |
34 | - ld.ab r5, [sp, 4] | |
35 | - ld.ab r4, [sp, 4] | |
36 | - pop_s r3 | |
37 | - pop_s r2 | |
38 | - pop_s r1 | |
30 | + POPR blink | |
31 | + POPR r9 | |
32 | + POPR r8 | |
33 | + POPR r7 | |
34 | + POPR r6 | |
35 | + POPR r5 | |
36 | + POPR r4 | |
37 | + POPR_S r3 | |
38 | + POPR_S r2 | |
39 | + POPR_S r1 | |
39 | 40 | .endm |
40 | 41 | |
41 | 42 | ; Upon entry, PLTn, which led us here, sets up the following regs |
@@ -53,5 +54,5 @@ ENTRY(_dl_linux_resolve) | ||
53 | 54 | |
54 | 55 | RESTORE_CALLER_SAVED_BUT_R0 |
55 | 56 | j_s.d [r0] ; r0 has resolved function addr |
56 | - pop_s r0 ; restore first arg to resolved call | |
57 | + POPR_S r0 ; restore first arg to resolved call | |
57 | 58 | END(_dl_linux_resolve) |
@@ -0,0 +1,28 @@ | ||
1 | +/* | |
2 | + * Copyright (C) 2022, Synopsys, Inc. (www.synopsys.com) | |
3 | + * | |
4 | + * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball. | |
5 | + */ | |
6 | + | |
7 | +#ifndef _ARC_ASM_H | |
8 | +#define _ARC_ASM_H | |
9 | + | |
10 | + | |
11 | +.macro PUSHR reg | |
12 | + push \reg | |
13 | +.endm | |
14 | + | |
15 | +.macro PUSHR_S reg | |
16 | + push_s \reg | |
17 | +.endm | |
18 | + | |
19 | +.macro POPR reg | |
20 | + pop \reg | |
21 | +.endm | |
22 | + | |
23 | +.macro POPR_S reg | |
24 | + pop_s \reg | |
25 | +.endm | |
26 | + | |
27 | + | |
28 | +#endif /* _ARC_ASM_H */ |