xref: /titanic_51/usr/src/uts/common/sys/atomic.h (revision ba3594ba9b5dd4c846c472a8d657edcb7c8109ac)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52b616c6cSwesolows  * Common Development and Distribution License (the "License").
62b616c6cSwesolows  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
212b616c6cSwesolows 
227c478bd9Sstevel@tonic-gate /*
23*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24*ba3594baSGarrett D'Amore  *
257c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifndef	_SYS_ATOMIC_H
307c478bd9Sstevel@tonic-gate #define	_SYS_ATOMIC_H
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
337c478bd9Sstevel@tonic-gate #include <sys/inttypes.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
392b616c6cSwesolows #if defined(_KERNEL) && defined(__GNUC__) && defined(_ASM_INLINES) && \
402b616c6cSwesolows 	(defined(__i386) || defined(__amd64))
417c478bd9Sstevel@tonic-gate #include <asm/atomic.h>
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  * Increment target.
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate extern void atomic_inc_8(volatile uint8_t *);
487c478bd9Sstevel@tonic-gate extern void atomic_inc_uchar(volatile uchar_t *);
497c478bd9Sstevel@tonic-gate extern void atomic_inc_16(volatile uint16_t *);
507c478bd9Sstevel@tonic-gate extern void atomic_inc_ushort(volatile ushort_t *);
517c478bd9Sstevel@tonic-gate extern void atomic_inc_32(volatile uint32_t *);
527c478bd9Sstevel@tonic-gate extern void atomic_inc_uint(volatile uint_t *);
537c478bd9Sstevel@tonic-gate extern void atomic_inc_ulong(volatile ulong_t *);
547c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
557c478bd9Sstevel@tonic-gate extern void atomic_inc_64(volatile uint64_t *);
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /*
587c478bd9Sstevel@tonic-gate  * Decrement target
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate extern void atomic_dec_8(volatile uint8_t *);
617c478bd9Sstevel@tonic-gate extern void atomic_dec_uchar(volatile uchar_t *);
627c478bd9Sstevel@tonic-gate extern void atomic_dec_16(volatile uint16_t *);
637c478bd9Sstevel@tonic-gate extern void atomic_dec_ushort(volatile ushort_t *);
647c478bd9Sstevel@tonic-gate extern void atomic_dec_32(volatile uint32_t *);
657c478bd9Sstevel@tonic-gate extern void atomic_dec_uint(volatile uint_t *);
667c478bd9Sstevel@tonic-gate extern void atomic_dec_ulong(volatile ulong_t *);
677c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
687c478bd9Sstevel@tonic-gate extern void atomic_dec_64(volatile uint64_t *);
697c478bd9Sstevel@tonic-gate #endif
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate /*
727c478bd9Sstevel@tonic-gate  * Add delta to target
737c478bd9Sstevel@tonic-gate  */
747c478bd9Sstevel@tonic-gate extern void atomic_add_8(volatile uint8_t *, int8_t);
757c478bd9Sstevel@tonic-gate extern void atomic_add_char(volatile uchar_t *, signed char);
767c478bd9Sstevel@tonic-gate extern void atomic_add_16(volatile uint16_t *, int16_t);
777c478bd9Sstevel@tonic-gate extern void atomic_add_short(volatile ushort_t *, short);
787c478bd9Sstevel@tonic-gate extern void atomic_add_32(volatile uint32_t *, int32_t);
797c478bd9Sstevel@tonic-gate extern void atomic_add_int(volatile uint_t *, int);
807c478bd9Sstevel@tonic-gate extern void atomic_add_ptr(volatile void *, ssize_t);
817c478bd9Sstevel@tonic-gate extern void atomic_add_long(volatile ulong_t *, long);
827c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
837c478bd9Sstevel@tonic-gate extern void atomic_add_64(volatile uint64_t *, int64_t);
847c478bd9Sstevel@tonic-gate #endif
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * logical OR bits with target
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate extern void atomic_or_8(volatile uint8_t *, uint8_t);
907c478bd9Sstevel@tonic-gate extern void atomic_or_uchar(volatile uchar_t *, uchar_t);
917c478bd9Sstevel@tonic-gate extern void atomic_or_16(volatile uint16_t *, uint16_t);
927c478bd9Sstevel@tonic-gate extern void atomic_or_ushort(volatile ushort_t *, ushort_t);
937c478bd9Sstevel@tonic-gate extern void atomic_or_32(volatile uint32_t *, uint32_t);
947c478bd9Sstevel@tonic-gate extern void atomic_or_uint(volatile uint_t *, uint_t);
957c478bd9Sstevel@tonic-gate extern void atomic_or_ulong(volatile ulong_t *, ulong_t);
967c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
977c478bd9Sstevel@tonic-gate extern void atomic_or_64(volatile uint64_t *, uint64_t);
987c478bd9Sstevel@tonic-gate #endif
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * logical AND bits with target
1027c478bd9Sstevel@tonic-gate  */
1037c478bd9Sstevel@tonic-gate extern void atomic_and_8(volatile uint8_t *, uint8_t);
1047c478bd9Sstevel@tonic-gate extern void atomic_and_uchar(volatile uchar_t *, uchar_t);
1057c478bd9Sstevel@tonic-gate extern void atomic_and_16(volatile uint16_t *, uint16_t);
1067c478bd9Sstevel@tonic-gate extern void atomic_and_ushort(volatile ushort_t *, ushort_t);
1077c478bd9Sstevel@tonic-gate extern void atomic_and_32(volatile uint32_t *, uint32_t);
1087c478bd9Sstevel@tonic-gate extern void atomic_and_uint(volatile uint_t *, uint_t);
1097c478bd9Sstevel@tonic-gate extern void atomic_and_ulong(volatile ulong_t *, ulong_t);
1107c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
1117c478bd9Sstevel@tonic-gate extern void atomic_and_64(volatile uint64_t *, uint64_t);
1127c478bd9Sstevel@tonic-gate #endif
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /*
1157c478bd9Sstevel@tonic-gate  * As above, but return the new value.  Note that these _nv() variants are
1167c478bd9Sstevel@tonic-gate  * substantially more expensive on some platforms than the no-return-value
1177c478bd9Sstevel@tonic-gate  * versions above, so don't use them unless you really need to know the
1187c478bd9Sstevel@tonic-gate  * new value *atomically* (e.g. when decrementing a reference count and
1197c478bd9Sstevel@tonic-gate  * checking whether it went to zero).
1207c478bd9Sstevel@tonic-gate  */
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate /*
1237c478bd9Sstevel@tonic-gate  * Increment target and return new value.
1247c478bd9Sstevel@tonic-gate  */
1257c478bd9Sstevel@tonic-gate extern uint8_t atomic_inc_8_nv(volatile uint8_t *);
1267c478bd9Sstevel@tonic-gate extern uchar_t atomic_inc_uchar_nv(volatile uchar_t *);
1277c478bd9Sstevel@tonic-gate extern uint16_t atomic_inc_16_nv(volatile uint16_t *);
1287c478bd9Sstevel@tonic-gate extern ushort_t atomic_inc_ushort_nv(volatile ushort_t *);
1297c478bd9Sstevel@tonic-gate extern uint32_t atomic_inc_32_nv(volatile uint32_t *);
1307c478bd9Sstevel@tonic-gate extern uint_t atomic_inc_uint_nv(volatile uint_t *);
1317c478bd9Sstevel@tonic-gate extern ulong_t atomic_inc_ulong_nv(volatile ulong_t *);
1327c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
1337c478bd9Sstevel@tonic-gate extern uint64_t atomic_inc_64_nv(volatile uint64_t *);
1347c478bd9Sstevel@tonic-gate #endif
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate /*
1377c478bd9Sstevel@tonic-gate  * Decrement target and return new value.
1387c478bd9Sstevel@tonic-gate  */
1397c478bd9Sstevel@tonic-gate extern uint8_t atomic_dec_8_nv(volatile uint8_t *);
1407c478bd9Sstevel@tonic-gate extern uchar_t atomic_dec_uchar_nv(volatile uchar_t *);
1417c478bd9Sstevel@tonic-gate extern uint16_t atomic_dec_16_nv(volatile uint16_t *);
1427c478bd9Sstevel@tonic-gate extern ushort_t atomic_dec_ushort_nv(volatile ushort_t *);
1437c478bd9Sstevel@tonic-gate extern uint32_t atomic_dec_32_nv(volatile uint32_t *);
1447c478bd9Sstevel@tonic-gate extern uint_t atomic_dec_uint_nv(volatile uint_t *);
1457c478bd9Sstevel@tonic-gate extern ulong_t atomic_dec_ulong_nv(volatile ulong_t *);
1467c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
1477c478bd9Sstevel@tonic-gate extern uint64_t atomic_dec_64_nv(volatile uint64_t *);
1487c478bd9Sstevel@tonic-gate #endif
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate /*
1517c478bd9Sstevel@tonic-gate  * Add delta to target
1527c478bd9Sstevel@tonic-gate  */
1537c478bd9Sstevel@tonic-gate extern uint8_t atomic_add_8_nv(volatile uint8_t *, int8_t);
1547c478bd9Sstevel@tonic-gate extern uchar_t atomic_add_char_nv(volatile uchar_t *, signed char);
1557c478bd9Sstevel@tonic-gate extern uint16_t atomic_add_16_nv(volatile uint16_t *, int16_t);
1567c478bd9Sstevel@tonic-gate extern ushort_t atomic_add_short_nv(volatile ushort_t *, short);
1577c478bd9Sstevel@tonic-gate extern uint32_t atomic_add_32_nv(volatile uint32_t *, int32_t);
1587c478bd9Sstevel@tonic-gate extern uint_t atomic_add_int_nv(volatile uint_t *, int);
1597c478bd9Sstevel@tonic-gate extern void *atomic_add_ptr_nv(volatile void *, ssize_t);
1607c478bd9Sstevel@tonic-gate extern ulong_t atomic_add_long_nv(volatile ulong_t *, long);
1617c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
1627c478bd9Sstevel@tonic-gate extern uint64_t atomic_add_64_nv(volatile uint64_t *, int64_t);
1637c478bd9Sstevel@tonic-gate #endif
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate /*
1667c478bd9Sstevel@tonic-gate  * logical OR bits with target and return new value.
1677c478bd9Sstevel@tonic-gate  */
1687c478bd9Sstevel@tonic-gate extern uint8_t atomic_or_8_nv(volatile uint8_t *, uint8_t);
1697c478bd9Sstevel@tonic-gate extern uchar_t atomic_or_uchar_nv(volatile uchar_t *, uchar_t);
1707c478bd9Sstevel@tonic-gate extern uint16_t atomic_or_16_nv(volatile uint16_t *, uint16_t);
1717c478bd9Sstevel@tonic-gate extern ushort_t atomic_or_ushort_nv(volatile ushort_t *, ushort_t);
1727c478bd9Sstevel@tonic-gate extern uint32_t atomic_or_32_nv(volatile uint32_t *, uint32_t);
1737c478bd9Sstevel@tonic-gate extern uint_t atomic_or_uint_nv(volatile uint_t *, uint_t);
1747c478bd9Sstevel@tonic-gate extern ulong_t atomic_or_ulong_nv(volatile ulong_t *, ulong_t);
1757c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
1767c478bd9Sstevel@tonic-gate extern uint64_t atomic_or_64_nv(volatile uint64_t *, uint64_t);
1777c478bd9Sstevel@tonic-gate #endif
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate /*
1807c478bd9Sstevel@tonic-gate  * logical AND bits with target and return new value.
1817c478bd9Sstevel@tonic-gate  */
1827c478bd9Sstevel@tonic-gate extern uint8_t atomic_and_8_nv(volatile uint8_t *, uint8_t);
1837c478bd9Sstevel@tonic-gate extern uchar_t atomic_and_uchar_nv(volatile uchar_t *, uchar_t);
1847c478bd9Sstevel@tonic-gate extern uint16_t atomic_and_16_nv(volatile uint16_t *, uint16_t);
1857c478bd9Sstevel@tonic-gate extern ushort_t atomic_and_ushort_nv(volatile ushort_t *, ushort_t);
1867c478bd9Sstevel@tonic-gate extern uint32_t atomic_and_32_nv(volatile uint32_t *, uint32_t);
1877c478bd9Sstevel@tonic-gate extern uint_t atomic_and_uint_nv(volatile uint_t *, uint_t);
1887c478bd9Sstevel@tonic-gate extern ulong_t atomic_and_ulong_nv(volatile ulong_t *, ulong_t);
1897c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
1907c478bd9Sstevel@tonic-gate extern uint64_t atomic_and_64_nv(volatile uint64_t *, uint64_t);
1917c478bd9Sstevel@tonic-gate #endif
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate /*
1947c478bd9Sstevel@tonic-gate  * If *arg1 == arg2, set *arg1 = arg3; return old value
1957c478bd9Sstevel@tonic-gate  */
1967c478bd9Sstevel@tonic-gate extern uint8_t atomic_cas_8(volatile uint8_t *, uint8_t, uint8_t);
1977c478bd9Sstevel@tonic-gate extern uchar_t atomic_cas_uchar(volatile uchar_t *, uchar_t, uchar_t);
1987c478bd9Sstevel@tonic-gate extern uint16_t atomic_cas_16(volatile uint16_t *, uint16_t, uint16_t);
1997c478bd9Sstevel@tonic-gate extern ushort_t atomic_cas_ushort(volatile ushort_t *, ushort_t, ushort_t);
2007c478bd9Sstevel@tonic-gate extern uint32_t atomic_cas_32(volatile uint32_t *, uint32_t, uint32_t);
2017c478bd9Sstevel@tonic-gate extern uint_t atomic_cas_uint(volatile uint_t *, uint_t, uint_t);
2027c478bd9Sstevel@tonic-gate extern void *atomic_cas_ptr(volatile void *, void *, void *);
2037c478bd9Sstevel@tonic-gate extern ulong_t atomic_cas_ulong(volatile ulong_t *, ulong_t, ulong_t);
2047c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
2057c478bd9Sstevel@tonic-gate extern uint64_t atomic_cas_64(volatile uint64_t *, uint64_t, uint64_t);
2067c478bd9Sstevel@tonic-gate #endif
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate /*
2097c478bd9Sstevel@tonic-gate  * Swap target and return old value
2107c478bd9Sstevel@tonic-gate  */
2117c478bd9Sstevel@tonic-gate extern uint8_t atomic_swap_8(volatile uint8_t *, uint8_t);
2127c478bd9Sstevel@tonic-gate extern uchar_t atomic_swap_uchar(volatile uchar_t *, uchar_t);
2137c478bd9Sstevel@tonic-gate extern uint16_t atomic_swap_16(volatile uint16_t *, uint16_t);
2147c478bd9Sstevel@tonic-gate extern ushort_t atomic_swap_ushort(volatile ushort_t *, ushort_t);
2157c478bd9Sstevel@tonic-gate extern uint32_t atomic_swap_32(volatile uint32_t *, uint32_t);
2167c478bd9Sstevel@tonic-gate extern uint_t atomic_swap_uint(volatile uint_t *, uint_t);
2177c478bd9Sstevel@tonic-gate extern void *atomic_swap_ptr(volatile void *, void *);
2187c478bd9Sstevel@tonic-gate extern ulong_t atomic_swap_ulong(volatile ulong_t *, ulong_t);
2197c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_INT64_TYPE)
2207c478bd9Sstevel@tonic-gate extern uint64_t atomic_swap_64(volatile uint64_t *, uint64_t);
2217c478bd9Sstevel@tonic-gate #endif
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate /*
2247c478bd9Sstevel@tonic-gate  * Perform an exclusive atomic bit set/clear on a target.
2257c478bd9Sstevel@tonic-gate  * Returns 0 if bit was sucessfully set/cleared, or -1
2267c478bd9Sstevel@tonic-gate  * if the bit was already set/cleared.
2277c478bd9Sstevel@tonic-gate  */
2287c478bd9Sstevel@tonic-gate extern int atomic_set_long_excl(volatile ulong_t *, uint_t);
2297c478bd9Sstevel@tonic-gate extern int atomic_clear_long_excl(volatile ulong_t *, uint_t);
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate /*
2327c478bd9Sstevel@tonic-gate  * Generic memory barrier used during lock entry, placed after the
2337c478bd9Sstevel@tonic-gate  * memory operation that acquires the lock to guarantee that the lock
2347c478bd9Sstevel@tonic-gate  * protects its data.  No stores from after the memory barrier will
2357c478bd9Sstevel@tonic-gate  * reach visibility, and no loads from after the barrier will be
2367c478bd9Sstevel@tonic-gate  * resolved, before the lock acquisition reaches global visibility.
2377c478bd9Sstevel@tonic-gate  */
2387c478bd9Sstevel@tonic-gate extern void membar_enter(void);
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate /*
2417c478bd9Sstevel@tonic-gate  * Generic memory barrier used during lock exit, placed before the
2427c478bd9Sstevel@tonic-gate  * memory operation that releases the lock to guarantee that the lock
2437c478bd9Sstevel@tonic-gate  * protects its data.  All loads and stores issued before the barrier
2447c478bd9Sstevel@tonic-gate  * will be resolved before the subsequent lock update reaches visibility.
2457c478bd9Sstevel@tonic-gate  */
2467c478bd9Sstevel@tonic-gate extern void membar_exit(void);
2477c478bd9Sstevel@tonic-gate 
2487c478bd9Sstevel@tonic-gate /*
2497c478bd9Sstevel@tonic-gate  * Arrange that all stores issued before this point in the code reach
2507c478bd9Sstevel@tonic-gate  * global visibility before any stores that follow; useful in producer
2517c478bd9Sstevel@tonic-gate  * modules that update a data item, then set a flag that it is available.
2527c478bd9Sstevel@tonic-gate  * The memory barrier guarantees that the available flag is not visible
2537c478bd9Sstevel@tonic-gate  * earlier than the updated data, i.e. it imposes store ordering.
2547c478bd9Sstevel@tonic-gate  */
2557c478bd9Sstevel@tonic-gate extern void membar_producer(void);
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate /*
2587c478bd9Sstevel@tonic-gate  * Arrange that all loads issued before this point in the code are
2597c478bd9Sstevel@tonic-gate  * completed before any subsequent loads; useful in consumer modules
2607c478bd9Sstevel@tonic-gate  * that check to see if data is available and read the data.
2617c478bd9Sstevel@tonic-gate  * The memory barrier guarantees that the data is not sampled until
2627c478bd9Sstevel@tonic-gate  * after the available flag has been seen, i.e. it imposes load ordering.
2637c478bd9Sstevel@tonic-gate  */
2647c478bd9Sstevel@tonic-gate extern void membar_consumer(void);
2657c478bd9Sstevel@tonic-gate #endif
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_ILP32)
2707c478bd9Sstevel@tonic-gate #define	atomic_add_ip		atomic_add_long
2717c478bd9Sstevel@tonic-gate #define	atomic_add_ip_nv	atomic_add_long_nv
2727c478bd9Sstevel@tonic-gate #define	casip			atomic_cas_ulong
2737c478bd9Sstevel@tonic-gate #endif
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate #if defined(__sparc)
2767c478bd9Sstevel@tonic-gate extern uint8_t ldstub(uint8_t *);
2777c478bd9Sstevel@tonic-gate #endif
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
2807c478bd9Sstevel@tonic-gate 
2817c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2827c478bd9Sstevel@tonic-gate }
2837c478bd9Sstevel@tonic-gate #endif
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate #endif	/* _SYS_ATOMIC_H */
286