This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: mips64 profiling support
- From: Andreas Jaeger <aj at suse dot de>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Sat, 15 Mar 2003 07:26:11 +0100
- Subject: Re: mips64 profiling support
- References: <orn0jy6jgm.fsf@free.redhat.lsd.ic.unicamp.br>
Alexandre Oliva <aoliva at redhat dot com> writes:
> /* Call __mcount with our the return PC for our caller,
> and the return PC our caller will return to. */
While you're at it, please correct the above comment - and also the
copy of it that you did. The sentence does not make sense.
> #ifdef __PIC__
> -#define CPLOAD ".cpload $25;"
> -#define CPRESTORE ".cprestore 44\n\t"
> +# define CPLOAD ".cpload $25;"
> +# define CPRESTORE ".cprestore 44\n\t"
> #else
> -#define CPLOAD
> -#define CPRESTORE
> +# define CPLOAD
> +# define CPRESTORE
> #endif
>
> #define MCOUNT asm(\
> @@ -66,3 +69,72 @@ static void __attribute_used__ __mcount
> ".set reorder;\n\t" \
> ".set at\n\t" \
> ".end _mcount");
> +
> +#else
> +
> +/* Call __mcount with our the return PC for our caller,
> + and the return PC our caller will return to. */
> +#ifdef __PIC__
> +# define CPSETUP ".cpsetup $25, 88, _mcount;"
> +# define CPRETURN ".cpreturn;"
> +#else
> +# define CPSETUP
> +# define CPRETURN
> +#endif
> +
> +#if defined _ABIN32 && _MIPS_SIM == _ABIN32
> +# define PTR_ADDU_STRING "add" /* no u */
> +# define PTR_SUBU_STRING "sub" /* no u */
> +#elif defined _ABI64 && _MIPS_SIM == _ABI64
> +# define PTR_ADDU_STRING "daddu"
> +# define PTR_SUBU_STRING "dsubu"
> +#else
> +# error "Unknown ABI"
> +#endif
> +
> +#define MCOUNT asm(\
> + ".globl _mcount;\n\t" \
> + ".align 3;\n\t" \
> + ".type _mcount,@function;\n\t" \
> + ".ent _mcount\n\t" \
> + "_mcount:\n\t" \
> + ".frame $sp,88,$31\n\t" \
> + ".set noreorder;\n\t" \
> + ".set noat;\n\t" \
> + PTR_SUBU_STRING " $29,$29,96;\n\t" \
> + CPSETUP \
> + "sd $4,24($29);\n\t" \
> + "sd $5,32($29);\n\t" \
> + "sd $6,40($29);\n\t" \
> + "sd $7,48($29);\n\t" \
> + "sd $8,56($29);\n\t" \
> + "sd $9,64($29);\n\t" \
> + "sd $10,72($29);\n\t" \
> + "sd $11,80($29);\n\t" \
> + "sd $2,16($29);\n\t" \
> + "sd $1,0($29);\n\t" \
> + "sd $31,8($29);\n\t" \
> + "move $5,$31;\n\t" \
> + "move $4,$1;\n\t" \
> + "jal __mcount;\n\t" \
> + "nop;\n\t" \
> + "ld $4,24($29);\n\t" \
> + "ld $5,32($29);\n\t" \
> + "ld $6,40($29);\n\t" \
> + "ld $7,48($29);\n\t" \
> + "ld $8,56($29);\n\t" \
> + "ld $9,64($29);\n\t" \
> + "ld $10,72($29);\n\t" \
> + "ld $11,80($29);\n\t" \
> + "ld $2,16($29);\n\t" \
> + "ld $31,8($29);\n\t" \
> + "ld $1,0($29);\n\t" \
> + CPRETURN \
> + PTR_ADDU_STRING " $29,$29,96;\n\t" \
> + "j $31;\n\t" \
> + "move $31,$1;\n\t" \
> + ".set reorder;\n\t" \
> + ".set at\n\t" \
> + ".end _mcount");
> +
> +#endif
Ok,
Andreas
--
Andreas Jaeger
SuSE Labs aj at suse dot de
private aj at arthur dot inka dot de
http://www.suse.de/~aj