summaryrefslogtreecommitdiff
path: root/lib/librthread
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-11-09 15:36:24 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-11-09 15:36:24 +0000
commit8fa80b2f7a40629caea48ace10f37480e9a67b21 (patch)
treedaef0d95e3254f031e7c03be19ab922d91397376 /lib/librthread
parent11fa8b2619b5d1d32a006c782deedbd4bca56c30 (diff)
Add the __cerror asm bits for per-thread errno support for powerpc.
ok guenther@
Diffstat (limited to 'lib/librthread')
-rw-r--r--lib/librthread/arch/powerpc/cerror.S41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/librthread/arch/powerpc/cerror.S b/lib/librthread/arch/powerpc/cerror.S
new file mode 100644
index 00000000000..d34ea9d6398
--- /dev/null
+++ b/lib/librthread/arch/powerpc/cerror.S
@@ -0,0 +1,41 @@
+/* $OpenBSD: cerror.S,v 1.1 2011/11/09 15:36:23 kettenis Exp $ */
+
+/*
+ * Copyright (c) 1996 Dale Rahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "SYS.h"
+#include <machine/asm.h>
+
+#define ERRNOPTR_OFFSET 16
+
+ .text
+ASENTRY(__cerror)
+ lwz 5, 4(2)
+ lwz 5, ERRNOPTR_OFFSET(5)
+
+ stw 0, 0(5)
+ addi 3, 0, -1
+ addi 4, 0, -1
+ blr