tst.ret.s revision 2633:71bab08d24b2
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29#include <sys/asm_linkage.h>
30
31	ENTRY(ret1)
32	ret
33	SET_SIZE(ret1)
34
35	ENTRY(ret2)
36	repz
37	ret
38	SET_SIZE(ret2)
39
40	ENTRY(ret3)
41	ret	$0
42	SET_SIZE(ret3)
43
44	ENTRY(ret4)
45	repz
46	ret	$0
47	SET_SIZE(ret4)
48
49	ENTRY(ret5)
50	pushl	(%esp)
51	ret	$4
52	SET_SIZE(ret5)
53
54	ENTRY(ret6)
55	pushl	(%esp)
56	repz
57	ret	$4
58	SET_SIZE(ret6)
59
60	ENTRY(waiting)
61	pushl	%ebp
62	movl	%esp, %ebp
63	movl	8(%ebp), %eax
64	movl	(%eax), %eax
65	movl	%ebp, %esp
66	popl	%ebp
67	ret
68	SET_SIZE(waiting)
69
70	ENTRY(main)
71	pushl	%ebp
72	movl	%esp, %ebp
73	subl	$0x4, %esp
74	movl	$0x0, -4(%ebp)
75
761:
77	leal	-4(%ebp), %eax
78	pushl	%eax
79	call	waiting
80	addl	$0x4, %esp
81
82	testl	%eax, %eax
83	jz	1b
84
85	movl	%esp, %esi
86
87	call	ret1
88	call	ret2
89	call	ret3
90	call	ret4
91	call	ret5
92	call	ret6
93
94	cmpl	%esp, %esi
95	jne	1f
96
97	ALTENTRY(done)
98	nop
99	SET_SIZE(done)
100
101	movl	$0, %eax
102	movl	%ebp, %esp
103	popl	%ebp
104	ret
105
1061:
107	movl	$1, %eax
108	movl	%ebp, %esp
109	popl	%ebp
110	ret
111	SET_SIZE(main)
112