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 .section ".ptctext", "ax" 94 .globl _malloc 95 .type _malloc, @function 96 .align ASM_ENTRY_ALIGN 97_malloc: 98 jmp umem_malloc; 99 NOP256 100 NOP256 101#if defined(__amd64) 102 NOP64 103#endif 104 SET_SIZE(_malloc) 105 106 .section ".ptctext","ax" 107 .globl _free 108 .type _free, @function 109 .align ASM_ENTRY_ALIGN 110_free: 111 jmp umem_malloc_free; 112 NOP256 113 NOP256 114#if defined(__amd64) 115 NOP64 116#endif 117 SET_SIZE(_free) 118 119 ANSI_PRAGMA_WEAK2(malloc,_malloc,function) 120 ANSI_PRAGMA_WEAK2(free,_free,function) 121 122#endif /* lint */ 123