Browse Source

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>
tags/v0.3.22^2
Jiaxun Yang 3 years ago
parent
commit
b633eb79f2
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      driver/others/dynamic_mips64.c

+ 8
- 5
driver/others/dynamic_mips64.c View File

@@ -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);


Loading…
Cancel
Save