xref: /titanic_44/usr/src/lib/libc/i386/threads/i386.il (revision 41efec2219526a9b3ecce26f97aba761ef1e1d0d)
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
5ae115bc7Smrj * Common Development and Distribution License (the "License").
6ae115bc7Smrj * 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 */
217c478bd9Sstevel@tonic-gate/*
22ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate#pragma ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate	.inline	_curthread, 0
297c478bd9Sstevel@tonic-gate	movl	%gs:0, %eax
307c478bd9Sstevel@tonic-gate	.end
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate	.inline	__curthread, 0
337c478bd9Sstevel@tonic-gate	movl	%gs:0, %eax
347c478bd9Sstevel@tonic-gate	.end
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate	.inline	stkptr, 0
377c478bd9Sstevel@tonic-gate	movl	%esp, %eax
387c478bd9Sstevel@tonic-gate	.end
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate	.inline	gethrtime, 0
417c478bd9Sstevel@tonic-gate	movl	$3, %eax
427c478bd9Sstevel@tonic-gate	int	$0xd2
437c478bd9Sstevel@tonic-gate	.end
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate	.inline	set_lock_byte, 0
467c478bd9Sstevel@tonic-gate	movl	$1, %eax
477c478bd9Sstevel@tonic-gate	movl	(%esp), %ecx
487c478bd9Sstevel@tonic-gate	xchgb	%al, (%ecx)
497c478bd9Sstevel@tonic-gate	.end
507c478bd9Sstevel@tonic-gate
51*41efec22Sraf	.inline	atomic_cas_32, 0
527c478bd9Sstevel@tonic-gate	movl	0(%esp), %edx
537c478bd9Sstevel@tonic-gate	movl	4(%esp), %eax
547c478bd9Sstevel@tonic-gate	movl	8(%esp), %ecx
557c478bd9Sstevel@tonic-gate	lock
567c478bd9Sstevel@tonic-gate	cmpxchgl %ecx, (%edx)
577c478bd9Sstevel@tonic-gate	.end
587c478bd9Sstevel@tonic-gate
59*41efec22Sraf	.inline	atomic_swap_32, 0
607c478bd9Sstevel@tonic-gate	movl	0(%esp), %ecx
617c478bd9Sstevel@tonic-gate	movl	4(%esp), %eax
627c478bd9Sstevel@tonic-gate	xchgl	(%ecx), %eax
637c478bd9Sstevel@tonic-gate	.end
647c478bd9Sstevel@tonic-gate
65*41efec22Sraf	.inline	atomic_inc_32, 0
667c478bd9Sstevel@tonic-gate	movl	0(%esp), %eax
677c478bd9Sstevel@tonic-gate	lock
687c478bd9Sstevel@tonic-gate	incl	(%eax)
697c478bd9Sstevel@tonic-gate	.end
707c478bd9Sstevel@tonic-gate
71*41efec22Sraf	.inline	atomic_dec_32, 0
727c478bd9Sstevel@tonic-gate	movl	0(%esp), %eax
737c478bd9Sstevel@tonic-gate	lock
747c478bd9Sstevel@tonic-gate	decl	(%eax)
757c478bd9Sstevel@tonic-gate	.end
767c478bd9Sstevel@tonic-gate
77*41efec22Sraf	.inline	atomic_and_32, 0
78*41efec22Sraf	movl	0(%esp), %ecx
79*41efec22Sraf	movl	4(%esp), %eax
80*41efec22Sraf	lock
81*41efec22Sraf	andl	%eax, (%ecx)
82*41efec22Sraf	.end
83*41efec22Sraf
84*41efec22Sraf	.inline	atomic_or_32, 0
85*41efec22Sraf	movl	0(%esp), %ecx
86*41efec22Sraf	movl	4(%esp), %eax
87*41efec22Sraf	lock
88*41efec22Sraf	orl	%eax, (%ecx)
89*41efec22Sraf	.end
90*41efec22Sraf
917c478bd9Sstevel@tonic-gate	.inline ht_pause, 0
927c478bd9Sstevel@tonic-gate	rep			/ "rep nop" is equivalent to "pause"
937c478bd9Sstevel@tonic-gate	nop
947c478bd9Sstevel@tonic-gate	.end
95