From 751cd4ffb01a8ce813248325e758c41e0034b253 Mon Sep 17 00:00:00 2001 From: castor Date: Mon, 12 Jun 2000 23:42:10 +0000 Subject: [PATCH] Profiling fixes from Ethan Solomita . Merge Kernel MCOUNT and user MCOUNT. The earlier code which was inserted to call _mcount in profiling assembler routines is busted badly. This gets it working with PIC code and should work with any arbitrary assembler routine. --- sys/arch/mips/include/asm.h | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/sys/arch/mips/include/asm.h b/sys/arch/mips/include/asm.h index 86ae9968c85e..8b39e608fd3f 100644 --- a/sys/arch/mips/include/asm.h +++ b/sys/arch/mips/include/asm.h @@ -1,4 +1,4 @@ -/* $NetBSD: asm.h,v 1.22 1999/04/24 08:10:33 simonb Exp $ */ +/* $NetBSD: asm.h,v 1.23 2000/06/12 23:42:10 castor Exp $ */ /* * Copyright (c) 1992, 1993 @@ -62,21 +62,26 @@ /* * Define -pg profile entry code. - * XXX assume .set noreorder for kernel, .set reorder for user code. + * Must always be noreorder, must never use a macro instruction + * Final addiu to t9 must always equal the size of this _KERN_MCOUNT */ -#define _KERN_MCOUNT \ - .set noat; \ - move $1,$31; \ - jal _mcount; \ - subu sp,sp,8; \ - .set at +#define _KERN_MCOUNT \ + .set push; \ + .set noreorder; \ + .set noat; \ + sw t9,-4(sp); \ + move AT,ra; \ + lui t9,%hi(_mcount); \ + addiu t9,t9,%lo(_mcount); \ + jalr t9; \ + subu sp,sp,16; \ + lw t9,4(sp); \ + addiu sp,sp,8; \ + addiu t9,t9,36; \ + .set pop; #ifdef GPROF -# if defined(_KERNEL) || defined(_LOCORE) -# define MCOUNT _KERN_MCOUNT -# else -# define MCOUNT .set noreorder; _KERN_MCOUNT ; .set reorder; -# endif +#define MCOUNT _KERN_MCOUNT #else #define MCOUNT #endif