xref: /titanic_50/usr/src/lib/libtnfctl/i386_assm.s (revision 24fe0b3bf671e123467ce1df0b67cadd3614c8e4)
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 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26/*
27 * The following c routine has appropriate interface semantics
28 * for the chaining combination template.  On the sparc architecture
29 * the assembly routine is further tuned to make it tail recursive.
30 *
31 * void
32 * prb_chain_entry(void *a, void *b, void *c)
33 * {
34 * 	prb_chain_down(a, b, c);
35 * 	prb_chain_next(a, b, c);
36 * }
37 */
38
39	.file	"i386_assm.s"
40	.data
41	.align	4
42	.globl	prb_callinfo
43prb_callinfo:
44	.4byte	1		/* offset */
45	.4byte	0		/* shift right */
46	.4byte	0xffffffff	/* mask */
47
48	.text
49	.align	4
50	.globl	prb_chain_entry
51	.globl	prb_chain_down
52	.local	chain_down
53	.globl	prb_chain_next
54	.local	chain_next
55	.globl	prb_chain_end
56prb_chain_entry:
57#if defined(__amd64)
58	/* XX64 -- fix me */
59#else
60	pushl	%ebp
61	movl	%esp, %ebp
62	pushl	%edi
63	pushl	%esi
64	pushl	%ebx
65	movl	16(%ebp), %ebx
66	pushl	%ebx
67	movl	12(%ebp), %edi
68	pushl	%edi
69	movl	8(%ebp), %esi
70	pushl	%esi
71#endif
72prb_chain_down:
73chain_down:
74#if defined(__amd64)
75	/* XX64 -- fix me */
76#else
77	call	chain_down
78	addl	$12, %esp
79	pushl	%ebx
80	pushl	%edi
81	pushl	%esi
82#endif
83prb_chain_next:
84chain_next:
85#if defined(__amd64)
86	/* XX64 -- fix me */
87#else
88	call	chain_next
89	addl	$12, %esp
90	popl	%ebx
91	popl	%esi
92	popl	%edi
93	leave
94#endif
95	ret
96prb_chain_end:
97	nop
98