internal/cpu: add aarch64 support functions
authorIan Lance Taylor <iant@golang.org>
Fri, 1 Jan 2021 20:05:39 +0000 (12:05 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 1 Jan 2021 23:13:50 +0000 (15:13 -0800)
Patch from Andreas Schwab.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/281000

gcc/go/gofrontend/MERGE
libgo/go/internal/cpu/cpu_gccgo.c

index e51285c721422a38fe3a83979c59dee4c79154f2..f4c99756d25fef6a37b1bf6a5cd072bb0bbf6449 100644 (file)
@@ -1,4 +1,4 @@
-fa161cb71880cf80ef53fb4bf35dba8ee01af648
+2b5bdd22b7ec2fc13ae0f644c781f64c1a209500
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index da26f4d7407ad162c49f5fff617d8dbe21b748cc..6a20b3944696fc3ee92ce1a79055d7c8da40c47e 100644 (file)
@@ -200,3 +200,29 @@ struct queryResult kdsaQuery() {
 }
 
 #endif /* defined(__s390x__)  */
+
+#ifdef __aarch64__
+
+uint64_t getisar0(void)
+  __asm__(GOSYM_PREFIX "internal_1cpu.getisar0")
+  __attribute__((no_split_stack));
+
+uint64_t getisar0() {
+       uint64_t isar0;
+
+       __asm__("mrs %0,id_aa64isar0_el1" : "=r"(isar0));
+       return isar0;
+}
+
+uint64_t getMIDR(void)
+  __asm__(GOSYM_PREFIX "internal_1cpu.getMIDR")
+  __attribute__((no_split_stack));
+
+uint64_t getMIDR() {
+       uint64_t MIDR;
+
+       __asm__("mrs %0,midr_el1" : "=r"(MIDR));
+       return MIDR;
+}
+
+#endif /* defined(__aarch64__) */