kern/83445: [PATCH] ndis won't compile with kernel profiling enabled

Bruce Evans bde at zeta.org.au
Thu Jul 14 13:51:11 GMT 2005


>> Description:
> With kernel profiling enabled (-p[p] in CONFIGARGS) I'm
> not able to properly compile ndis(4). Build process
> stops on:
> (src/sys/compat/ndis/winx32_wrap.S):
> [..]
> 	ret	$0xFF
> [..]

I think it would work with plain profiling (-p), but with high
resolution profiling (-pp), it would neither compile nor work,
since "ret" is a macro in that case in order to make it work.

> After changing this instructions to their proper op-code:
> 	.byte	0xC2
> 	.byte	0xFF
> 	.byte	0x00
> everything seems to be just fine (ndis compiles). Since
> this change needs to be made in order to satisfy compiler,
> I belive it doesn't touch typical behaviour.

This would make high resolution profiling compile but not work.
There must be a call to mexitcount just before the return.
The ENTRY() macro hides the corresponding complications for
entry to functions and the ret macro handles most cases for
exit.

Large amounts of assembler code are likely to have other bugs
in mcounting.  The templates are especially difficult to handle
correctly -- gprof won't be able to find the addresses in code
constructed at runtime, so the runtime-only addresses should
somehow be mapped to compile-time addresses.

This is mostly moot for ndis since binary-only modules can't
support profiling.

Bruce


More information about the freebsd-bugs mailing list