summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorraf <none@none>2005-11-29 11:51:21 -0800
committerraf <none@none>2005-11-29 11:51:21 -0800
commit0ec5755428223b8105e488e8fddc19de4db26521 (patch)
treeb591b7b19a02be3744f72bcb43264ff1a64ebc97 /usr
parentafd1ac7b1c9a8cdf273c865aa5e9a14620341443 (diff)
downloadillumos-joyent-0ec5755428223b8105e488e8fddc19de4db26521.tar.gz
6350867 gcc and libc don't get along on sparc
--HG-- rename : usr/src/lib/libc/amd64/threads/inlines.s => deleted_files/usr/src/lib/libc/amd64/threads/inlines.s rename : usr/src/lib/libc/i386/threads/inlines.s => usr/src/lib/libc/i386/gen/_divdi3.s
Diffstat (limited to 'usr')
-rw-r--r--usr/src/cmd/picl/picld/picld.c3
-rw-r--r--usr/src/lib/libc/amd64/Makefile1
-rw-r--r--usr/src/lib/libc/amd64/threads/inlines.s66
-rw-r--r--usr/src/lib/libc/i386/Makefile.com7
-rw-r--r--usr/src/lib/libc/i386/gen/_divdi3.s (renamed from usr/src/lib/libc/i386/threads/inlines.s)39
-rw-r--r--usr/src/lib/libc/inc/base_conversion.h8
-rw-r--r--usr/src/lib/libc/inc/base_inlines.h138
-rw-r--r--usr/src/lib/libc/inc/libc.h7
-rw-r--r--usr/src/lib/libc/inc/thr_inlines.h290
-rw-r--r--usr/src/lib/libc/inc/thr_uberdata.h142
-rw-r--r--usr/src/lib/libc/port/gen/getxby_door.c40
-rw-r--r--usr/src/lib/libc/port/sys/lwp.c18
-rw-r--r--usr/src/lib/libc/sparc/Makefile8
-rw-r--r--usr/src/lib/libc/sparc/fp/__quad.s176
-rw-r--r--usr/src/lib/libc/sparc/gen/getctxt.c6
-rw-r--r--usr/src/lib/libc/sparc/gen/swapctxt.c6
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile5
-rw-r--r--usr/src/lib/libc/sparcv9/gen/getctxt.c6
-rw-r--r--usr/src/lib/libc/sparcv9/gen/swapctxt.c6
-rw-r--r--usr/src/lib/libc/spec/private.spec6
-rw-r--r--usr/src/lib/libsldap/common/ns_cache_door.c35
21 files changed, 689 insertions, 324 deletions
diff --git a/usr/src/cmd/picl/picld/picld.c b/usr/src/cmd/picl/picld/picld.c
index 14f804c8d2..30d0ff67d7 100644
--- a/usr/src/cmd/picl/picld/picld.c
+++ b/usr/src/cmd/picl/picld/picld.c
@@ -19,6 +19,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -830,7 +831,7 @@ daemon_exists(void)
}
if ((dinfo.di_attributes & DOOR_REVOKED) ||
- (dinfo.di_data != (door_ptr_t)PICLD_DOOR_COOKIE)) {
+ (dinfo.di_data != (uintptr_t)PICLD_DOOR_COOKIE)) {
(void) close(doorh);
return (0);
}
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index 3f446d1b0e..4b71748be4 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -740,7 +740,6 @@ THREADSMACHOBJS= \
machdep.o
THREADSASMOBJS= \
- inlines.o \
asm_subr.o
UNWINDMACHOBJS= \
diff --git a/usr/src/lib/libc/amd64/threads/inlines.s b/usr/src/lib/libc/amd64/threads/inlines.s
deleted file mode 100644
index c270916dfc..0000000000
--- a/usr/src/lib/libc/amd64/threads/inlines.s
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
- .file "%M%"
-
-#include <SYS.h>
-
-/*
- * Functions needed because gcc doesn't understand .il files.
- */
- ENTRY(_curthread)
- movq %fs:0, %rax
- ret
- SET_SIZE(_curthread)
-
- ENTRY(__curthread)
- xorq %rax, %rax
- movw %fs, %ax
- andq %rax, %rax
- je 1f
- movq %fs:0, %rax
-1:
- ret
- SET_SIZE(__curthread)
-
- ENTRY(set_lock_byte)
- movl $1, %eax
- xchgb %al, (%rdi)
- ret
- SET_SIZE(set_lock_byte)
-
- ENTRY(swap32)
- xchgl (%rdi), %esi
- ret
- SET_SIZE(swap32)
-
- ENTRY(ht_pause)
- rep /* "rep nop" is equivalent to "pause" */
- nop
- ret
- SET_SIZE(ht_pause)
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index 9f5aecc002..96544e7e7c 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -99,6 +99,7 @@ COMOBJS= \
GENOBJS= \
_div64.o \
+ _divdi3.o \
_getsp.o \
_mul64.o \
abs.o \
@@ -780,7 +781,6 @@ THREADSMACHOBJS= \
machdep.o
THREADSASMOBJS= \
- inlines.o \
asm_subr.o
UNWINDMACHOBJS= \
@@ -933,11 +933,6 @@ ALTPICS= $(TRACEOBJS:%=pics/%)
$(DYNLIB) := PICS += $(ROOTFS_LIBDIR)/libc_i18n.a
$(DYNLIB) := BUILD.SO = $(LD) -o $@ -G $(DYNFLAGS) $(PICS) $(ALTPICS) $(LDLIBS)
-#
-# XX64 Don't know why ctf fails. Remove when it is fixed.
-#
-$(__GNUC)$(DYNLIB) := CTFMERGE_POST =
-
MAPDIR= ../spec/i386
MAPFILE= $(MAPDIR)/mapfile
diff --git a/usr/src/lib/libc/i386/threads/inlines.s b/usr/src/lib/libc/i386/gen/_divdi3.s
index ececdbfe63..c0dfcd1052 100644
--- a/usr/src/lib/libc/i386/threads/inlines.s
+++ b/usr/src/lib/libc/i386/gen/_divdi3.s
@@ -19,6 +19,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -31,44 +32,6 @@
#include <SYS.h>
/*
- * Functions needed because gcc doesn't understand .il files.
- */
- ENTRY(_curthread)
- movl %gs:0, %eax
- ret
- SET_SIZE(_curthread)
-
- ENTRY(__curthread)
- xorl %eax, %eax
- movw %gs, %ax
- andl %eax, %eax
- je 1f
- movl %gs:0, %eax
-1:
- ret
- SET_SIZE(__curthread)
-
- ENTRY(set_lock_byte)
- movl $1, %eax
- movl 4(%esp), %ecx
- xchgb %al, (%ecx)
- ret
- SET_SIZE(set_lock_byte)
-
- ENTRY(swap32)
- movl 4(%esp), %ecx
- movl 8(%esp), %eax
- xchgl (%ecx), %eax
- ret
- SET_SIZE(swap32)
-
- ENTRY(ht_pause)
- rep /* "rep nop" is equivalent to "pause" */
- nop
- ret
- SET_SIZE(ht_pause)
-
-/*
* C support for 64-bit modulo and division.
* GNU routines callable from C (though generated by the compiler).
* Hand-customized compiler output - see comments for details.
diff --git a/usr/src/lib/libc/inc/base_conversion.h b/usr/src/lib/libc/inc/base_conversion.h
index 01ad283c3a..f3b8d5d1e8 100644
--- a/usr/src/lib/libc/inc/base_conversion.h
+++ b/usr/src/lib/libc/inc/base_conversion.h
@@ -19,11 +19,15 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+#ifndef BASE_CONVERSION_H
+#define BASE_CONVERSION_H
+
#pragma ident "%Z%%M% %I% %E% SMI"
#include <errno.h>
@@ -335,3 +339,7 @@ extern double __dabs(double *);
#if defined(sparc) || defined(__sparc)
extern enum fp_direction_type _QgetRD(void);
#endif
+
+#include "base_inlines.h"
+
+#endif /* BASE_CONVERSION_H */
diff --git a/usr/src/lib/libc/inc/base_inlines.h b/usr/src/lib/libc/inc/base_inlines.h
new file mode 100644
index 0000000000..1753a3e044
--- /dev/null
+++ b/usr/src/lib/libc/inc/base_inlines.h
@@ -0,0 +1,138 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _BASE_INLINES_H
+#define _BASE_INLINES_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/types.h>
+
+#if !defined(__lint) && defined(__GNUC__)
+
+/*
+ * This file is intended to contain gcc-style inline assembly that corresponds
+ * to base.il for all architectures. At the moment these inlines exist only
+ * for sparc and sparcv9 and these functions are implemented in C for x86.
+ * They should be inlined here for gcc if a new x86 base.il is created.
+ */
+
+#if defined(__sparc)
+extern __inline__ double
+__mul_set(double x, double y, int *pe)
+{
+ double __result;
+ uint32_t __fsr;
+ uint32_t *__addr = &__fsr;
+
+ __asm__ __volatile__(
+ "fmuld %4, %5, %0\n\t"
+ "st %%fsr, %3\n\t"
+ "ld %3, %2\n\t"
+ "and %2, 1, %2\n\t"
+ "st %2, %1"
+ : "=&e" (__result), "=m" (*pe), "=r" (__fsr), "=m" (*__addr)
+ : "e" (x), "e" (y));
+ return (__result);
+}
+#endif /* __sparc */
+
+#if defined(__sparc)
+extern __inline__ double
+__div_set(double x, double y, int *pe)
+{
+ double __result;
+ uint32_t __fsr;
+ uint32_t *__addr = &__fsr;
+
+ __asm__ __volatile__(
+ "fdivd %4, %5, %0\n\t"
+ "st %%fsr, %3\n\t"
+ "ld %3, %2\n\t"
+ "and %2, 1, %2\n\t"
+ "st %2, %1"
+ : "=&e" (__result), "=m" (*pe), "=r" (__fsr), "=m" (*__addr)
+ : "e" (x), "e" (y));
+ return (__result);
+}
+#endif /* __sparc */
+
+#if defined(__sparc)
+extern __inline__ double
+__dabs(double *x)
+{
+ double __result;
+
+ __asm__ __volatile__(
+#if defined(__sparcv9)
+ "fabsd %1, %0"
+#else
+ "fabss %1, %0"
+#endif
+ : "=e" (__result)
+ : "0" (*x));
+ return (__result);
+}
+#endif /* __sparc */
+
+#if defined(__sparc)
+extern __inline__ void
+__get_ieee_flags(__ieee_flags_type *b)
+{
+ uint32_t __fsr;
+
+ /*
+ * It's preferable to let the assembler insert the nops as
+ * needed; however, it warns as it does so. Add them here for now.
+ */
+ __asm__ __volatile__(
+ "st %%fsr, %0\n\t"
+ "st %%g0, %1\n\t"
+ "ld %1, %%fsr\n\t"
+ "nop; nop; nop"
+ : "=m" (*b), "=m" (__fsr));
+}
+#endif /* __sparc */
+
+#if defined(__sparc)
+extern __inline__ void
+__set_ieee_flags(__ieee_flags_type *b)
+{
+ /*
+ * It's preferable to let the assembler insert the nops as
+ * needed; however, it warns as it does so. Add them here for now.
+ */
+ __asm__ __volatile__(
+ "ld %0, %%fsr\n\t"
+ "nop; nop; nop"
+ : /* no outputs */
+ : "m" (*b));
+}
+#endif /* __sparc */
+
+#endif /* !__lint && __GNUC__ */
+
+#endif /* _BASE_INLINES_H */
diff --git a/usr/src/lib/libc/inc/libc.h b/usr/src/lib/libc/inc/libc.h
index 00e147631c..cf5173cc1b 100644
--- a/usr/src/lib/libc/inc/libc.h
+++ b/usr/src/lib/libc/inc/libc.h
@@ -19,6 +19,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -98,7 +99,6 @@ extern int64_t __div64(int64_t, int64_t);
extern int64_t __rem64(int64_t, int64_t);
extern uint64_t __udiv64(uint64_t, uint64_t);
extern uint64_t __urem64(uint64_t, uint64_t);
-extern uint64_t _umul32x32to64(uint32_t, uint32_t);
extern int64_t __mul64(int64_t, int64_t);
extern uint64_t __umul64(uint64_t, uint64_t);
@@ -325,11 +325,6 @@ extern size_t _wcslen(const wchar_t *);
*/
extern wchar_t *_wcscpy(wchar_t *, const wchar_t *);
-#ifdef __sparc
-extern ulong_t caller(void);
-extern ulong_t getfp(void);
-#endif
-
/*
* misc synonyms
*/
diff --git a/usr/src/lib/libc/inc/thr_inlines.h b/usr/src/lib/libc/inc/thr_inlines.h
new file mode 100644
index 0000000000..e49ac97501
--- /dev/null
+++ b/usr/src/lib/libc/inc/thr_inlines.h
@@ -0,0 +1,290 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef _THR_INLINES_H
+#define _THR_INLINES_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#if !defined(__lint) && defined(__GNUC__)
+
+/* inlines for gcc */
+
+extern __inline__ ulwp_t *
+_curthread(void)
+{
+#if defined(__amd64)
+ ulwp_t *__value;
+ __asm__ __volatile__("movq %%fs:0, %0" : "=r" (__value));
+#elif defined(__i386)
+ ulwp_t *__value;
+ __asm__ __volatile__("movl %%gs:0, %0" : "=r" (__value));
+#elif defined(__sparc)
+ register ulwp_t *__value __asm__("g7");
+#else
+#error "port me"
+#endif
+ return (__value);
+}
+
+extern __inline__ ulwp_t *
+__curthread(void)
+{
+ ulwp_t *__value;
+ __asm__ __volatile__(
+#if defined(__amd64)
+ "xorq %0, %0\n\t"
+ "mov %%fs, %0\n\t"
+ "andq %0, %0\n\t"
+ "je 1f\n\t"
+ "movq %%fs:0, %0\n\t"
+#elif defined(__i386)
+ "xorl %0, %0\n\t"
+ "mov %%gs, %0\n\t"
+ "andl %0, %0\n\t"
+ "je 1f\n\t"
+ "movl %%gs:0, %0\n\t"
+#elif defined(__sparcv9)
+ ".register %%g7, #scratch\n\t"
+ "tst %%g7\n\t"
+ "be,a,pn %%xcc, 1f\n\t"
+ " mov %%g0, %0\n\t"
+ "ldx [%%g7 + 80], %0\n\t"
+#elif defined(__sparc)
+ ".register %%g7, #scratch\n\t"
+ "tst %%g7\n\t"
+ "be,a 1f\n\t"
+ " mov %%g0, %0\n\t"
+ "ld [%%g7 + 80], %0\n\t"
+#else
+#error "port me"
+#endif
+ "1:"
+ : "=r" (__value)
+ : : "cc");
+ return (__value);
+}
+
+extern __inline__ greg_t
+stkptr(void)
+{
+#if defined(__amd64)
+ register greg_t __value __asm__("rsp");
+#elif defined(__i386)
+ register greg_t __value __asm__("esp");
+#elif defined(__sparc)
+ register greg_t __value __asm__("sp");
+#else
+#error "port me"
+#endif
+ return (__value);
+}
+
+extern __inline__ hrtime_t
+gethrtime(void) /* note: caller-saved registers are trashed */
+{
+#if defined(__amd64)
+ hrtime_t __value;
+ __asm__ __volatile__(
+ "movl $3, %%eax\n\t"
+ "int $0xd2"
+ : "=a" (__value)
+ : : "rcx", "rdx", "rsi", "rdi", "r8", "r9", "r10", "r11", "cc");
+#elif defined(__i386)
+ hrtime_t __value;
+ __asm__ __volatile__(
+ "movl $3, %%eax\n\t"
+ "int $0xd2"
+ : "=A" (__value)
+ : : "ecx", "cc");
+#elif defined(__sparcv9)
+ register hrtime_t __value __asm__("o0");
+ __asm__ __volatile__(
+ "ta 0x24\n\t"
+ "sllx %%o0, 32, %0\n\t"
+ "or %%o1, %0, %0"
+ : "=r" (__value)
+ : : "o1", "o2", "o3", "o4", "o5", "cc");
+#elif defined(__sparc)
+ register hrtime_t __value __asm__("o0");
+ __asm__ __volatile__(
+ "ta 0x24"
+ : "=r" (__value)
+ : : "o2", "o3", "o4", "o5", "cc");
+#else
+#error "port me"
+#endif
+ return (__value);
+}
+
+extern __inline__ int
+set_lock_byte(volatile uint8_t *__lockp)
+{
+ int __value;
+#if defined(__x86)
+ __asm__ __volatile__(
+ "movl $1, %0\n\t"
+ "xchgb %%dl, %1"
+ : "+d" (__value), "+m" (*__lockp));
+#elif defined(__sparc)
+ __asm__ __volatile__(
+ "ldstub %1, %0\n\t"
+ "membar #LoadLoad"
+ : "=r" (__value), "+m" (*__lockp));
+#else
+#error "port me"
+#endif
+ return (__value);
+}
+
+extern __inline__ uint32_t
+swap32(volatile uint32_t *__memory, uint32_t __value)
+{
+#if defined(__x86)
+ __asm__ __volatile__(
+ "xchgl %0, %1"
+ : "+q" (__value), "+m" (*__memory));
+ return (__value);
+#elif defined(__sparc)
+ uint32_t __tmp1, __tmp2;
+ __asm__ __volatile__(
+ "ld [%3], %0\n\t"
+ "1:\n\t"
+ "mov %4, %1\n\t"
+ "cas [%3], %0, %1\n\t"
+ "cmp %0, %1\n\t"
+ "bne,a,pn %%icc, 1b\n\t"
+ " mov %1, %0"
+ : "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__memory)
+ : "r" (__memory), "r" (__value)
+ : "cc");
+ return (__tmp2);
+#else
+#error "port me"
+#endif
+}
+
+extern __inline__ uint32_t
+cas32(volatile uint32_t *__memory, uint32_t __cmp, uint32_t __newvalue)
+{
+ uint32_t __oldvalue;
+#if defined(__x86)
+ __asm__ __volatile__(
+ "lock; cmpxchgl %3, %0"
+ : "=m" (*__memory), "=a" (__oldvalue)
+ : "a" (__cmp), "r" (__newvalue));
+#elif defined(__sparc)
+ __asm__ __volatile__(
+ "cas [%2], %3, %1"
+ : "=m" (*__memory), "+r" (__oldvalue)
+ : "r" (__memory), "r" (__cmp), "1" (__newvalue));
+#else
+#error "port me"
+#endif
+ return (__oldvalue);
+}
+
+extern __inline__ void
+incr32(volatile uint32_t *__memory)
+{
+#if defined(__x86)
+ __asm__ __volatile__(
+ "lock; incl %0"
+ : "+m" (*__memory));
+#elif defined(__sparc)
+ uint32_t __tmp1, __tmp2;
+ __asm__ __volatile__(
+ "ld [%3], %0\n\t"
+ "1:\n\t"
+ "add %0, 1, %1\n\t"
+ "cas [%3], %0, %1\n\t"
+ "cmp %0, %1\n\t"
+ "bne,a,pn %%icc, 1b\n\t"
+ " mov %1, %0"
+ : "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__memory)
+ : "r" (__memory)
+ : "cc");
+#else
+#error "port me"
+#endif
+}
+
+extern __inline__ void
+decr32(volatile uint32_t *__memory)
+{
+#if defined(__x86)
+ __asm__ __volatile__(
+ "lock; decl %0"
+ : "+m" (*__memory));
+#elif defined(__sparc)
+ uint32_t __tmp1, __tmp2;
+ __asm__ __volatile__(
+ "ld [%3], %0\n\t"
+ "1:\n\t"
+ "sub %0, 1, %1\n\t"
+ "cas [%3], %0, %1\n\t"
+ "cmp %0, %1\n\t"
+ "bne,a,pn %%icc, 1b\n\t"
+ " mov %1, %0"
+ : "=&r" (__tmp1), "=&r" (__tmp2), "=m" (*__memory)
+ : "r" (__memory)
+ : "cc");
+#else
+#error "port me"
+#endif
+}
+
+#if defined(__sparc) /* only needed on sparc */
+
+extern __inline__ ulong_t
+caller(void)
+{
+ register ulong_t __value __asm__("i7");
+ return (__value);
+}
+
+extern __inline__ ulong_t
+getfp(void)
+{
+ register ulong_t __value __asm__("fp");
+ return (__value);
+}
+
+#endif /* __sparc */
+
+#if defined(__x86) /* only needed on x86 */
+
+extern __inline__ void
+ht_pause(void)
+{
+ __asm__ __volatile__("rep; nop");
+}
+
+#endif /* __x86 */
+
+#endif /* !__lint && __GNUC__ */
+
+#endif /* _THR_INLINES_H */
diff --git a/usr/src/lib/libc/inc/thr_uberdata.h b/usr/src/lib/libc/inc/thr_uberdata.h
index 30ab2e5cc5..79c2363a45 100644
--- a/usr/src/lib/libc/inc/thr_uberdata.h
+++ b/usr/src/lib/libc/inc/thr_uberdata.h
@@ -19,6 +19,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -106,7 +107,7 @@
#define WAITER 0x00000001
#define LOCKSET 0xff
#define LOCKCLEAR 0
-#elif defined(__i386) || defined(__amd64)
+#elif defined(__x86)
/* lock.lock64.pad[x] 7 6 5 4 */
#define LOCKMASK 0xff000000
#define WAITERMASK 0x00ff0000
@@ -114,7 +115,7 @@
#define LOCKSET 0x01
#define LOCKCLEAR 0
#else
-#error "none of __sparc __i386 __amd64 is defined"
+#error "neither __sparc nor __x86 is defined"
#endif
/*
@@ -215,7 +216,7 @@ extern struct pcclass ts_class, rt_class;
#define MUTEX_TRY 0
#define MUTEX_LOCK 1
-#if defined(__i386) || defined(__amd64)
+#if defined(__x86)
typedef struct { /* structure returned by fnstenv */
int fctrl; /* control word */
@@ -242,14 +243,14 @@ typedef struct {
} fpuenv32_t;
#endif /* _SYSCALL32 */
-#endif /* __i386 || __amd64 */
+#endif /* __x86 */
-#if defined(__i386) || defined(__amd64)
+#if defined(__x86)
extern void ht_pause(void); /* "pause" instruction */
#define SMT_PAUSE() ht_pause()
#else
#define SMT_PAUSE()
-#endif /* __i386 || __amd64 */
+#endif /* __x86 */
/*
* Cleanup handler related data.
@@ -827,7 +828,7 @@ typedef struct ulwp32 {
uint32_t ul_dreturn; /* dtrace: return %o0 */
#endif
caddr32_t ul_self; /* pointer to self */
-#if defined(__i386) || defined(__amd64)
+#if defined(__x86)
uint8_t ul_dinstr[40]; /* scratch space for dtrace */
#endif
caddr32_t ul_uberdata; /* uber (super-global) data */
@@ -1042,123 +1043,6 @@ extern greg_t stkptr(void);
#define __attribute__(string)
#endif
-#if !defined(__lint) && defined(__GNUC__) && \
- (defined(__i386) || defined(__amd64))
-
-/* inlines for gcc */
-
-extern __inline__ ulwp_t *_curthread(void)
-{
- void *__value;
- __asm__ __volatile__(
-#if defined(__amd64)
- "movq %%fs:0,%0" : "=r" (__value));
-#else /* __i386 */
- "movl %%gs:0,%0" : "=r" (__value));
-#endif
- return (__value);
-}
-
-extern __inline__ ulwp_t *__curthread(void)
-{
- void *__value;
- __asm__ __volatile__(
-#if defined(__amd64)
- "xorq %0,%0;"
- "mov %%fs,%0;"
- "andq %0,%0;"
- "je 1f;"
- "movq %%fs:0,%0;"
-#else /* __i386 */
- "xorl %0,%0;"
- "mov %%gs,%0;"
- "andl %0,%0;"
- "je 1f;"
- "movl %%gs:0,%0;"
-#endif
- "1:" : "=r" (__value));
- return (__value);
-}
-
-extern __inline__ greg_t stkptr(void)
-{
- greg_t __value;
- __asm__ __volatile__(
-#if defined(__amd64)
- "movq %%rsp, %0"
-#else /* __i386 */
- "movl %%esp, %0"
-#endif
- : "=r" (__value));
- return (__value);
-}
-
-extern __inline__ hrtime_t gethrtime(void)
-{
- hrtime_t __value;
-#if defined(__amd64)
- __asm__ __volatile__(
- "movl $3,%%eax;"
- "int $0xd2" /* caller-saved registers are trashed */
- : "=a" (__value)
- : : "rcx", "rdx", "rsi", "rdi", "r8", "r9", "r10", "r11");
-#else /* __i386 */
- __asm__ __volatile__(
- "movl $3,%%eax;"
- "int $0xd2"
- : "=A" (__value)
- : : "ecx");
-#endif
- return (__value);
-}
-
-extern __inline__ int set_lock_byte(volatile uint8_t *__lockp)
-{
- int __value;
- __asm__ __volatile__(
- "movl $1,%0;"
- "xchgb %%dl,%1" : "+d" (__value) : "m" (*__lockp));
- return (__value);
-}
-
-extern __inline__ uint32_t
-swap32(volatile uint32_t *__memory, uint32_t __value)
-{
- __asm__ __volatile__(
- "xchgl %0,%1" : "+q" (__value) : "m" (*__memory));
- return (__value);
-}
-
-extern __inline__ uint32_t
-cas32(volatile uint32_t *__memory, uint32_t __cmp, uint32_t __newvalue)
-{
- uint32_t __oldvalue;
- __asm__ __volatile__(
- "lock; cmpxchgl %3, %0"
- : "=m" (*__memory), "=a" (__oldvalue)
- : "a" (__cmp), "r" (__newvalue));
- return (__oldvalue);
-}
-
-extern __inline__ void incr32(volatile uint32_t *__memory)
-{
- __asm__ __volatile__(
- "lock; incl %0" : "=m" (*__memory) : "m" (*__memory));
-}
-
-extern __inline__ void decr32(volatile uint32_t *__memory)
-{
- __asm__ __volatile__(
- "lock; decl %0" : "=m" (*__memory) : "m" (*__memory));
-}
-
-extern __inline__ void ht_pause()
-{
- __asm__ __volatile__("rep; nop");
-}
-
-#endif /* !__lint && __GNUC__ && (__i386 || __amd64) */
-
/*
* Implementation functions. Not visible outside of the library itself.
*/
@@ -1456,9 +1340,9 @@ extern int __lwp_rwlock_unlock(rwlock_t *);
extern int __lwp_park(timespec_t *, lwpid_t);
extern int __lwp_unpark(lwpid_t);
extern int __lwp_unpark_all(lwpid_t *, int);
-#if defined(__i386) || defined(__amd64)
+#if defined(__x86)
extern int ___lwp_private(int, int, void *);
-#endif /* __i386 || __amd64 */
+#endif /* __x86 */
extern int _private_lwp_mutex_lock(mutex_t *);
extern int _private_lwp_mutex_unlock(mutex_t *);
@@ -1471,5 +1355,11 @@ extern uint32_t swap32(volatile uint32_t *, uint32_t);
extern uint32_t cas32(volatile uint32_t *, uint32_t, uint32_t);
extern void incr32(volatile uint32_t *);
extern void decr32(volatile uint32_t *);
+#if defined(__sparc)
+extern ulong_t caller(void);
+extern ulong_t getfp(void);
+#endif /* __sparc */
+
+#include "thr_inlines.h"
#endif /* _THR_UBERDATA_H */
diff --git a/usr/src/lib/libc/port/gen/getxby_door.c b/usr/src/lib/libc/port/gen/getxby_door.c
index 7f6f5bfc09..d4e64868e1 100644
--- a/usr/src/lib/libc/port/gen/getxby_door.c
+++ b/usr/src/lib/libc/port/gen/getxby_door.c
@@ -19,8 +19,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -103,11 +104,10 @@ _nsc_trydoorcall(nsc_data_t **dptr, int *ndata, int *adata)
try_again:
if (doorfd == -1) {
-
int tbc[3];
int i;
- if ((doorfd = open64(NAME_SERVICE_DOOR, O_RDONLY, 0))
- == -1) {
+
+ if ((doorfd = open64(NAME_SERVICE_DOOR, O_RDONLY, 0)) == -1) {
lmutex_unlock(&_door_lock);
return (NOSERVER);
}
@@ -136,7 +136,9 @@ try_again:
* mark this door descriptor as close on exec
*/
(void) fcntl(doorfd, F_SETFD, FD_CLOEXEC);
- if (__door_info(doorfd, &real_door) == -1) {
+ if (__door_info(doorfd, &real_door) == -1 ||
+ (real_door.di_attributes & DOOR_REVOKED) ||
+ real_door.di_data != (uintptr_t)NAME_SERVICE_DOOR_COOKIE) {
/*
* we should close doorfd because we just opened it
*/
@@ -145,27 +147,17 @@ try_again:
lmutex_unlock(&_door_lock);
return (NOSERVER);
}
-
- if ((real_door.di_attributes & DOOR_REVOKED) ||
- (real_door.di_data !=
- (door_ptr_t)NAME_SERVICE_DOOR_COOKIE)) {
- (void) close(doorfd);
+ } else {
+ if (__door_info(doorfd, &my_door) == -1 ||
+ my_door.di_data != (uintptr_t)NAME_SERVICE_DOOR_COOKIE ||
+ my_door.di_uniquifier != real_door.di_uniquifier) {
+ /*
+ * don't close it -
+ * someone else has clobbered fd
+ */
doorfd = -1;
- lmutex_unlock(&_door_lock);
- return (NOSERVER);
+ goto try_again;
}
- } else {
-
- if ((__door_info(doorfd, &my_door) == -1) ||
- (my_door.di_data != (door_ptr_t)NAME_SERVICE_DOOR_COOKIE) ||
- (my_door.di_uniquifier != real_door.di_uniquifier)) {
- /*
- * don't close it -
- * someone else has clobbered fd
- */
- doorfd = -1;
- goto try_again;
- }
if (my_door.di_attributes & DOOR_REVOKED) {
(void) close(doorfd); /* nscd exited .... */
diff --git a/usr/src/lib/libc/port/sys/lwp.c b/usr/src/lib/libc/port/sys/lwp.c
index 9d97d3c6ee..4343bef1c5 100644
--- a/usr/src/lib/libc/port/sys/lwp.c
+++ b/usr/src/lib/libc/port/sys/lwp.c
@@ -19,8 +19,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -37,7 +38,7 @@
#endif /* __i386 || __amd64 */
#include "synonyms.h"
-#include "mtlib.h"
+#include "thr_uberdata.h"
#include <sys/types.h>
#include <sys/time.h>
#include <errno.h>
@@ -47,7 +48,6 @@
extern int ___lwp_mutex_timedlock(mutex_t *, timespec_t *);
extern int ___lwp_sema_timedwait(lwp_sema_t *, timespec_t *, int);
-extern int set_lock_byte(volatile uint8_t *);
int
_lwp_mutex_lock(mutex_t *mp)
@@ -80,14 +80,14 @@ _lwp_sema_wait(lwp_sema_t *sp)
return (___lwp_sema_timedwait(sp, NULL, 0));
}
-#if defined(__i386) || defined(__amd64)
+#if defined(__x86)
int
_lwp_private(int cmd, int which, void *sbase)
{
extern int ___lwp_private(int, int, void *);
return (___lwp_private(cmd, which, sbase));
}
-#endif /* __i386 || __amd64 */
+#endif /* __x86 */
int
_lwp_suspend(lwpid_t lwpid)
@@ -95,11 +95,3 @@ _lwp_suspend(lwpid_t lwpid)
extern int ___lwp_suspend(lwpid_t);
return (___lwp_suspend(lwpid));
}
-
-void
-_halt(void)
-{
- /*LINTED*/
- while (1)
- continue;
-}
diff --git a/usr/src/lib/libc/sparc/Makefile b/usr/src/lib/libc/sparc/Makefile
index 3f4cae59ae..0abf1da9ce 100644
--- a/usr/src/lib/libc/sparc/Makefile
+++ b/usr/src/lib/libc/sparc/Makefile
@@ -101,6 +101,9 @@ FPASMOBJS= \
fpsetrnd.o \
fpsetsticky.o
+$(__GNUC)FPASMOBJS += \
+ __quad.o
+
ATOMICOBJS= \
atomic.o
@@ -1063,6 +1066,9 @@ TIL= \
$(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il
+# special kludge for gcc inlines with 'cas':
+$(__GNUC)pics/synch.o pics/lwp.o := sparc_XARCH = -xarch=v8plus
+
# Files in port/fp subdirectory that need base.il inline template
IL= \
__flt_decim.o \
@@ -1155,8 +1161,6 @@ $(QIL:%=pics/%): ../$(MACH)/fp/__quad.il
# include common libc targets
include ../Makefile.targ
-pics/getxby_door.o := CCMODE =
-
# We need to strip out all CTF and DOF data from the static library
$(LIB_PIC) := DIR = pics
$(LIB_PIC): pics $$(PICS)
diff --git a/usr/src/lib/libc/sparc/fp/__quad.s b/usr/src/lib/libc/sparc/fp/__quad.s
new file mode 100644
index 0000000000..7954bcd4ca
--- /dev/null
+++ b/usr/src/lib/libc/sparc/fp/__quad.s
@@ -0,0 +1,176 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * These are functions corresponding to the inlines in __quad.il
+ * They are compiled as functions only when building sparc libc with gcc.
+ * Someone may want to make them into gcc inlines (__inline__ + __asm__).
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/asm_linkage.h>
+
+ ENTRY_NP(__quad_getfsrp)
+ retl
+ st %fsr,[%o0]
+ SET_SIZE(__quad_getfsrp)
+
+ ENTRY_NP(__quad_setfsrp)
+ retl
+ ld [%o0],%fsr
+ SET_SIZE(__quad_setfsrp)
+
+ ENTRY_NP(__quad_dp_sqrt)
+ ldd [%o0],%f0
+ fsqrtd %f0,%f0
+ retl
+ nop
+ SET_SIZE(__quad_dp_sqrt)
+
+ ENTRY_NP(__quad_faddq)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ ldd [%o1],%f4
+ ldd [%o1+8],%f6
+ faddq %f0,%f4,%f8
+ std %f8,[%o2]
+ retl
+ std %f10,[%o2+8]
+ SET_SIZE(__quad_faddq)
+
+ ENTRY_NP(__quad_fsubq)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ ldd [%o1],%f4
+ ldd [%o1+8],%f6
+ fsubq %f0,%f4,%f8
+ std %f8,[%o2]
+ retl
+ std %f10,[%o2+8]
+ SET_SIZE(__quad_fsubq)
+
+ ENTRY_NP(__quad_fmulq)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ ldd [%o1],%f4
+ ldd [%o1+8],%f6
+ fmulq %f0,%f4,%f8
+ std %f8,[%o2]
+ retl
+ std %f10,[%o2+8]
+ SET_SIZE(__quad_fmulq)
+
+ ENTRY_NP(__quad_fdivq)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ ldd [%o1],%f4
+ ldd [%o1+8],%f6
+ fdivq %f0,%f4,%f8
+ std %f8,[%o2]
+ retl
+ std %f10,[%o2+8]
+ SET_SIZE(__quad_fdivq)
+
+ ENTRY_NP(__quad_fsqrtq)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ fsqrtq %f0,%f4
+ std %f4,[%o1]
+ retl
+ std %f6,[%o1+8]
+ SET_SIZE(__quad_fsqrtq)
+
+ ENTRY_NP(__quad_fcmpq)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ ldd [%o1],%f4
+ ldd [%o1+8],%f6
+ fcmpq %f0,%f4
+ retl
+ st %fsr,[%o2]
+ SET_SIZE(__quad_fcmpq)
+
+ ENTRY_NP(__quad_fcmpeq)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ ldd [%o1],%f4
+ ldd [%o1+8],%f6
+ fcmpeq %f0,%f4
+ retl
+ st %fsr,[%o2]
+ SET_SIZE(__quad_fcmpeq)
+
+ ENTRY_NP(__quad_fstoq)
+ ld [%o0],%f0
+ fstoq %f0,%f4
+ std %f4,[%o1]
+ retl
+ std %f6,[%o1+8]
+ SET_SIZE(__quad_fstoq)
+
+ ENTRY_NP(__quad_fdtoq)
+ ldd [%o0],%f0
+ fdtoq %f0,%f4
+ std %f4,[%o1]
+ retl
+ std %f6,[%o1+8]
+ SET_SIZE(__quad_fdtoq)
+
+ ENTRY_NP(__quad_fqtoi)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ fqtoi %f0,%f4
+ retl
+ st %f4,[%o1]
+ SET_SIZE(__quad_fqtoi)
+
+ ENTRY_NP(__quad_fqtos)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ fqtos %f0,%f4
+ retl
+ st %f4,[%o1]
+ SET_SIZE(__quad_fqtos)
+
+ ENTRY_NP(__quad_fqtod)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ fqtod %f0,%f4
+ retl
+ std %f4,[%o1]
+ SET_SIZE(__quad_fqtod)
+
+#if defined(__sparcv9)
+ ENTRY_NP(__quad_fqtox)
+ ldd [%o0],%f0
+ ldd [%o0+8],%f2
+ fqtox %f0,%f4
+ retl
+ std %f4,[%o1]
+ SET_SIZE(__quad_fqtox)
+#endif
diff --git a/usr/src/lib/libc/sparc/gen/getctxt.c b/usr/src/lib/libc/sparc/gen/getctxt.c
index d751462234..a7fe3ebc58 100644
--- a/usr/src/lib/libc/sparc/gen/getctxt.c
+++ b/usr/src/lib/libc/sparc/gen/getctxt.c
@@ -19,12 +19,12 @@
*
* CDDL HEADER END
*/
+
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-
/*
- * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -34,9 +34,9 @@
#pragma weak getcontext = _getcontext
#include "synonyms.h"
+#include "thr_uberdata.h"
#include <ucontext.h>
#include <sys/types.h>
-#include "libc.h"
int
getcontext(ucontext_t *ucp)
diff --git a/usr/src/lib/libc/sparc/gen/swapctxt.c b/usr/src/lib/libc/sparc/gen/swapctxt.c
index 881ff7b638..ed77d3042b 100644
--- a/usr/src/lib/libc/sparc/gen/swapctxt.c
+++ b/usr/src/lib/libc/sparc/gen/swapctxt.c
@@ -19,12 +19,12 @@
*
* CDDL HEADER END
*/
+
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-
/*
- * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -33,9 +33,9 @@
#pragma weak swapcontext = _swapcontext
#include "synonyms.h"
+#include "thr_uberdata.h"
#include <ucontext.h>
#include <sys/types.h>
-#include "libc.h"
int
swapcontext(ucontext_t *oucp, const ucontext_t *nucp)
diff --git a/usr/src/lib/libc/sparcv9/Makefile b/usr/src/lib/libc/sparcv9/Makefile
index 5a34b9a1dd..13129556e5 100644
--- a/usr/src/lib/libc/sparcv9/Makefile
+++ b/usr/src/lib/libc/sparcv9/Makefile
@@ -103,6 +103,9 @@ FPASMOBJS= \
fpsetrnd.o \
fpsetsticky.o
+$(__GNUC)FPASMOBJS += \
+ __quad.o
+
ATOMICOBJS= \
atomic.o
@@ -1099,8 +1102,6 @@ $(QIL:%=pics/%): ../$(MACH)/fp/__quad.il
# include common libc targets
include ../Makefile.targ
-pics/getxby_door.o := CCMODE =
-
# We need to strip out all CTF and DOF data from the static library
$(LIB_PIC) := DIR = pics
$(LIB_PIC): pics $$(PICS)
diff --git a/usr/src/lib/libc/sparcv9/gen/getctxt.c b/usr/src/lib/libc/sparcv9/gen/getctxt.c
index d751462234..a7fe3ebc58 100644
--- a/usr/src/lib/libc/sparcv9/gen/getctxt.c
+++ b/usr/src/lib/libc/sparcv9/gen/getctxt.c
@@ -19,12 +19,12 @@
*
* CDDL HEADER END
*/
+
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-
/*
- * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -34,9 +34,9 @@
#pragma weak getcontext = _getcontext
#include "synonyms.h"
+#include "thr_uberdata.h"
#include <ucontext.h>
#include <sys/types.h>
-#include "libc.h"
int
getcontext(ucontext_t *ucp)
diff --git a/usr/src/lib/libc/sparcv9/gen/swapctxt.c b/usr/src/lib/libc/sparcv9/gen/swapctxt.c
index 881ff7b638..ed77d3042b 100644
--- a/usr/src/lib/libc/sparcv9/gen/swapctxt.c
+++ b/usr/src/lib/libc/sparcv9/gen/swapctxt.c
@@ -19,12 +19,12 @@
*
* CDDL HEADER END
*/
+
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-
/*
- * Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -33,9 +33,9 @@
#pragma weak swapcontext = _swapcontext
#include "synonyms.h"
+#include "thr_uberdata.h"
#include <ucontext.h>
#include <sys/types.h>
-#include "libc.h"
int
swapcontext(ucontext_t *oucp, const ucontext_t *nucp)
diff --git a/usr/src/lib/libc/spec/private.spec b/usr/src/lib/libc/spec/private.spec
index 1489f4feb2..ffe7c63f61 100644
--- a/usr/src/lib/libc/spec/private.spec
+++ b/usr/src/lib/libc/spec/private.spec
@@ -1321,12 +1321,6 @@ function _gtty
version SUNWprivate_1.1
end
-function _halt
-#Declaration /* Unknown. */
-arch sparc sparcv9
-version sparc=SUNWprivate_1.1 sparcv9=SUNWprivate_1.1
-end
-
function _hasmntopt # extends libc/spec/gen.spec hasmntopt
weak hasmntopt
#Declaration /* Unknown. */
diff --git a/usr/src/lib/libsldap/common/ns_cache_door.c b/usr/src/lib/libsldap/common/ns_cache_door.c
index 8d4697e7b8..f99ee5d95c 100644
--- a/usr/src/lib/libsldap/common/ns_cache_door.c
+++ b/usr/src/lib/libsldap/common/ns_cache_door.c
@@ -19,8 +19,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -134,7 +135,9 @@ try_again:
* mark this door descriptor as close on exec
*/
(void) fcntl(doorfd, F_SETFD, FD_CLOEXEC);
- if (door_info(doorfd, &real_door) == -1) {
+ if (door_info(doorfd, &real_door) == -1 ||
+ (real_door.di_attributes & DOOR_REVOKED) ||
+ real_door.di_data != (uintptr_t)LDAP_CACHE_DOOR_COOKIE) {
/*
* we should close doorfd because we just opened it
*/
@@ -143,27 +146,17 @@ try_again:
(void) mutex_unlock(&_door_lock);
return (NOSERVER);
}
-
- if ((real_door.di_attributes & DOOR_REVOKED) ||
- (real_door.di_data !=
- (door_ptr_t)LDAP_CACHE_DOOR_COOKIE)) {
- (void) close(doorfd);
+ } else {
+ if (door_info(doorfd, &my_door) == -1 ||
+ my_door.di_data != (uintptr_t)LDAP_CACHE_DOOR_COOKIE ||
+ my_door.di_uniquifier != real_door.di_uniquifier) {
+ /*
+ * don't close it -
+ * someone else has clobbered fd
+ */
doorfd = -1;
- (void) mutex_unlock(&_door_lock);
- return (NOSERVER);
+ goto try_again;
}
- } else {
-
- if ((door_info(doorfd, &my_door) == -1) ||
- (my_door.di_data != (door_ptr_t)LDAP_CACHE_DOOR_COOKIE) ||
- (my_door.di_uniquifier != real_door.di_uniquifier)) {
- /*
- * don't close it -
- * someone else has clobbered fd
- */
- doorfd = -1;
- goto try_again;
- }
if (my_door.di_attributes & DOOR_REVOKED) {
(void) close(doorfd);