From: Mark Wooding Date: Wed, 5 Jul 2017 20:30:20 +0000 (+0100) Subject: base/dispatch.c: Fix operand constraints in `setflags'. X-Git-Tag: 2.4.2~44 X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/commitdiff_plain/25eccdf75b4839dfd3f018f19a81772d7d4350c6 base/dispatch.c: Fix operand constraints in `setflags'. It wasn't correct to use `g' here. Clang legitimately used sp-relative memory locations, which broke really badly because the stack pointer moves during the code sequence. Force the operands into registers to avoid this problem. --- diff --git a/base/dispatch.c b/base/dispatch.c index b70d44b6..50c94380 100644 --- a/base/dispatch.c +++ b/base/dispatch.c @@ -72,8 +72,8 @@ static __inline__ unsigned setflags(unsigned f) { unsigned ff; __asm__ ("pushf; pushl %1; popf; pushf; popl %0; popf" - : "=g" (ff) - : "g" (f)); + : "=r" (ff) + : "r" (f)); return (ff); } # else @@ -83,8 +83,8 @@ static __inline__ unsigned long long setflags(unsigned long f) { unsigned long ff; __asm__ ("pushf; pushq %1; popf; pushf; popq %0; popf" - : "=g" (ff) - : "g" (f)); + : "=r" (ff) + : "r" (f)); return (ff); } # endif