1
+ /* Copyright (C) 2024 DJ Delorie, see COPYING.DJ for details */
1
2
/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
2
3
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
3
4
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
@@ -38,7 +39,7 @@ typedef struct MTAB {
38
39
39
40
static header h ;
40
41
static short * histogram ;
41
- static int mcount_skip = 1 ;
42
+ static volatile unsigned char mcount_skip = 1 ;
42
43
static int histlen ;
43
44
static MTAB * mtab = 0 ;
44
45
@@ -48,35 +49,24 @@ extern int etext __asm__("etext");
48
49
49
50
static int profiling_p ;
50
51
51
- /* called by functions . Use the pointer it provides to cache
52
+ /* called by mcount . Use the pointer it provides to cache
52
53
** the last used MTABE, so that repeated calls to/from the same
53
54
** pair works quickly - no lookup.
54
55
*/
55
- void mcount ( int _to );
56
- void mcount ( int _to )
56
+ void __mcount_internal ( unsigned long from , unsigned long to , MTABE * * cache );
57
+ void __mcount_internal ( unsigned long from , unsigned long to , MTABE * * cache )
57
58
{
58
59
MTAB * m ;
59
60
int i ;
60
- unsigned int to ;
61
- int ebp ;
62
- unsigned int from ;
63
61
int mtabi ;
64
- MTABE * * cache ;
65
-
66
- /* obtain the cached pointer */
67
- __asm__ __volatile__ ("movl %%edx,%0" : "=g" (cache ));
68
62
69
63
mcount_skip = 1 ;
70
64
/* Do nothing if profiling is disabled. */
71
65
if (!profiling_p )
72
66
return ;
73
67
74
- if (& _to < & etext )
75
- * (int * )(-1 ) = 0 ; /* fault! */
68
+ to -= 12 ;
76
69
77
- to = * ((& _to )- 1 ) - 12 ;
78
- ebp = * ((& _to )- 2 ); /* glean the caller's return address from the stack */
79
- from = ((int * )ebp )[1 ];
80
70
/* Do nothing if the FROM address is outside the sampling range. */
81
71
if (from < h .low || from >= h .high )
82
72
return ;
0 commit comments