Subject: Re: VI in dumb mode?
To: Chris G. Demetriou <cgd@alpha.bostic.com>
From: Ralph Campbell <ralphc@pyramid.com>
List: current-users
Date: 08/31/1994 13:05:11
> From owner-current-users@NetBSD.ORG Tue Aug 30 18:06:55 1994
> Message-Id: <199408301722.KAA15541@cygnus.com>
> To: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
> Cc: current-users@sun-lamp.cs.berkeley.edu
> Subject: Re: Profiling Weirdness Solved. 
> In-Reply-To: Your message of "Mon, 29 Aug 1994 21:07:12 EDT."
>              <199408300107.VAA01821@Collatz.McRCIM.McGill.EDU> 
> Date: Tue, 30 Aug 1994 10:20:22 -0700
> From: "J.T. Conklin" <jtc@cygnus.com>
> Sender: owner-current-users@NetBSD.ORG
> Precedence: bulk
> 
> > > I don't understand the "movl $1b,%eax" that I removed, or the .long 0
> > > in the data segement.  %eax is likely to be clobbered by mcount(),
> > > and the .long 0 doesn't look like it is ever referenced.
> > 
> > The "movl $1b,%eax" moves the address of local label 1b - ie, the
> > address of that .long 0 that was mystifying you - into %eax.
> > Presumably mcount uses this address for something.  (Many UNIX-derived
> > assemblers use $ to indicate an immediate operand, what many other
> > assemblers use # for.  Confusing, but that's history for you. 
> 
> Thanks,
> 
> I read the $1b has an immediate operand, and didn't realize it refered
> to the address of label 1.  
> 
> However, I am still confused by the fact that the %eax is not used by
> mcount(), and `gcc -pg' generated code emits .long 0's, but doesn't
> reference them at all.  
> 
> It's probably just an anachronism.  Probably gcc should be changed to
> stop emitting the .long 0's; and the ENTRY() macro in <machine/asm.h>
> should be changed to omit the .long 0 and the movl $1b,%eax.
> 
> 	--jtc
> 

I am guessing the address of the .long is the result of more history.
This was used by the *prof* command (remember cc -p before there was cc -pg?).
The compier produced code to support both most likely.

      -m-------  Ralph Campbell				ralphc@pyramid.com
    ---mmm-----  Pyramid Technology Corporation		Tel: (408) 428-8639
  -----mmmmm---  3860 North First Street		Fax: (408) 428-8845
-------mmmmmmm-  San Jose, CA 95134

------------------------------------------------------------------------------