summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/i386/mcount.S
blob: 11feed5e0751fff65c6886f5f981a92ff69e9bf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
   Copyright (C) 2001, 2002 Thomas M. Ogrisegg

   This is free software. You can redistribute and
   modify it under the terms of the GNU General Public
   Public License.

   mcount.S
     i386 assembler implementation of mcount
*/

/* .section ".profile" */
.text
.globl mcount
.type  mcount,@function
mcount:
/*
   save all generic registers which
   might be used by __mcount, but aren't
   automatically saved
 */
	pushl %eax
	pushl %ecx
	pushl %edx

/*  push the instruction pointer of the calling function */
	pushl 0xc(%esp)

/*  push the instruction pointer of the
    function that called the calling function */
	pushl 0x4(%ebp)

	call __mcount

/*  clean up stack */
	addl $0x8, %esp

/*  restore the previously saved registers */
	popl %edx
	popl %ecx
	popl %eax
	ret

.size mcount,.-mcount