[go: up one dir, main page]

File: fentry.S

package info (click to toggle)
uftrace 0.18.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,356 kB
  • sloc: ansic: 49,770; python: 11,181; asm: 837; makefile: 769; sh: 637; cpp: 627; javascript: 191
file content (50 lines) | stat: -rw-r--r-- 846 bytes parent folder | download | duplicates (4)
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
45
46
47
48
49
50
#include "utils/asm.h"

GLOBAL(__fentry__)
	sub $32, %esp
	movl %edx, 28(%esp)
	movl %ecx, 24(%esp)
	movl %eax, 20(%esp)
	movl $0, 16(%esp)
	/* parent location */
	leal 36(%esp), %eax
	movl %eax, 0(%esp)
	/* child addr */
	movl 32(%esp), %eax
	movl %eax, 4(%esp)
	/* mcount_args */
	leal 16(%esp), %eax
	movl %eax, 8(%esp)
	call mcount_entry
	cmpl $0, %eax
	jne 1f

	/* hijack return address */
	call get_pc_thunk
	addl $_GLOBAL_OFFSET_TABLE_, %eax
	addl $fentry_return@GOTOFF, %eax
	movl %eax, 36(%esp)
1:
	movl 20(%esp), %eax
	movl 24(%esp), %ecx
	movl 28(%esp), %edx
	add $32, %esp
	ret
END(__fentry__)


ENTRY(fentry_return)
	sub  $16, %esp
	movl %edx, 8(%esp)
	movl %eax, 4(%esp)
	leal 4(%esp), %eax
	movl %eax, 0(%esp)

	call mcount_exit
	movl %eax, 12(%esp)

	movl 4(%esp), %eax
	movl 8(%esp), %edx
	add  $12, %esp
	ret
END(fentry_return)