Subject: Re: Profiling Weirdness Solved.
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 08/29/1994 21:07:12
> The enclosed change to asm.h [...].

> 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.

[diff, edited down]
> *** 67,69 ****
>   # define _BEGIN_ENTRY	.data; 1:; .long 0; .text; .align 2
> ! # define _END_ENTRY	movl $1b,%eax; call PIC_PLT(mcount)
>   #else
> --- 67,69 ----
>   # define _BEGIN_ENTRY	.data; 1:; .long 0; .text; .align 2
> ! # define _END_ENTRY	pushl %ebp; movl %esp,%ebp; call PIC_PLT(mcount); popl %ebp
>   #else

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.  The
resulting code, because it contains an address in an immediate operand,
is not PIC, but presumably that doesn't matter.  If the '386 has an
instruction that, like the VAX MOVAB/MOVAW/MOVAL, moves the address of
a datum that can be referred to with a pc-relative addressing mode, one
could perhaps argue that it'd be better to use it.)

So that long in the data segment _is_ referenced, and I hope this
clears up the mystery instruction for you.

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu

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