xref: /titanic_50/usr/src/lib/libumem/i386/asm_subr.s (revision 174bc6499d233e329ecd3d98a880a7b07df16bfa)
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, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#include <sys/asm_linkage.h>
28
29#define	NOP4	\
30	nop;	\
31	nop;	\
32	nop;	\
33	nop;
34
35#define NOP16	\
36	NOP4	\
37	NOP4	\
38	NOP4	\
39	NOP4
40
41#define	NOP64	\
42	NOP16	\
43	NOP16	\
44	NOP16	\
45	NOP16
46
47#define	NOP256	\
48	NOP64	\
49	NOP64	\
50	NOP64	\
51	NOP64
52
53#if defined(lint)
54
55void *
56getfp(void)
57{
58	return (NULL);
59}
60
61#ifndef UMEM_STANDALONE
62void
63_breakpoint(void)
64{
65	return;
66}
67#endif
68
69#else	/* lint */
70
71#if defined(__amd64)
72
73	ENTRY(getfp)
74	movq	%rbp, %rax
75	ret
76	SET_SIZE(getfp)
77
78#else	/* __i386 */
79
80	ENTRY(getfp)
81	movl	%ebp, %eax
82	ret
83	SET_SIZE(getfp)
84
85#endif
86
87#ifndef UMEM_STANDALONE
88	ENTRY(_breakpoint)
89	int	$3
90	ret
91	SET_SIZE(_breakpoint)
92#endif
93
94	ENTRY(_malloc)
95	jmp umem_malloc;
96	NOP256
97	NOP256
98#if defined(__amd64)
99	NOP64
100#endif
101	SET_SIZE(_malloc)
102
103	ENTRY(_free)
104	jmp umem_malloc_free;
105	NOP256
106	NOP256
107#if defined(__amd64)
108	NOP64
109#endif
110	SET_SIZE(_free)
111
112	ANSI_PRAGMA_WEAK2(malloc,_malloc,function)
113	ANSI_PRAGMA_WEAK2(free,_free,function)
114
115#endif	/* lint */
116