From a0cd023d06cb09c43d1cb93ee08bf917292e31ed Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Fri, 15 Nov 2013 15:08:06 +0100 Subject: [PATCH] Fix the `nop` opcode on some MIPS-based Loongson CPUs. After much trouble building Mono in Debian/MIPS, @directhex narrowed it down to this issue: https://sourceware.org/ml/binutils/2009-11/msg00387.html So since some of the 2E and 2F versions of the Loongson CPUs break with a regular `sll zero, zero, 0` we need to issue an `or at, at, 0`. This makes sure we don't randomly deadlock or blow up when the CPU is under heavy load. Yes, really. --- mono/arch/mips/mips-codegen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mono/arch/mips/mips-codegen.h b/mono/arch/mips/mips-codegen.h index dc4df7d8a6a..1dbd1c6e279 100644 --- a/mono/arch/mips/mips-codegen.h +++ b/mono/arch/mips/mips-codegen.h @@ -334,7 +334,7 @@ enum { /* misc and coprocessor ops */ #define mips_move(c,dest,src) mips_addu(c,dest,src,mips_zero) #define mips_dmove(c,dest,src) mips_daddu(c,dest,src,mips_zero) -#define mips_nop(c) mips_sll(c,0,0,0) +#define mips_nop(c) mips_or(c,mips_at,mips_at,0) #define mips_break(c,code) mips_emit32(c, ((code)<<6)|13) #define mips_mfhi(c,dest) mips_format_r(c,0,0,0,dest,0,16) #define mips_mflo(c,dest) mips_format_r(c,0,0,0,dest,0,18) -- 2.25.1