]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
powerpc: Fix handling of scv return error codes [BZ #27892]
authorNicholas Piggin <npiggin@gmail.com>
Thu, 20 May 2021 14:00:36 +0000 (11:00 -0300)
committerMatheus Castanho <msc@linux.ibm.com>
Mon, 24 May 2021 20:01:40 +0000 (17:01 -0300)
When using scv for templated ASM syscalls, current code interprets any
negative return value as error, but the only valid error codes are in
the range -4095..-1 according to the ABI.

This commit also fixes 'signal.gen.test' strace test, where the issue
was first identified.

Reviewed-by: Matheus Castanho <msc@linux.ibm.com>
sysdeps/powerpc/powerpc64/sysdep.h

index c57bb1c05d02f6636689532526fa11beaeaff5ae..1ea4c3b9172951684b7042e0c276a1d77cc737c0 100644 (file)
@@ -398,8 +398,9 @@ LT_LABELSUFFIX(name,_name_end): ; \
 #endif
 
 #define RET_SCV \
-    cmpdi r3,0; \
-    bgelr+; \
+    li r9,-4095; \
+    cmpld r3,r9; \
+    bltlr+; \
     neg r3,r3;
 
 #define RET_SC \