arch/sparc/lib/mcount.S

Source file repositories/reference/linux-study-clean/arch/sparc/lib/mcount.S

File Facts

System
Linux kernel
Corpus path
arch/sparc/lib/mcount.S
Extension
.S
Size
2635 bytes
Lines
127
Domain
Architecture Layer
Bucket
arch/sparc
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <linux/export.h>
#include <linux/linkage.h>

/*
 * This is the main variant and is called by C code.  GCC's -pg option
 * automatically instruments every C function with a call to this.
 */

	.text
	.align		32
	.globl		_mcount
	.type		_mcount,#function
	EXPORT_SYMBOL(_mcount)
	.globl		mcount
	.type		mcount,#function
_mcount:
mcount:
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
	/* Do nothing, the retl/nop below is all we need.  */
#else
	sethi		%hi(ftrace_trace_function), %g1
	sethi		%hi(ftrace_stub), %g2
	ldx		[%g1 + %lo(ftrace_trace_function)], %g1
	or		%g2, %lo(ftrace_stub), %g2
	cmp		%g1, %g2
	be,pn		%icc, 1f
	 mov		%i7, %g3
	save		%sp, -176, %sp
	mov		%g3, %o1
	jmpl		%g1, %o7
	 mov		%i7, %o0
	ret
	 restore
	/* not reached */
1:
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
	sethi		%hi(ftrace_graph_return), %g1
	ldx		[%g1 + %lo(ftrace_graph_return)], %g3
	cmp		%g2, %g3
	bne,pn		%xcc, 5f
	 sethi		%hi(ftrace_graph_entry_stub), %g2
	sethi		%hi(ftrace_graph_entry), %g1
	or		%g2, %lo(ftrace_graph_entry_stub), %g2
	ldx		[%g1 + %lo(ftrace_graph_entry)], %g1
	cmp		%g1, %g2
	be,pt		%xcc, 2f
	 nop
5:	mov		%i7, %g2
	mov		%fp, %g3
	save		%sp, -176, %sp
	mov		%g2, %l0
	ba,pt		%xcc, ftrace_graph_caller
	 mov		%g3, %l1
#endif
2:
#endif
#endif
	retl
	 nop
	.size		_mcount,.-_mcount
	.size		mcount,.-mcount

#ifdef CONFIG_FUNCTION_TRACER
	.globl		ftrace_stub
	.type		ftrace_stub,#function
ftrace_stub:
	retl
	 nop
	.size		ftrace_stub,.-ftrace_stub

Annotation

Implementation Notes