Skip to content

Commit b633eb7

Browse files
committed
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 <jiaxun.yang@flygoat.com>
1 parent 19d4f90 commit b633eb7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

driver/others/dynamic_mips64.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,16 @@ static gotoblas_t *force_coretype(char *coretype) {
9797
static gotoblas_t *get_coretype_from_cpucfg(void) {
9898
int flag = 0;
9999
__asm__ volatile(
100+
".set push \n\t"
101+
".set noat \n\t"
100102
".insn \n\t"
101-
"dli $8, 0x01 \n\t"
102-
".word (0xc9084918) \n\t"
103-
"usw $9, 0x00(%0) \n\t"
103+
"dli $1, 0x01 \n\t"
104+
".word (0xc8080118) \n\t"
105+
"move %0, $1 \n\t"
106+
".set pop \n\t"
107+
: "=r"(flag)
108+
:
104109
:
105-
: "r"(&flag)
106-
: "memory"
107110
);
108111
if (flag & MSA_MASK)
109112
return (&gotoblas_LOONGSON3R4);

0 commit comments

Comments
 (0)