summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2000-11-26 00:12:56 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2000-11-26 00:12:56 +0000
commitd232bac5d7d56b02046a15c8e07ba8c5795c5e78 (patch)
treeef1541446865d7b06238616545c205f6a04cee5e /lib
parent1edc713b250a6f4b96cf4287831c82bceb5862ee (diff)
Properly implement errno handling for the threaded libc (libc_r)
The powerpc specific code was previously handling system call errors as if kernel threads existed (currently only userlang threads are modeled). Thus if multiple threads existed in a process, the process would not get the correct errno from a system call. This would cause _many_ tests to fail. Fixing this causes a number of the tests in libc_r/TEST to now work, that did not before, however a few still fail.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/arch/powerpc/sys/cerror.S20
1 files changed, 3 insertions, 17 deletions
diff --git a/lib/libc/arch/powerpc/sys/cerror.S b/lib/libc/arch/powerpc/sys/cerror.S
index de7782066bd..49d44fcd4b8 100644
--- a/lib/libc/arch/powerpc/sys/cerror.S
+++ b/lib/libc/arch/powerpc/sys/cerror.S
@@ -3,39 +3,25 @@
.text
ENTRY(cerror)
-#if defined(_THREAD_SAFE) || defined (PIC)
+#if defined (PIC)
stwu 1, -16(1) /* follow the SVR4 ABI */
mflr 3 /* error value is in r0, use r3 */
stw 3, 20(1)
#endif
+
#ifndef PIC
-# ifndef _THREAD_SAFE
addis 5, 0, errno@H
ori 5, 5, errno@L
-# else
- mr 9, 0
- bl _C_LABEL(__error)
- mr 5, 3
- mr 0, 9
-# endif
#else
-# ifndef _THREAD_SAFE
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr 4
lwz 5,_C_LABEL(errno)@got(4)
-# else
- stw 0, 12(1)
-
- bl PIC_PLT(_C_LABEL(__error))
- mr 5, 3
- lwz 0, 12(1)
-# endif
#endif
stw 0, 0(5)
addi 3, 0, -1
addi 4, 0, -1
-#if defined(_THREAD_SAFE) || defined (PIC)
+#if defined (PIC)
lwz 0, 20(1)
mtlr 0
addi 1, 1, 16 /* follow the SVR4 ABI */