⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcount.s,v

📁 用TCP/IP进行网际互连这本书得源代码,偶得,希望大家喜欢.推荐下载
💻 S,V
字号:
head	1.1;access;symbols;locks	dls:1.1; strict;comment	@# @;1.1date	97.09.21.19.27.40;	author dls;	state Dist;branches;next	;desc@@1.1log@pre-3e code@text@|Count subroutine calls during profiling|The basic idea here is a call of the form:||	movl	#LABEL,a0|	jsr	mcount|	.data|LABEL:	.long	0|	.text||which is generated automatically by the C compiler for each subroutine call.|The first time mcount is called, the contents of LABEL will be 0 so mcount|will allocate two words from its buffer like:||struct|{|	char *fncptr;		/* ptr to subroutine */|	long fnccnt;		/* number of calls to this function */|};||and fill int fncptr from the return pc, fill in LABEL with a ptr to|the newly allocated structure and bump the count.  On subsequent calls,|the contents of LABEL will be used to just bump the count..globl	mcount.comm	cntbase,2mcount:	movl	a0@@,d0		| fetch contents of LABEL	jne	1$		| something there	movl	cntbase,a1	| ptr to next available cnt structure	addl	#8,cntbase	| bump cntbase to followng structure	movl	sp@@,a1@@+	| save ptr to function	movl	a1,a0@@		| save ptr to cnt in structure in LABEL	jra	2$1$:	movl	d0,a1		| so we can use it as a ptr2$:	addql	#1,a1@@		| bump the function count	rts@

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -