Revision | de6be7bc60f190a0d746945a3a5a143bc93a1a65 (tree) |
---|---|
Time | 2022-09-27 19:01:23 |
Author | Sergey Matyukevich <sergey.matyukevich@syno...> |
Commiter | Waldemar Brodkorb |
arc: add support for ARCv3 32-bit processors
New ARCv3 ISA includes both 64-bit and 32-bit CPU family.
This patch adds support for 32-bit ARCv3 HS5x processors.
Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
@@ -273,6 +273,7 @@ typedef struct | ||
273 | 273 | #define EM_ARCV2 195 /* Synopsys ARCv2 Cores */ |
274 | 274 | #define EM_RISCV 243 /* RISC-V */ |
275 | 275 | #define EM_CSKY 252 /* C-SKY Cores */ |
276 | +#define EM_ARCV3_32 255 /* Synopsys ARCv3 32-bit Cores */ | |
276 | 277 | #define EM_KVX 256 /* Kalray VLIW core of the MPPA processor family */ |
277 | 278 | |
278 | 279 | /* NEXT FREE NUMBER: Increment this after adding your official arch number */ |
@@ -75,6 +75,9 @@ do { \ | ||
75 | 75 | #elif defined(__HS__) |
76 | 76 | #define MAGIC1 EM_ARCV2 |
77 | 77 | #define ELF_TARGET "ARCv2" /* For error messages */ |
78 | +#elif defined(__ARC64_ARCH32__) | |
79 | +#define MAGIC1 EM_ARCV3_32 | |
80 | +#define ELF_TARGET "ARCv3_32" /* For error messages */ | |
78 | 81 | #endif |
79 | 82 | |
80 | 83 | #undef MAGIC2 |
@@ -7,6 +7,29 @@ | ||
7 | 7 | #ifndef _ARC_ASM_H |
8 | 8 | #define _ARC_ASM_H |
9 | 9 | |
10 | +#if defined (__ARC64_ARCH32__) | |
11 | + | |
12 | +.macro PUSHR reg | |
13 | + push \reg | |
14 | +.endm | |
15 | + | |
16 | +.macro PUSHR_S reg | |
17 | + push \reg | |
18 | +.endm | |
19 | + | |
20 | +.macro POPR reg | |
21 | + pop \reg | |
22 | +.endm | |
23 | + | |
24 | +.macro POPR_S reg | |
25 | + pop \reg | |
26 | +.endm | |
27 | + | |
28 | +#elif defined (__ARC64_ARCH64__) | |
29 | + | |
30 | +# error ARCv3 64-bit is not supported by uClibc-ng | |
31 | + | |
32 | +#else /* ARCHS || ARC700 */ | |
10 | 33 | |
11 | 34 | .macro PUSHR reg |
12 | 35 | push \reg |
@@ -24,5 +47,6 @@ | ||
24 | 47 | pop_s \reg |
25 | 48 | .endm |
26 | 49 | |
50 | +#endif | |
27 | 51 | |
28 | 52 | #endif /* _ARC_ASM_H */ |
@@ -100,7 +100,7 @@ extern long __syscall_error (int); | ||
100 | 100 | |
101 | 101 | #ifdef __A7__ |
102 | 102 | #define ARC_TRAP_INSN "trap0 \n\t" |
103 | -#elif defined(__HS__) | |
103 | +#else | |
104 | 104 | #define ARC_TRAP_INSN "trap_s 0 \n\t" |
105 | 105 | #endif |
106 | 106 |
@@ -182,7 +182,7 @@ extern long __syscall_error (int); | ||
182 | 182 | |
183 | 183 | #ifdef __A7__ |
184 | 184 | #define ARC_TRAP_INSN trap0 |
185 | -#elif defined(__HS__) | |
185 | +#else | |
186 | 186 | #define ARC_TRAP_INSN trap_s 0 |
187 | 187 | #endif |
188 | 188 |
@@ -40,7 +40,9 @@ __start: | ||
40 | 40 | ld_s r1, [sp] ; argc |
41 | 41 | |
42 | 42 | mov_s r5, r0 ; rltd_fini |
43 | - add_s r2, sp, 4 ; argv | |
43 | + /* Use the universal 32-bit add instruction as 16-bit add_s was excluded from | |
44 | + ARCv3 ISA */ | |
45 | + add r2, sp, 4 ; argv | |
44 | 46 | #ifdef L_Scrt1 |
45 | 47 | ld r0, [pcl, @main@gotpc] |
46 | 48 | ld r3, [pcl, @_init@gotpc] |
@@ -34,6 +34,11 @@ | ||
34 | 34 | #define ELFCLASSM ELFCLASS32 |
35 | 35 | #endif |
36 | 36 | |
37 | +#if defined(__ARC64_ARCH32__) | |
38 | +#define MATCH_MACHINE(x) (x == EM_ARCV3_32) | |
39 | +#define ELFCLASSM ELFCLASS32 | |
40 | +#endif | |
41 | + | |
37 | 42 | #if defined(__arm__) || defined(__thumb__) |
38 | 43 | #define MATCH_MACHINE(x) (x == EM_ARM) |
39 | 44 | #define ELFCLASSM ELFCLASS32 |