From b633eb79f23f921ed4f22ca7cd49e65afb378248 Mon Sep 17 00:00:00 2001 From: Jiaxun Yang Date: Sun, 31 Jul 2022 18:42:51 +0100 Subject: [PATCH] Use $at as temporary register for mips/loongson CPUCFG read Some compilers (namely LLVM) are not happy with clobbering registers in inline assembly. Use $at as temporary register and explicitly use noat hint. Signed-off-by: Jiaxun Yang --- driver/others/dynamic_mips64.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/driver/others/dynamic_mips64.c b/driver/others/dynamic_mips64.c index d50b2dc27..d80e81356 100644 --- a/driver/others/dynamic_mips64.c +++ b/driver/others/dynamic_mips64.c @@ -97,13 +97,16 @@ static gotoblas_t *force_coretype(char *coretype) { static gotoblas_t *get_coretype_from_cpucfg(void) { int flag = 0; __asm__ volatile( + ".set push \n\t" + ".set noat \n\t" ".insn \n\t" - "dli $8, 0x01 \n\t" - ".word (0xc9084918) \n\t" - "usw $9, 0x00(%0) \n\t" + "dli $1, 0x01 \n\t" + ".word (0xc8080118) \n\t" + "move %0, $1 \n\t" + ".set pop \n\t" + : "=r"(flag) + : : - : "r"(&flag) - : "memory" ); if (flag & MSA_MASK) return (&gotoblas_LOONGSON3R4);