]> git.saurik.com Git - apple/libc.git/blame - gen.subproj/i386.subproj/mcount.s
Libc-186.tar.gz
[apple/libc.git] / gen.subproj / i386.subproj / mcount.s
CommitLineData
e9ce8d39
A
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22#import <architecture/i386/asm_help.h>
23
24.text
25 .globl mcount
26mcount:
27 pushl %ebp // setup mcount's frame
28 movl %esp,%ebp
29
30 movl (%ebp),%eax // load the frame pointer of mcount's caller
31 movl 4(%eax),%eax // load mcount's caller's return address
32 pushl 4(%ebp) // push the selfpc parameter for moncount()
33 pushl %eax // push the frompc parameter for moncount()
34 CALL_EXTERN(_moncount) // call moncount()
35
36 movl %ebp,%esp // tear down mcount's frame
37 popl %ebp
38 ret