[syslinux:master] cpu_has_eflag(): mark output registers as earlyclobbers

syslinux-bot for H. Peter Anvin hpa at zytor.com
Wed Feb 20 19:36:06 PST 2019


Commit-ID:  090ba3a2aa9bc3f6b5491b09f51b76836c014fee
Gitweb:     https://www.syslinux.org/commit/090ba3a2aa9bc3f6b5491b09f51b76836c014fee
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Wed, 20 Feb 2019 19:33:08 -0800
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 20 Feb 2019 19:33:08 -0800

cpu_has_eflag(): mark output registers as earlyclobbers

We assign values to the output registers before the input operand is
used, so we have to use =&r to make sure the input operand isn't
clobbered.

Note: "ri" is correct; it cannot safely be a memory operand, because
the stack pointer isn't where the compiler would expect it to be.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>

---
 com32/include/x86/cpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/com32/include/x86/cpu.h b/com32/include/x86/cpu.h
index 5537da66..4bbcc802 100644
--- a/com32/include/x86/cpu.h
+++ b/com32/include/x86/cpu.h
@@ -25,7 +25,7 @@ static inline __constfunc bool cpu_has_eflag(unsigned long flag)
 	"pushf ; "
 	"pop %1 ; "
 	"popf"
-	: "=r" (f1), "=r" (f2) : "ri" (flag));
+	: "=&r" (f1), "=&r" (f2) : "ri" (flag));
 
     return !!((f1 ^ f2) & flag);
 }


More information about the Syslinux-commits mailing list