xref: /titanic_44/usr/src/lib/libc/amd64/threads/amd64.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	.inline	_curthread, 0
287c478bd9Sstevel@tonic-gate	movq	%fs:0, %rax
297c478bd9Sstevel@tonic-gate	.end
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gate	.inline	__curthread, 0
327c478bd9Sstevel@tonic-gate	movq	%fs:0, %rax
337c478bd9Sstevel@tonic-gate	.end
347c478bd9Sstevel@tonic-gate
357c478bd9Sstevel@tonic-gate	.inline	stkptr, 0
367c478bd9Sstevel@tonic-gate	movq	%rsp, %rax
377c478bd9Sstevel@tonic-gate	.end
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gate	.inline	gethrtime, 0
407c478bd9Sstevel@tonic-gate	movl	$3, %eax
417c478bd9Sstevel@tonic-gate	int	$0xd2
427c478bd9Sstevel@tonic-gate	.end
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate	.inline	set_lock_byte, 0
457c478bd9Sstevel@tonic-gate	movl	$1, %eax
467c478bd9Sstevel@tonic-gate	xchgb	%al, (%rdi)
477c478bd9Sstevel@tonic-gate	.end
487c478bd9Sstevel@tonic-gate
49*41efec22Sraf	.inline	atomic_cas_32, 0
507c478bd9Sstevel@tonic-gate	movl	%esi, %eax
517c478bd9Sstevel@tonic-gate	lock
527c478bd9Sstevel@tonic-gate	cmpxchgl %edx, (%rdi)
537c478bd9Sstevel@tonic-gate	.end
547c478bd9Sstevel@tonic-gate
55*41efec22Sraf	.inline	atomic_swap_32, 0
567c478bd9Sstevel@tonic-gate	movl	%esi, %eax
577c478bd9Sstevel@tonic-gate	xchgl	(%rdi), %eax
587c478bd9Sstevel@tonic-gate	.end
597c478bd9Sstevel@tonic-gate
60*41efec22Sraf	.inline	atomic_inc_32, 0
617c478bd9Sstevel@tonic-gate	lock
627c478bd9Sstevel@tonic-gate	incl	(%rdi)
637c478bd9Sstevel@tonic-gate	.end
647c478bd9Sstevel@tonic-gate
65*41efec22Sraf	.inline	atomic_dec_32, 0
667c478bd9Sstevel@tonic-gate	lock
677c478bd9Sstevel@tonic-gate	decl	(%rdi)
687c478bd9Sstevel@tonic-gate	.end
697c478bd9Sstevel@tonic-gate
70*41efec22Sraf	.inline	atomic_and_32, 0
71*41efec22Sraf	lock
72*41efec22Sraf	andl	%esi, (%rdi)
73*41efec22Sraf	.end
74*41efec22Sraf
75*41efec22Sraf	.inline	atomic_or_32, 0
76*41efec22Sraf	lock
77*41efec22Sraf	orl	%esi, (%rdi)
78*41efec22Sraf	.end
79*41efec22Sraf
807c478bd9Sstevel@tonic-gate	.inline ht_pause, 0
817c478bd9Sstevel@tonic-gate	rep			/ "rep nop" is equivalent to "pause"
827c478bd9Sstevel@tonic-gate	nop
837c478bd9Sstevel@tonic-gate	.end
84