From 25eccdf75b4839dfd3f018f19a81772d7d4350c6 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 5 Jul 2017 21:30:20 +0100 Subject: [PATCH] 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. --- base/dispatch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 -- 2.11.0