From 9f1eb3e30fdc3e61b3aa36d192e99de25563269a Mon Sep 17 00:00:00 2001 From: cube Date: Thu, 11 Aug 2005 20:32:55 +0000 Subject: [PATCH] Change all archs that did: #define clockframe somethingelse to: struct clockframe { struct somethingelse cf_se; }; and change access macros accordingly. That means that, at least for that very issue, things will not go ka-boomy if you don't have the actual definition of struct clockframe before including systm.h. --- sys/arch/acorn26/include/frame.h | 6 ++++-- sys/arch/amd64/include/cpu.h | 10 ++++++---- sys/arch/arm/include/arm32/frame.h | 6 ++++-- sys/arch/arm/include/cpu.h | 12 ++++++------ sys/arch/i386/include/cpu.h | 10 ++++++---- sys/arch/pc532/include/cpu.h | 12 +++++++----- sys/arch/xen/include/cpu.h | 10 ++++++---- sys/arch/xen/xen/clock.c | 6 +++--- 8 files changed, 42 insertions(+), 30 deletions(-) diff --git a/sys/arch/acorn26/include/frame.h b/sys/arch/acorn26/include/frame.h index a7f7184580a9..9fd05d5c0a33 100644 --- a/sys/arch/acorn26/include/frame.h +++ b/sys/arch/acorn26/include/frame.h @@ -1,4 +1,4 @@ -/* $NetBSD: frame.h,v 1.1 2002/03/24 15:46:58 bjh21 Exp $ */ +/* $NetBSD: frame.h,v 1.2 2005/08/11 20:32:55 cube Exp $ */ /* * Copyright (c) 1999 Ben Harris. @@ -78,7 +78,9 @@ typedef struct irqframe { register_t if_r15; /* Must be fixed so we know which branch to use */ } irqframe_t; -#define clockframe irqframe +struct clockframe { + struct irqframe cf_if; +}; /* * Switch frame diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 5f66a3bb0890..b31d59b83b46 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.6 2004/09/25 11:08:47 yamt Exp $ */ +/* $NetBSD: cpu.h,v 1.7 2005/08/11 20:32:55 cube Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -203,11 +203,13 @@ extern u_int32_t cpus_attached; * encapsulate the previous machine state in an opaque * clockframe; for now, use generic intrframe. */ -#define clockframe intrframe +struct clockframe { + struct intrframe cf_if; +}; -#define CLKF_USERMODE(frame) USERMODE((frame)->if_cs, (frame)->if_rflags) +#define CLKF_USERMODE(frame) USERMODE((frame)->cf_if.if_cs, (frame)->cf_if.if_rflags) #define CLKF_BASEPRI(frame) (0) -#define CLKF_PC(frame) ((frame)->if_rip) +#define CLKF_PC(frame) ((frame)->cf_if.if_rip) #define CLKF_INTR(frame) (curcpu()->ci_idepth > 1) /* diff --git a/sys/arch/arm/include/arm32/frame.h b/sys/arch/arm/include/arm32/frame.h index 89b15b68dd5f..019790c9ff7b 100644 --- a/sys/arch/arm/include/arm32/frame.h +++ b/sys/arch/arm/include/arm32/frame.h @@ -1,4 +1,4 @@ -/* $NetBSD: frame.h,v 1.11 2004/04/27 07:13:16 scw Exp $ */ +/* $NetBSD: frame.h,v 1.12 2005/08/11 20:32:55 cube Exp $ */ /* * Copyright (c) 1994-1997 Mark Brinicombe. @@ -76,7 +76,9 @@ typedef struct irqframe { unsigned int if_pc; } irqframe_t; -#define clockframe irqframe +struct clockframe { + struct irqframe cf_if; +}; /* * Switch frame diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h index 880bd3c39b05..d3233453bb03 100644 --- a/sys/arch/arm/include/cpu.h +++ b/sys/arch/arm/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.36 2004/09/22 11:32:02 yamt Exp $ */ +/* $NetBSD: cpu.h,v 1.37 2005/08/11 20:32:55 cube Exp $ */ /* * Copyright (c) 1994-1996 Mark Brinicombe. @@ -127,9 +127,9 @@ extern int cpu_do_powersave; * frame came from USR mode or not. */ #ifdef __PROG32 -#define CLKF_USERMODE(frame) ((frame->if_spsr & PSR_MODE) == PSR_USR32_MODE) +#define CLKF_USERMODE(frame) ((frame->cf_if.if_spsr & PSR_MODE) == PSR_USR32_MODE) #else -#define CLKF_USERMODE(frame) ((frame->if_r15 & R15_MODE) == R15_MODE_USR) +#define CLKF_USERMODE(frame) ((frame->cf_if.if_r15 & R15_MODE) == R15_MODE_USR) #endif /* @@ -150,7 +150,7 @@ extern int current_intr_depth; /* Hack to treat FPE time as interrupt time so we can measure it */ #define CLKF_INTR(frame) \ ((current_intr_depth > 1) || \ - (frame->if_spsr & PSR_MODE) == PSR_UND32_MODE) + (frame->cf_if.if_spsr & PSR_MODE) == PSR_UND32_MODE) #else #define CLKF_INTR(frame) (current_intr_depth > 1) #endif @@ -159,9 +159,9 @@ extern int current_intr_depth; * CLKF_PC: Extract the program counter from a clockframe */ #ifdef __PROG32 -#define CLKF_PC(frame) (frame->if_pc) +#define CLKF_PC(frame) (frame->cf_if.if_pc) #else -#define CLKF_PC(frame) (frame->if_r15 & R15_PC) +#define CLKF_PC(frame) (frame->cf_if.if_r15 & R15_PC) #endif /* diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 32a171bef976..d5fd9147c44c 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.117 2005/02/21 15:10:51 he Exp $ */ +/* $NetBSD: cpu.h,v 1.118 2005/08/11 20:32:55 cube Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -263,11 +263,13 @@ extern u_int32_t cpus_attached; * running (hardclock) interrupt, CLKF_BASEPRI() *must* always be 0; otherwise * we could stall hardclock ticks if another interrupt takes too long. */ -#define clockframe intrframe +struct clockframe { + struct intrframe cf_if; +}; -#define CLKF_USERMODE(frame) USERMODE((frame)->if_cs, (frame)->if_eflags) +#define CLKF_USERMODE(frame) USERMODE((frame)->cf_if.if_cs, (frame)->cf_if.if_eflags) #define CLKF_BASEPRI(frame) (0) -#define CLKF_PC(frame) ((frame)->if_eip) +#define CLKF_PC(frame) ((frame)->cf_if.if_eip) #define CLKF_INTR(frame) (curcpu()->ci_idepth > 1) /* diff --git a/sys/arch/pc532/include/cpu.h b/sys/arch/pc532/include/cpu.h index 8172859d43f4..95856536c348 100644 --- a/sys/arch/pc532/include/cpu.h +++ b/sys/arch/pc532/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.42 2004/09/22 11:32:03 yamt Exp $ */ +/* $NetBSD: cpu.h,v 1.43 2005/08/11 20:32:55 cube Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -74,11 +74,13 @@ extern struct cpu_info cpu_info_store; * clockframe; for now, use generic intrframe. */ -#define clockframe intrframe +struct clockframe { + struct intrframe cf_if; +}; -#define CLKF_USERMODE(framep) USERMODE((framep)->if_regs.r_psr) -#define CLKF_BASEPRI(framep) ((framep)->if_pl == imask[IPL_ZERO]) -#define CLKF_PC(framep) ((framep)->if_regs.r_pc) +#define CLKF_USERMODE(framep) USERMODE((framep)->cf_if.if_regs.r_psr) +#define CLKF_BASEPRI(framep) ((framep)->cf_if.if_pl == imask[IPL_ZERO]) +#define CLKF_PC(framep) ((framep)->cf_if.if_regs.r_pc) #define CLKF_INTR(frame) (0) /* XXX should have an interrupt stack */ /* diff --git a/sys/arch/xen/include/cpu.h b/sys/arch/xen/include/cpu.h index 4afb4a402897..a07a9032fc73 100644 --- a/sys/arch/xen/include/cpu.h +++ b/sys/arch/xen/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.8 2005/04/16 22:49:37 bouyer Exp $ */ +/* $NetBSD: cpu.h,v 1.9 2005/08/11 20:32:55 cube Exp $ */ /* NetBSD: cpu.h,v 1.113 2004/02/20 17:35:01 yamt Exp */ /*- @@ -264,11 +264,13 @@ extern u_int32_t cpus_attached; * running (hardclock) interrupt, CLKF_BASEPRI() *must* always be 0; otherwise * we could stall hardclock ticks if another interrupt takes too long. */ -#define clockframe intrframe +struct clockframe { + struct intrframe cf_if; +}; -#define CLKF_USERMODE(frame) USERMODE((frame)->if_cs, (frame)->if_eflags) +#define CLKF_USERMODE(frame) USERMODE((frame)->cf_if.if_cs, (frame)->cf_if.if_eflags) #define CLKF_BASEPRI(frame) (0) -#define CLKF_PC(frame) ((frame)->if_eip) +#define CLKF_PC(frame) ((frame)->cf_if.if_eip) #define CLKF_INTR(frame) (curcpu()->ci_idepth > 1) /* diff --git a/sys/arch/xen/xen/clock.c b/sys/arch/xen/xen/clock.c index 885bf3d78d02..1fdae362e944 100644 --- a/sys/arch/xen/xen/clock.c +++ b/sys/arch/xen/xen/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.13 2005/06/25 18:44:59 bouyer Exp $ */ +/* $NetBSD: clock.c,v 1.14 2005/08/11 20:32:56 cube Exp $ */ /* * @@ -34,7 +34,7 @@ #include "opt_xen.h" #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.13 2005/06/25 18:44:59 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.14 2005/08/11 20:32:56 cube Exp $"); #include #include @@ -271,7 +271,7 @@ xen_timer_handler(void *arg, struct intrframe *regs) cc_microset(ci); } } - hardclock(regs); + hardclock((struct clockframe *)regs); delta -= NS_PER_TICK; processed_system_time += NS_PER_TICK; }