• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionde6be7bc60f190a0d746945a3a5a143bc93a1a65 (tree)
Time2022-09-27 19:01:23
AuthorSergey Matyukevich <sergey.matyukevich@syno...>
CommiterWaldemar Brodkorb

Log Message

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>

Change Summary

Incremental Difference

--- a/include/elf.h
+++ b/include/elf.h
@@ -273,6 +273,7 @@ typedef struct
273273 #define EM_ARCV2 195 /* Synopsys ARCv2 Cores */
274274 #define EM_RISCV 243 /* RISC-V */
275275 #define EM_CSKY 252 /* C-SKY Cores */
276+#define EM_ARCV3_32 255 /* Synopsys ARCv3 32-bit Cores */
276277 #define EM_KVX 256 /* Kalray VLIW core of the MPPA processor family */
277278
278279 /* NEXT FREE NUMBER: Increment this after adding your official arch number */
--- a/ldso/ldso/arc/dl-sysdep.h
+++ b/ldso/ldso/arc/dl-sysdep.h
@@ -75,6 +75,9 @@ do { \
7575 #elif defined(__HS__)
7676 #define MAGIC1 EM_ARCV2
7777 #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 */
7881 #endif
7982
8083 #undef MAGIC2
--- a/libc/sysdeps/linux/arc/asm.h
+++ b/libc/sysdeps/linux/arc/asm.h
@@ -7,6 +7,29 @@
77 #ifndef _ARC_ASM_H
88 #define _ARC_ASM_H
99
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 */
1033
1134 .macro PUSHR reg
1235 push \reg
@@ -24,5 +47,6 @@
2447 pop_s \reg
2548 .endm
2649
50+#endif
2751
2852 #endif /* _ARC_ASM_H */
--- a/libc/sysdeps/linux/arc/bits/syscalls.h
+++ b/libc/sysdeps/linux/arc/bits/syscalls.h
@@ -100,7 +100,7 @@ extern long __syscall_error (int);
100100
101101 #ifdef __A7__
102102 #define ARC_TRAP_INSN "trap0 \n\t"
103-#elif defined(__HS__)
103+#else
104104 #define ARC_TRAP_INSN "trap_s 0 \n\t"
105105 #endif
106106
@@ -182,7 +182,7 @@ extern long __syscall_error (int);
182182
183183 #ifdef __A7__
184184 #define ARC_TRAP_INSN trap0
185-#elif defined(__HS__)
185+#else
186186 #define ARC_TRAP_INSN trap_s 0
187187 #endif
188188
--- a/libc/sysdeps/linux/arc/crt1.S
+++ b/libc/sysdeps/linux/arc/crt1.S
@@ -40,7 +40,9 @@ __start:
4040 ld_s r1, [sp] ; argc
4141
4242 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
4446 #ifdef L_Scrt1
4547 ld r0, [pcl, @main@gotpc]
4648 ld r3, [pcl, @_init@gotpc]
--- a/utils/ldd.c
+++ b/utils/ldd.c
@@ -34,6 +34,11 @@
3434 #define ELFCLASSM ELFCLASS32
3535 #endif
3636
37+#if defined(__ARC64_ARCH32__)
38+#define MATCH_MACHINE(x) (x == EM_ARCV3_32)
39+#define ELFCLASSM ELFCLASS32
40+#endif
41+
3742 #if defined(__arm__) || defined(__thumb__)
3843 #define MATCH_MACHINE(x) (x == EM_ARM)
3944 #define ELFCLASSM ELFCLASS32