diff options
author | bde <bde@FreeBSD.org> | 1998-07-14 05:09:48 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-07-14 05:09:48 +0000 |
commit | 55ddae5a80992ccb5383ea0c6f2f7055694716b7 (patch) | |
tree | 7658bd93d378ee99a6ee447cba3e12c7e55ab765 | |
parent | 95415c676d9622fd2a2dda4dea047790c204c1eb (diff) | |
download | FreeBSD-src-55ddae5a80992ccb5383ea0c6f2f7055694716b7.zip FreeBSD-src-55ddae5a80992ccb5383ea0c6f2f7055694716b7.tar.gz |
Changed to the C9x draft spelling of the (unsigned) integral type
suitable for holding object pointers (ptrint_t -> uintptr_t).
Added corresponding signed type (intptr_t). Changed/added
corresponding non-C9x types for function pointers to match. Don't
use nonstandard types to implement these types, and don't comment
on them in <machine/types.h>.
-rw-r--r-- | lib/libc/gmon/mcount.c | 24 | ||||
-rw-r--r-- | sys/alpha/include/types.h | 14 | ||||
-rw-r--r-- | sys/amd64/include/profile.h | 17 | ||||
-rw-r--r-- | sys/i386/include/profile.h | 17 | ||||
-rw-r--r-- | sys/i386/include/types.h | 14 | ||||
-rw-r--r-- | sys/kern/kern_module.c | 5 | ||||
-rw-r--r-- | sys/kern/subr_prof.c | 8 | ||||
-rw-r--r-- | sys/libkern/mcount.c | 24 | ||||
-rw-r--r-- | sys/sys/gmon.h | 6 |
9 files changed, 61 insertions, 68 deletions
diff --git a/lib/libc/gmon/mcount.c b/lib/libc/gmon/mcount.c index 74aaf7d..4514b98f 100644 --- a/lib/libc/gmon/mcount.c +++ b/lib/libc/gmon/mcount.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id: mcount.c,v 1.11 1998/07/10 02:27:16 bde Exp $"; + "$Id: mcount.c,v 1.12 1998/07/10 09:26:40 bde Exp $"; #endif #ifndef __NETBSD_SYSCALLS @@ -70,7 +70,7 @@ void user __P((void)); * perform this optimization. */ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ - register fptrint_t frompc, selfpc; + register uintfptr_t frompc, selfpc; { #ifdef GUPROF u_int delta; @@ -108,9 +108,9 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ */ if (frompci >= p->textsize) { if (frompci + p->lowpc - >= (fptrint_t)(VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE)) + >= (uintfptr_t)(VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE)) goto done; - frompci = (fptrint_t)user - p->lowpc; + frompci = (uintfptr_t)user - p->lowpc; if (frompci >= p->textsize) goto done; } @@ -172,12 +172,12 @@ skip_guprof_stuff: * exceptions appear in the call graph as calls from btrap() and * bintr() instead of calls from all over. */ - if ((fptrint_t)selfpc >= (fptrint_t)btrap - && (fptrint_t)selfpc < (fptrint_t)eintr) { - if ((fptrint_t)selfpc >= (fptrint_t)bintr) - frompci = (fptrint_t)bintr - p->lowpc; + if ((uintfptr_t)selfpc >= (uintfptr_t)btrap + && (uintfptr_t)selfpc < (uintfptr_t)eintr) { + if ((uintfptr_t)selfpc >= (uintfptr_t)bintr) + frompci = (uintfptr_t)bintr - p->lowpc; else - frompci = (fptrint_t)btrap - p->lowpc; + frompci = (uintfptr_t)btrap - p->lowpc; } #endif /* KERNEL */ @@ -284,13 +284,13 @@ MCOUNT #ifdef GUPROF void mexitcount(selfpc) - fptrint_t selfpc; + uintfptr_t selfpc; { struct gmonparam *p; - fptrint_t selfpcdiff; + uintfptr_t selfpcdiff; p = &_gmonparam; - selfpcdiff = selfpc - (fptrint_t)p->lowpc; + selfpcdiff = selfpc - (uintfptr_t)p->lowpc; if (selfpcdiff < p->textsize) { u_int delta; diff --git a/sys/alpha/include/types.h b/sys/alpha/include/types.h index d9cb455..1bf185c 100644 --- a/sys/alpha/include/types.h +++ b/sys/alpha/include/types.h @@ -1,4 +1,4 @@ -/* $Id: types.h,v 1.6 1998/07/10 02:27:13 bde Exp $ */ +/* $Id: types.h,v 1.7 1998/07/10 02:34:50 bde Exp $ */ /* From: NetBSD: types.h,v 1.8 1997/04/06 08:47:45 cgd Exp */ /*- @@ -75,13 +75,11 @@ typedef int64_t register_t; typedef int32_t ufs_daddr_t; #ifdef KERNEL -/* An unsigned integral type that can hold object pointers. */ -typedef u_int64_t ptrint_t; - -/* An unsigned integral type that can hold function pointers. */ -typedef u_int64_t fptrint_t; - -typedef u_int64_t uoff_t; /* unsigned file offset */ +typedef long intfptr_t; +typedef unsigned long uintfptr_t; +typedef long intptr_t; +typedef unsigned long uintptr_t; +typedef unsigned long uoff_t; #endif /* Interrupt mask (spl, xxx_imask, etc) */ diff --git a/sys/amd64/include/profile.h b/sys/amd64/include/profile.h index 23595b2..02c43ca 100644 --- a/sys/amd64/include/profile.h +++ b/sys/amd64/include/profile.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)profile.h 8.1 (Berkeley) 6/11/93 - * $Id: profile.h,v 1.15 1998/07/10 02:27:15 bde Exp $ + * $Id: profile.h,v 1.16 1998/07/10 09:26:41 bde Exp $ */ #ifndef _MACHINE_PROFILE_H_ @@ -60,7 +60,7 @@ #define MCOUNT_DECL(s) #define MCOUNT_ENTER(s) #define MCOUNT_EXIT(s) -#define PC_TO_I(p, pc) ((fptrint_t)(pc) - (fptrint_t)(p)->lowpc) +#define PC_TO_I(p, pc) ((uintfptr_t)(pc) - (uintfptr_t)(p)->lowpc) #else #define MCOUNT_DECL(s) u_long s; #ifdef SMP @@ -84,7 +84,7 @@ void \ mcount() \ { \ - fptrint_t selfpc, frompc; \ + uintfptr_t selfpc, frompc; \ /* \ * Find the return address for mcount, \ * and the return address for mcount's caller. \ @@ -99,12 +99,11 @@ mcount() \ * caller's frame following the caller's caller's frame pointer. \ */ \ asm("movl (%%ebp),%0" : "=r" (frompc)); \ - frompc = ((fptrint_t *)frompc)[1]; \ + frompc = ((uintfptr_t *)frompc)[1]; \ _mcount(frompc, selfpc); \ } -/* An unsigned integral type that can hold function pointers. */ -typedef u_int32_t fptrint_t; +typedef unsigned int uintfptr_t; #endif /* KERNEL */ @@ -116,7 +115,7 @@ typedef u_int fptrdiff_t; #ifdef KERNEL -void mcount __P((fptrint_t frompc, fptrint_t selfpc)); +void mcount __P((uintfptr_t frompc, uintfptr_t selfpc)); #ifdef GUPROF struct gmonparam; @@ -138,7 +137,7 @@ __BEGIN_DECLS #ifdef __GNUC__ void mcount __P((void)) __asm("mcount"); #endif -static void _mcount __P((fptrint_t frompc, fptrint_t selfpc)); +static void _mcount __P((uintfptr_t frompc, uintfptr_t selfpc)); __END_DECLS #endif /* KERNEL */ @@ -150,7 +149,7 @@ extern int cputime_bias; __BEGIN_DECLS int cputime __P((void)); void empty_loop __P((void)); -void mexitcount __P((fptrint_t selfpc)); +void mexitcount __P((uintfptr_t selfpc)); void nullfunc __P((void)); void nullfunc_loop __P((void)); __END_DECLS diff --git a/sys/i386/include/profile.h b/sys/i386/include/profile.h index 23595b2..02c43ca 100644 --- a/sys/i386/include/profile.h +++ b/sys/i386/include/profile.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)profile.h 8.1 (Berkeley) 6/11/93 - * $Id: profile.h,v 1.15 1998/07/10 02:27:15 bde Exp $ + * $Id: profile.h,v 1.16 1998/07/10 09:26:41 bde Exp $ */ #ifndef _MACHINE_PROFILE_H_ @@ -60,7 +60,7 @@ #define MCOUNT_DECL(s) #define MCOUNT_ENTER(s) #define MCOUNT_EXIT(s) -#define PC_TO_I(p, pc) ((fptrint_t)(pc) - (fptrint_t)(p)->lowpc) +#define PC_TO_I(p, pc) ((uintfptr_t)(pc) - (uintfptr_t)(p)->lowpc) #else #define MCOUNT_DECL(s) u_long s; #ifdef SMP @@ -84,7 +84,7 @@ void \ mcount() \ { \ - fptrint_t selfpc, frompc; \ + uintfptr_t selfpc, frompc; \ /* \ * Find the return address for mcount, \ * and the return address for mcount's caller. \ @@ -99,12 +99,11 @@ mcount() \ * caller's frame following the caller's caller's frame pointer. \ */ \ asm("movl (%%ebp),%0" : "=r" (frompc)); \ - frompc = ((fptrint_t *)frompc)[1]; \ + frompc = ((uintfptr_t *)frompc)[1]; \ _mcount(frompc, selfpc); \ } -/* An unsigned integral type that can hold function pointers. */ -typedef u_int32_t fptrint_t; +typedef unsigned int uintfptr_t; #endif /* KERNEL */ @@ -116,7 +115,7 @@ typedef u_int fptrdiff_t; #ifdef KERNEL -void mcount __P((fptrint_t frompc, fptrint_t selfpc)); +void mcount __P((uintfptr_t frompc, uintfptr_t selfpc)); #ifdef GUPROF struct gmonparam; @@ -138,7 +137,7 @@ __BEGIN_DECLS #ifdef __GNUC__ void mcount __P((void)) __asm("mcount"); #endif -static void _mcount __P((fptrint_t frompc, fptrint_t selfpc)); +static void _mcount __P((uintfptr_t frompc, uintfptr_t selfpc)); __END_DECLS #endif /* KERNEL */ @@ -150,7 +149,7 @@ extern int cputime_bias; __BEGIN_DECLS int cputime __P((void)); void empty_loop __P((void)); -void mexitcount __P((fptrint_t selfpc)); +void mexitcount __P((uintfptr_t selfpc)); void nullfunc __P((void)); void nullfunc_loop __P((void)); __END_DECLS diff --git a/sys/i386/include/types.h b/sys/i386/include/types.h index 45be306..fa4d88f 100644 --- a/sys/i386/include/types.h +++ b/sys/i386/include/types.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)types.h 8.3 (Berkeley) 1/5/94 - * $Id: types.h,v 1.13 1998/06/18 15:32:05 bde Exp $ + * $Id: types.h,v 1.14 1998/07/10 02:27:15 bde Exp $ */ #ifndef _MACHINE_TYPES_H_ @@ -70,13 +70,11 @@ typedef int32_t register_t; typedef int32_t ufs_daddr_t; #ifdef KERNEL -/* An unsigned integral type that can hold object pointers. */ -typedef u_int32_t ptrint_t; - -/* An unsigned integral type that can hold function pointers. */ -typedef u_int32_t fptrint_t; - -typedef __uint64_t uoff_t; /* unsigned file offset */ +typedef int intfptr_t; +typedef unsigned int uintfptr_t; +typedef int intptr_t; +typedef unsigned int uintptr_t; +typedef __uint64_t uoff_t; #endif /* Interrupt mask (spl, xxx_imask, etc) */ diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index 0a752bb..948fa79 100644 --- a/sys/kern/kern_module.c +++ b/sys/kern/kern_module.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_module.c,v 1.6 1997/11/07 08:52:56 phk Exp $ + * $Id: kern_module.c,v 1.7 1998/07/11 07:45:40 bde Exp $ */ #include <sys/param.h> @@ -81,10 +81,9 @@ module_register_init(void *arg) moduledata_t* data = (moduledata_t*) arg; int error; -#define fptrint_t unsigned /* XXX */ if (error = module_register(data->name, data->evhand, data->priv)) printf("module_register_init: module_register(%s, %lx, %p) returned %d", - data->name, (u_long)(fptrint_t)data->evhand, data->priv, error); + data->name, (u_long)(uintfptr_t)data->evhand, data->priv, error); } int diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c index 80fda30..467b748 100644 --- a/sys/kern/subr_prof.c +++ b/sys/kern/subr_prof.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)subr_prof.c 8.3 (Berkeley) 9/23/93 - * $Id: subr_prof.c,v 1.25 1998/04/15 17:46:23 bde Exp $ + * $Id: subr_prof.c,v 1.26 1998/05/01 16:40:20 bde Exp $ */ #include <sys/param.h> @@ -87,7 +87,7 @@ kmstartup(dummy) int mexitcount_overhead; int nullfunc_loop_overhead; int nullfunc_loop_profiled_time; - fptrint_t tmp_addr; + uintfptr_t tmp_addr; #endif /* @@ -188,8 +188,8 @@ kmstartup(dummy) enable_intr(); nullfunc_loop_profiled_time = 0; - for (tmp_addr = (fptrint_t)nullfunc_loop_profiled; - tmp_addr < (fptrint_t)nullfunc_loop_profiled_end; + for (tmp_addr = (uintfptr_t)nullfunc_loop_profiled; + tmp_addr < (uintfptr_t)nullfunc_loop_profiled_end; tmp_addr += HISTFRACTION * sizeof(HISTCOUNTER)) nullfunc_loop_profiled_time += KCOUNT(p, PC_TO_I(p, tmp_addr)); #define CALIB_DOSCALE(count) (((count) + CALIB_SCALE / 3) / CALIB_SCALE) diff --git a/sys/libkern/mcount.c b/sys/libkern/mcount.c index 233fe3c..6199729 100644 --- a/sys/libkern/mcount.c +++ b/sys/libkern/mcount.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: mcount.c,v 1.12 1997/02/22 09:39:55 peter Exp $"; #endif #include <sys/param.h> @@ -70,7 +70,7 @@ void user __P((void)); * perform this optimization. */ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ - register fptrint_t frompc, selfpc; + register uintfptr_t frompc, selfpc; { #ifdef GUPROF int delta; @@ -108,9 +108,9 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ */ if (frompci >= p->textsize) { if (frompci + p->lowpc - >= (fptrint_t)(VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE)) + >= (uintfptr_t)(VM_MAXUSER_ADDRESS + UPAGES * PAGE_SIZE)) goto done; - frompci = (fptrint_t)user - p->lowpc; + frompci = (uintfptr_t)user - p->lowpc; if (frompci >= p->textsize) goto done; } @@ -155,12 +155,12 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ * exceptions appear in the call graph as calls from btrap() and * bintr() instead of calls from all over. */ - if ((fptrint_t)selfpc >= (fptrint_t)btrap - && (fptrint_t)selfpc < (fptrint_t)eintr) { - if ((fptrint_t)selfpc >= (fptrint_t)bintr) - frompci = (fptrint_t)bintr - p->lowpc; + if ((uintfptr_t)selfpc >= (uintfptr_t)btrap + && (uintfptr_t)selfpc < (uintfptr_t)eintr) { + if ((uintfptr_t)selfpc >= (uintfptr_t)bintr) + frompci = (uintfptr_t)bintr - p->lowpc; else - frompci = (fptrint_t)btrap - p->lowpc; + frompci = (uintfptr_t)btrap - p->lowpc; } #endif /* KERNEL */ @@ -267,13 +267,13 @@ MCOUNT #ifdef GUPROF void mexitcount(selfpc) - fptrint_t selfpc; + uintfptr_t selfpc; { struct gmonparam *p; - fptrint_t selfpcdiff; + uintfptr_t selfpcdiff; p = &_gmonparam; - selfpcdiff = selfpc - (fptrint_t)p->lowpc; + selfpcdiff = selfpc - (uintfptr_t)p->lowpc; if (selfpcdiff < p->textsize) { int delta; diff --git a/sys/sys/gmon.h b/sys/sys/gmon.h index 474926e..9107c93 100644 --- a/sys/sys/gmon.h +++ b/sys/sys/gmon.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)gmon.h 8.2 (Berkeley) 1/4/94 - * $Id: gmon.h,v 1.12 1997/02/22 09:45:17 peter Exp $ + * $Id: gmon.h,v 1.13 1997/07/13 16:38:31 bde Exp $ */ #ifndef _SYS_GMON_H_ @@ -165,8 +165,8 @@ struct gmonparam { struct tostruct *tos; u_long tossize; long tolimit; - fptrint_t lowpc; - fptrint_t highpc; + uintfptr_t lowpc; + uintfptr_t highpc; u_long textsize; u_long hashfraction; int profrate; /* XXX wrong type to match gmonhdr */ |