summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-12-22 22:16:09 +0000
committerjhb <jhb@FreeBSD.org>2005-12-22 22:16:09 +0000
commitcb0d490ebe9e4d2fdb160451bfb076856c76f155 (patch)
tree5d9826b3ac47ed5cf683fc0866e2dc25566d6a56 /sys
parentfdec22285a69d07ca0d4320e306828b89e06a8dd (diff)
downloadFreeBSD-src-cb0d490ebe9e4d2fdb160451bfb076856c76f155.zip
FreeBSD-src-cb0d490ebe9e4d2fdb160451bfb076856c76f155.tar.gz
Tweak how the MD code calls the fooclock() methods some. Instead of
passing a pointer to an opaque clockframe structure and requiring the MD code to supply CLKF_FOO() macros to extract needed values out of the opaque structure, just pass the needed values directly. In practice this means passing the pair (usermode, pc) to hardclock() and profclock() and passing the boolean (usermode) to hardclock_cpu() and hardclock_process(). Other details: - Axe clockframe and CLKF_FOO() macros on all architectures. Basically, all the archs were taking a trapframe and converting it into a clockframe one way or another. Now they can just extract the PC and usermode values directly out of the trapframe and pass it to fooclock(). - Renamed hardclock_process() to hardclock_cpu() as the latter is more accurate. - On Alpha, we now run profclock() at hz (profhz == hz) rather than at the slower stathz. - On Alpha, for the TurboLaser machines that don't have an 8254 timecounter, call hardclock() directly. This removes an extra conditional check from every clock interrupt on Alpha on the BSP. There is probably room for even further pruning here by changing Alpha to use the simplified timecounter we use on x86 with the lapic timer since we don't get interrupts from the 8254 on Alpha anyway. - On x86, clkintr() shouldn't ever be called now unless using_lapic_timer is false, so add a KASSERT() to that affect and remove a condition to slightly optimize the non-lapic case. - Change prototypeof arm_handler_execute() so that it's first arg is a trapframe pointer rather than a void pointer for clarity. - Use KCOUNT macro in profclock() to lookup the kernel profiling bucket. Tested on: alpha, amd64, arm, i386, ia64, sparc64 Reviewed by: bde (mostly)
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/clock.c43
-rw-r--r--sys/alpha/alpha/interrupt.c28
-rw-r--r--sys/alpha/include/cpu.h11
-rw-r--r--sys/alpha/include/cpuconf.h2
-rw-r--r--sys/amd64/amd64/local_apic.c11
-rw-r--r--sys/amd64/amd64/mp_machdep.c2
-rw-r--r--sys/amd64/include/apicvar.h2
-rw-r--r--sys/amd64/include/clock.h1
-rw-r--r--sys/amd64/include/cpu.h4
-rw-r--r--sys/amd64/include/frame.h30
-rw-r--r--sys/amd64/include/smp.h2
-rw-r--r--sys/amd64/isa/clock.c13
-rw-r--r--sys/arm/arm/intr.c4
-rw-r--r--sys/arm/include/cpu.h3
-rw-r--r--sys/arm/include/frame.h22
-rw-r--r--sys/arm/sa11x0/sa11x0_ost.c10
-rw-r--r--sys/arm/xscale/i80321/i80321_timer.c6
-rw-r--r--sys/i386/i386/local_apic.c11
-rw-r--r--sys/i386/i386/mp_machdep.c2
-rw-r--r--sys/i386/include/apicvar.h2
-rw-r--r--sys/i386/include/clock.h1
-rw-r--r--sys/i386/include/cpu.h4
-rw-r--r--sys/i386/include/frame.h25
-rw-r--r--sys/i386/include/smp.h2
-rw-r--r--sys/i386/isa/clock.c13
-rw-r--r--sys/ia64/ia64/interrupt.c8
-rw-r--r--sys/ia64/include/cpu.h11
-rw-r--r--sys/isa/atrtc.c13
-rw-r--r--sys/kern/kern_clock.c37
-rw-r--r--sys/pc98/cbus/clock.c6
-rw-r--r--sys/pc98/cbus/pcrtc.c6
-rw-r--r--sys/powerpc/aim/clock.c6
-rw-r--r--sys/powerpc/aim/interrupt.c7
-rw-r--r--sys/powerpc/include/clock.h2
-rw-r--r--sys/powerpc/include/cpu.h5
-rw-r--r--sys/powerpc/include/frame.h7
-rw-r--r--sys/powerpc/powerpc/clock.c6
-rw-r--r--sys/powerpc/powerpc/interrupt.c7
-rw-r--r--sys/sparc64/include/cpu.h3
-rw-r--r--sys/sparc64/include/frame.h4
-rw-r--r--sys/sparc64/sparc64/tick.c20
-rw-r--r--sys/sys/systm.h9
42 files changed, 135 insertions, 276 deletions
diff --git a/sys/alpha/alpha/clock.c b/sys/alpha/alpha/clock.c
index 59acaba..df31423 100644
--- a/sys/alpha/alpha/clock.c
+++ b/sys/alpha/alpha/clock.c
@@ -157,7 +157,7 @@ static u_int64_t scaled_ticks_per_cycle;
static u_int32_t max_cycles_per_tick;
static u_int32_t last_time;
-static void handleclock(void* arg);
+static void handleclock(int usermode, uintfptr_t pc);
static void calibrate_clocks(u_int32_t firmware_freq, u_int32_t *pcc,
u_int32_t *timer);
static void set_timer_freq(u_int freq, int intr_freq);
@@ -230,8 +230,7 @@ out:
*/
/*
- * Start the real-time and statistics clocks. Leave stathz 0 since there
- * are no other timers available.
+ * Start the real-time and statistics clocks.
*/
void
cpu_initclocks()
@@ -275,7 +274,9 @@ cpu_initclocks()
*/
if (hwrpb->rpb_type != ST_DEC_21000) {
tc_init(&i8254_timecounter);
- }
+ platform.clockintr = handleclock;
+ } else
+ platform.clockintr = hardclock;
if (ncpus == 1) {
alpha_timecounter.tc_frequency = freq;
@@ -283,7 +284,7 @@ cpu_initclocks()
}
stathz = hz / 8;
- platform.clockintr = (void (*)(void *)) handleclock;
+ profhz = hz;
/*
* Get the clock started.
@@ -424,27 +425,23 @@ set_timer_freq(u_int freq, int intr_freq)
}
static void
-handleclock(void *arg)
+handleclock(int usermode, uintfptr_t pc)
{
- /*
- * XXX: TurboLaser doesn't have an i8254 counter.
- * XXX: A replacement is needed, and another method
- * XXX: of determining this would be nice.
- */
- if (hwrpb->rpb_type != ST_DEC_21000) {
- if (timecounter->tc_get_timecount == i8254_get_timecount) {
- mtx_lock_spin(&clock_lock);
- if (i8254_ticked)
- i8254_ticked = 0;
- else {
- i8254_offset += timer0_max_count;
- i8254_lastcount = 0;
- }
- clkintr_pending = 0;
- mtx_unlock_spin(&clock_lock);
+
+ KASSERT(hwrpb->rpb_type != ST_DEC_21000,
+ ("custom clock handler called on TurboLaser"));
+ if (timecounter->tc_get_timecount == i8254_get_timecount) {
+ mtx_lock_spin(&clock_lock);
+ if (i8254_ticked)
+ i8254_ticked = 0;
+ else {
+ i8254_offset += timer0_max_count;
+ i8254_lastcount = 0;
}
+ clkintr_pending = 0;
+ mtx_unlock_spin(&clock_lock);
}
- hardclock(arg);
+ hardclock(usermode, pc);
}
void
diff --git a/sys/alpha/alpha/interrupt.c b/sys/alpha/alpha/interrupt.c
index b4a7500..0f5ff82 100644
--- a/sys/alpha/alpha/interrupt.c
+++ b/sys/alpha/alpha/interrupt.c
@@ -489,23 +489,21 @@ alpha_clock_interrupt(struct trapframe *framep)
*/
if (PCPU_GET(cpuid) == 0) {
#endif
- (*platform.clockintr)(framep);
- /* divide hz (1024) by 8 to get stathz (128) */
- if ((++schedclk2 & 0x7) == 0) {
- if (profprocs != 0)
- profclock((struct clockframe *)framep);
- statclock((struct clockframe *)framep);
- }
+ (*platform.clockintr)(TRAPF_USERMODE(framep),
+ TRAPF_PC(framep));
+
+ /* Bump stathz divider. */
+ schedclk2++;
#ifdef SMP
- } else {
- hardclock_process((struct clockframe *)framep);
- if ((schedclk2 & 0x7) == 0) {
- if (profprocs != 0)
- profclock((struct clockframe *)framep);
- statclock((struct clockframe *)framep);
- }
- }
+ } else
+ hardclock_cpu(TRAPF_USERMODE(framep));
#endif
+ if (profprocs != 0)
+ profclock(TRAPF_USERMODE(framep), TRAPF_PC(framep));
+
+ /* divide hz (1024) by 8 to get stathz (128) */
+ if ((schedclk2 & 0x7) == 0)
+ statclock(TRAPF_USERMODE(framep));
critical_exit();
}
}
diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h
index 212ced0..a7a6a94 100644
--- a/sys/alpha/include/cpu.h
+++ b/sys/alpha/include/cpu.h
@@ -48,21 +48,10 @@
#include <machine/frame.h>
-/*
- * Arguments to hardclock and gatherstats encapsulate the previous
- * machine state in an opaque clockframe. One the Alpha, we use
- * what we push on an interrupt (a trapframe).
- */
-struct clockframe {
- struct trapframe cf_tf;
-};
#define TRAPF_USERMODE(framep) \
(((framep)->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0)
#define TRAPF_PC(framep) ((framep)->tf_regs[FRAME_PC])
-#define CLKF_USERMODE(framep) TRAPF_USERMODE(&(framep)->cf_tf)
-#define CLKF_PC(framep) TRAPF_PC(&(framep)->cf_tf)
-
/*
* CTL_MACHDEP definitions.
*/
diff --git a/sys/alpha/include/cpuconf.h b/sys/alpha/include/cpuconf.h
index 669ca6c..6f1ccc3 100644
--- a/sys/alpha/include/cpuconf.h
+++ b/sys/alpha/include/cpuconf.h
@@ -68,7 +68,7 @@ extern struct platform {
void (*cons_init)(void);
void (*device_register)(struct device *, void *);
void (*iointr)(void *, unsigned long);
- void (*clockintr)(void *);
+ void (*clockintr)(int, uintfptr_t);
void (*mcheck_handler)(unsigned long, struct trapframe *,
unsigned long, unsigned long);
void (*cpu_idle)(void);
diff --git a/sys/amd64/amd64/local_apic.c b/sys/amd64/amd64/local_apic.c
index e81ac65..a2409b6 100644
--- a/sys/amd64/amd64/local_apic.c
+++ b/sys/amd64/amd64/local_apic.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <vm/pmap.h>
#include <machine/apicreg.h>
+#include <machine/cpu.h>
#include <machine/cputypes.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
@@ -617,7 +618,7 @@ lapic_handle_intr(int vector, struct trapframe frame)
}
void
-lapic_handle_timer(struct clockframe frame)
+lapic_handle_timer(struct trapframe frame)
{
struct lapic *la;
@@ -634,16 +635,16 @@ lapic_handle_timer(struct clockframe frame)
if (la->la_hard_ticks >= lapic_timer_hz) {
la->la_hard_ticks -= lapic_timer_hz;
if (PCPU_GET(cpuid) == 0)
- hardclock(&frame);
+ hardclock(TRAPF_USERMODE(&frame), TRAPF_PC(&frame));
else
- hardclock_process(&frame);
+ hardclock_cpu(TRAPF_USERMODE(&frame));
}
/* Fire statclock at stathz. */
la->la_stat_ticks += stathz;
if (la->la_stat_ticks >= lapic_timer_hz) {
la->la_stat_ticks -= lapic_timer_hz;
- statclock(&frame);
+ statclock(TRAPF_USERMODE(&frame));
}
/* Fire profclock at profhz, but only when needed. */
@@ -651,7 +652,7 @@ lapic_handle_timer(struct clockframe frame)
if (la->la_prof_ticks >= lapic_timer_hz) {
la->la_prof_ticks -= lapic_timer_hz;
if (profprocs != 0)
- profclock(&frame);
+ profclock(TRAPF_USERMODE(&frame), TRAPF_PC(&frame));
}
critical_exit();
}
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index c042354..c05b05f 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -917,7 +917,7 @@ smp_masked_invlpg_range(u_int mask, vm_offset_t addr1, vm_offset_t addr2)
}
void
-ipi_bitmap_handler(struct clockframe frame)
+ipi_bitmap_handler(struct trapframe frame)
{
int cpu = PCPU_GET(cpuid);
u_int ipi_bitmap;
diff --git a/sys/amd64/include/apicvar.h b/sys/amd64/include/apicvar.h
index ff2dd26..7260309 100644
--- a/sys/amd64/include/apicvar.h
+++ b/sys/amd64/include/apicvar.h
@@ -202,7 +202,7 @@ void lapic_ipi_raw(register_t icrlo, u_int dest);
void lapic_ipi_vectored(u_int vector, int dest);
int lapic_ipi_wait(int delay);
void lapic_handle_intr(int vector, struct trapframe frame);
-void lapic_handle_timer(struct clockframe frame);
+void lapic_handle_timer(struct trapframe frame);
void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);
diff --git a/sys/amd64/include/clock.h b/sys/amd64/include/clock.h
index 3d0fa4a..a8a100f 100644
--- a/sys/amd64/include/clock.h
+++ b/sys/amd64/include/clock.h
@@ -29,7 +29,6 @@ extern int wall_cmos_clock;
/*
* Driver to clock driver interface.
*/
-struct clockframe;
int acquire_timer2(int mode);
int release_timer2(void);
diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h
index f069d2e..15d9e4c 100644
--- a/sys/amd64/include/cpu.h
+++ b/sys/amd64/include/cpu.h
@@ -59,10 +59,6 @@
(ISPL((framep)->tf_cs) == SEL_UPL)
#define TRAPF_PC(framep) ((framep)->tf_rip)
-#define CLKF_USERMODE(framep) \
- (ISPL((framep)->cf_cs) == SEL_UPL)
-#define CLKF_PC(framep) ((framep)->cf_rip)
-
/*
* CTL_MACHDEP definitions.
*/
diff --git a/sys/amd64/include/frame.h b/sys/amd64/include/frame.h
index 2bf9f3b..26c9dd0 100644
--- a/sys/amd64/include/frame.h
+++ b/sys/amd64/include/frame.h
@@ -76,34 +76,4 @@ struct trapframe {
register_t tf_ss;
};
-/* frame of clock (same as interrupt frame) */
-
-struct clockframe {
- register_t cf_rdi;
- register_t cf_rsi;
- register_t cf_rdx;
- register_t cf_rcx;
- register_t cf_r8;
- register_t cf_r9;
- register_t cf_rax;
- register_t cf_rbx;
- register_t cf_rbp;
- register_t cf_r10;
- register_t cf_r11;
- register_t cf_r12;
- register_t cf_r13;
- register_t cf_r14;
- register_t cf_r15;
- register_t :64; /* compat with trap frame - trapno */
- register_t :64; /* compat with trap frame - addr */
- register_t :64; /* compat with trap frame - flags */
- register_t :64; /* compat with trap frame - err */
- /* below portion defined in hardware */
- register_t cf_rip;
- register_t cf_cs;
- register_t cf_rflags;
- register_t cf_rsp;
- register_t cf_ss;
-};
-
#endif /* _MACHINE_FRAME_H_ */
diff --git a/sys/amd64/include/smp.h b/sys/amd64/include/smp.h
index 45870fe..94a7022 100644
--- a/sys/amd64/include/smp.h
+++ b/sys/amd64/include/smp.h
@@ -52,7 +52,7 @@ void ipi_selected(u_int cpus, u_int ipi);
void ipi_all(u_int ipi);
void ipi_all_but_self(u_int ipi);
void ipi_self(u_int ipi);
-void ipi_bitmap_handler(struct clockframe frame);
+void ipi_bitmap_handler(struct trapframe frame);
u_int mp_bootaddress(u_int);
int mp_grab_cpu_hlt(void);
void mp_topology(void);
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c
index 9918a66..28116dc 100644
--- a/sys/amd64/isa/clock.c
+++ b/sys/amd64/isa/clock.c
@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$");
#include <sys/power.h>
#include <machine/clock.h>
+#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
#include <machine/md_var.h>
@@ -141,7 +142,7 @@ static struct timecounter i8254_timecounter = {
};
static void
-clkintr(struct clockframe *frame)
+clkintr(struct trapframe *frame)
{
if (timecounter->tc_get_timecount == i8254_get_timecount) {
@@ -155,8 +156,8 @@ clkintr(struct clockframe *frame)
clkintr_pending = 0;
mtx_unlock_spin(&clock_lock);
}
- if (!using_lapic_timer)
- hardclock(frame);
+ KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer"));
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
int
@@ -212,17 +213,17 @@ release_timer2()
* in the statistics, but the stat clock will no longer stop.
*/
static void
-rtcintr(struct clockframe *frame)
+rtcintr(struct trapframe *frame)
{
while (rtcin(RTC_INTR) & RTCIR_PERIOD) {
if (profprocs != 0) {
if (--pscnt == 0)
pscnt = psdiv;
- profclock(frame);
+ profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
if (pscnt == psdiv)
- statclock(frame);
+ statclock(TRAPF_USERMODE(frame));
}
}
diff --git a/sys/arm/arm/intr.c b/sys/arm/arm/intr.c
index 5c9c581..13b7222 100644
--- a/sys/arm/arm/intr.c
+++ b/sys/arm/arm/intr.c
@@ -55,7 +55,7 @@ static int intrcnt_tab[NIRQ];
static int intrcnt_index = 0;
static int last_printed = 0;
-void arm_handler_execute(void *, int);
+void arm_handler_execute(struct trapframe *, int);
void
arm_setup_irqhandler(const char *name, void (*hand)(void*), void *arg,
@@ -99,7 +99,7 @@ dosoftints(void)
}
void
-arm_handler_execute(void *frame, int irqnb)
+arm_handler_execute(struct trapframe *frame, int irqnb)
{
struct intr_event *event;
struct intr_handler *ih;
diff --git a/sys/arm/include/cpu.h b/sys/arm/include/cpu.h
index dc9ce02..f672c6a 100644
--- a/sys/arm/include/cpu.h
+++ b/sys/arm/include/cpu.h
@@ -29,10 +29,7 @@ get_cyclecount(void)
#define CPU_MAXID 6 /* number of valid machdep ids */
-#define CLKF_USERMODE(frame) ((frame->if_spsr & PSR_MODE) == PSR_USR32_MODE)
-
#define TRAPF_USERMODE(frame) ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE)
-#define CLKF_PC(frame) (frame->if_pc)
#define TRAPF_PC(tfp) ((tfp)->tf_pc)
diff --git a/sys/arm/include/frame.h b/sys/arm/include/frame.h
index 4d70c20..0a03829 100644
--- a/sys/arm/include/frame.h
+++ b/sys/arm/include/frame.h
@@ -137,28 +137,6 @@ typedef struct irqframe {
unsigned int if_pc;
} irqframe_t;
-typedef struct clockframe {
- unsigned int if_spsr;
- unsigned int if_r0;
- unsigned int if_r1;
- unsigned int if_r2;
- unsigned int if_r3;
- unsigned int if_r4;
- unsigned int if_r5;
- unsigned int if_r6;
- unsigned int if_r7;
- unsigned int if_r8;
- unsigned int if_r9;
- unsigned int if_r10;
- unsigned int if_r11;
- unsigned int if_r12;
- unsigned int if_usr_sp;
- unsigned int if_usr_lr;
- unsigned int if_svc_sp;
- unsigned int if_svc_lr;
- unsigned int if_pc;
-} clockframe_t;
-
/*
* Switch frame
*/
diff --git a/sys/arm/sa11x0/sa11x0_ost.c b/sys/arm/sa11x0/sa11x0_ost.c
index 25241af..45c8f90 100644
--- a/sys/arm/sa11x0/sa11x0_ost.c
+++ b/sys/arm/sa11x0/sa11x0_ost.c
@@ -54,7 +54,9 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <machine/intr.h>
+#include <machine/cpu.h>
#include <machine/cpufunc.h>
+#include <machine/frame.h>
#include <machine/katelib.h>
@@ -144,7 +146,7 @@ static void
clockintr(arg)
void *arg;
{
- struct clockframe *frame = arg;
+ struct trapframe *frame = arg;
u_int32_t oscr, nextmatch, oldmatch;
int s;
@@ -179,7 +181,7 @@ clockintr(arg)
saost_sc->sc_clock_count = nextmatch;
bus_space_write_4(saost_sc->sc_iot, saost_sc->sc_ioh, SAOST_MR0,
nextmatch);
- hardclock(frame);
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
#if 0
mtx_unlock_spin(&clock_lock);
#endif
@@ -190,7 +192,7 @@ static void
statintr(arg)
void *arg;
{
- struct clockframe *frame = arg;
+ struct trapframe *frame = arg;
u_int32_t oscr, nextmatch, oldmatch;
int s;
@@ -225,7 +227,7 @@ statintr(arg)
}
saost_sc->sc_statclock_count = nextmatch;
- statclock(frame);
+ statclock(TRAPF_USERMODE(frame));
}
#endif
diff --git a/sys/arm/xscale/i80321/i80321_timer.c b/sys/arm/xscale/i80321/i80321_timer.c
index c309cc0..53a2878 100644
--- a/sys/arm/xscale/i80321/i80321_timer.c
+++ b/sys/arm/xscale/i80321/i80321_timer.c
@@ -53,7 +53,9 @@ __FBSDID("$FreeBSD$");
#include <sys/timetc.h>
#include <machine/bus.h>
+#include <machine/cpu.h>
#include <machine/cpufunc.h>
+#include <machine/frame.h>
#include <machine/resource.h>
#include <machine/intr.h>
#include <arm/xscale/i80321/i80321reg.h>
@@ -377,11 +379,11 @@ DELAY(int n)
void
clockhandler(void *arg)
{
- struct clockframe *frame = arg;
+ struct trapframe *frame = arg;
ticked++;
tisr_write(TISR_TMR0);
- hardclock(frame);
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
if (i80321_hardclock_hook != NULL)
(*i80321_hardclock_hook)();
diff --git a/sys/i386/i386/local_apic.c b/sys/i386/i386/local_apic.c
index f2d96b5..ddd7d32 100644
--- a/sys/i386/i386/local_apic.c
+++ b/sys/i386/i386/local_apic.c
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <vm/pmap.h>
#include <machine/apicreg.h>
+#include <machine/cpu.h>
#include <machine/cputypes.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
@@ -619,7 +620,7 @@ lapic_handle_intr(int vector, struct trapframe frame)
}
void
-lapic_handle_timer(struct clockframe frame)
+lapic_handle_timer(struct trapframe frame)
{
struct lapic *la;
@@ -636,16 +637,16 @@ lapic_handle_timer(struct clockframe frame)
if (la->la_hard_ticks >= lapic_timer_hz) {
la->la_hard_ticks -= lapic_timer_hz;
if (PCPU_GET(cpuid) == 0)
- hardclock(&frame);
+ hardclock(TRAPF_USERMODE(&frame), TRAPF_PC(&frame));
else
- hardclock_process(&frame);
+ hardclock_cpu(TRAPF_USERMODE(&frame));
}
/* Fire statclock at stathz. */
la->la_stat_ticks += stathz;
if (la->la_stat_ticks >= lapic_timer_hz) {
la->la_stat_ticks -= lapic_timer_hz;
- statclock(&frame);
+ statclock(TRAPF_USERMODE(&frame));
}
/* Fire profclock at profhz, but only when needed. */
@@ -653,7 +654,7 @@ lapic_handle_timer(struct clockframe frame)
if (la->la_prof_ticks >= lapic_timer_hz) {
la->la_prof_ticks -= lapic_timer_hz;
if (profprocs != 0)
- profclock(&frame);
+ profclock(TRAPF_USERMODE(&frame), TRAPF_PC(&frame));
}
critical_exit();
}
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index ab30a30..95928a1 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -1117,7 +1117,7 @@ smp_masked_invlpg_range(u_int mask, vm_offset_t addr1, vm_offset_t addr2)
}
void
-ipi_bitmap_handler(struct clockframe frame)
+ipi_bitmap_handler(struct trapframe frame)
{
int cpu = PCPU_GET(cpuid);
u_int ipi_bitmap;
diff --git a/sys/i386/include/apicvar.h b/sys/i386/include/apicvar.h
index 0c00b3c..8102567 100644
--- a/sys/i386/include/apicvar.h
+++ b/sys/i386/include/apicvar.h
@@ -201,7 +201,7 @@ void lapic_ipi_raw(register_t icrlo, u_int dest);
void lapic_ipi_vectored(u_int vector, int dest);
int lapic_ipi_wait(int delay);
void lapic_handle_intr(int vector, struct trapframe frame);
-void lapic_handle_timer(struct clockframe frame);
+void lapic_handle_timer(struct trapframe frame);
void lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
int lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
int lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);
diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h
index 8a14df3..bb6f5e5 100644
--- a/sys/i386/include/clock.h
+++ b/sys/i386/include/clock.h
@@ -29,7 +29,6 @@ extern int wall_cmos_clock;
/*
* Driver to clock driver interface.
*/
-struct clockframe;
int acquire_timer2(int mode);
int release_timer2(void);
diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h
index ec9ecd3..fec27e1 100644
--- a/sys/i386/include/cpu.h
+++ b/sys/i386/include/cpu.h
@@ -59,10 +59,6 @@
((ISPL((framep)->tf_cs) == SEL_UPL) || ((framep)->tf_eflags & PSL_VM))
#define TRAPF_PC(framep) ((framep)->tf_eip)
-#define CLKF_USERMODE(framep) \
- ((ISPL((framep)->cf_cs) == SEL_UPL) || ((framep)->cf_eflags & PSL_VM))
-#define CLKF_PC(framep) ((framep)->cf_eip)
-
/*
* CTL_MACHDEP definitions.
*/
diff --git a/sys/i386/include/frame.h b/sys/i386/include/frame.h
index 26c5c9e..3558b98 100644
--- a/sys/i386/include/frame.h
+++ b/sys/i386/include/frame.h
@@ -97,29 +97,4 @@ struct trapframe_vm86 {
int tf_vm86_gs;
};
-/* frame of clock (same as trap frame) */
-
-struct clockframe {
- int cf_fs;
- int cf_es;
- int cf_ds;
- int cf_edi;
- int cf_esi;
- int cf_ebp;
- int :32;
- int cf_ebx;
- int cf_edx;
- int cf_ecx;
- int cf_eax;
- int :32; /* for compat with trap frame - trapno */
- int :32; /* for compat with trap frame - err */
- /* below portion defined in 386 hardware */
- int cf_eip;
- int cf_cs;
- int cf_eflags;
- /* below only when crossing rings (e.g. user to kernel) */
- int cf_esp;
- int cf_ss;
-};
-
#endif /* _MACHINE_FRAME_H_ */
diff --git a/sys/i386/include/smp.h b/sys/i386/include/smp.h
index e197fb2..bd67a33 100644
--- a/sys/i386/include/smp.h
+++ b/sys/i386/include/smp.h
@@ -61,7 +61,7 @@ void ipi_selected(u_int cpus, u_int ipi);
void ipi_all(u_int ipi);
void ipi_all_but_self(u_int ipi);
void ipi_self(u_int ipi);
-void ipi_bitmap_handler(struct clockframe frame);
+void ipi_bitmap_handler(struct trapframe frame);
u_int mp_bootaddress(u_int);
int mp_grab_cpu_hlt(void);
void mp_topology(void);
diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c
index 7a75cfb..f785849 100644
--- a/sys/i386/isa/clock.c
+++ b/sys/i386/isa/clock.c
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
#include <sys/power.h>
#include <machine/clock.h>
+#include <machine/cpu.h>
#include <machine/cputypes.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
@@ -155,7 +156,7 @@ static struct timecounter i8254_timecounter = {
};
static void
-clkintr(struct clockframe *frame)
+clkintr(struct trapframe *frame)
{
if (timecounter->tc_get_timecount == i8254_get_timecount) {
@@ -169,8 +170,8 @@ clkintr(struct clockframe *frame)
clkintr_pending = 0;
mtx_unlock_spin(&clock_lock);
}
- if (!using_lapic_timer)
- hardclock(frame);
+ KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer"));
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
#ifdef DEV_MCA
/* Reset clock interrupt by asserting bit 7 of port 0x61 */
if (MCA_system)
@@ -231,17 +232,17 @@ release_timer2()
* in the statistics, but the stat clock will no longer stop.
*/
static void
-rtcintr(struct clockframe *frame)
+rtcintr(struct trapframe *frame)
{
while (rtcin(RTC_INTR) & RTCIR_PERIOD) {
if (profprocs != 0) {
if (--pscnt == 0)
pscnt = psdiv;
- profclock(frame);
+ profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
if (pscnt == psdiv)
- statclock(frame);
+ statclock(TRAPF_USERMODE(frame));
}
}
diff --git a/sys/ia64/ia64/interrupt.c b/sys/ia64/ia64/interrupt.c
index 1a0c3d1..dbd3d68 100644
--- a/sys/ia64/ia64/interrupt.c
+++ b/sys/ia64/ia64/interrupt.c
@@ -173,12 +173,12 @@ interrupt(u_int64_t vector, struct trapframe *tf)
while (delta >= ia64_clock_reload) {
/* Only the BSP runs the real clock */
if (PCPU_GET(cpuid) == 0)
- hardclock((struct clockframe *)tf);
+ hardclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
else
- hardclock_process((struct clockframe *)tf);
+ hardclock_cpu(TRAPF_USERMODE(tf));
if (profprocs != 0)
- profclock((struct clockframe *)tf);
- statclock((struct clockframe *)tf);
+ profclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
+ statclock(TRAPF_USERMODE(tf));
delta -= ia64_clock_reload;
clk += ia64_clock_reload;
if (adj != 0)
diff --git a/sys/ia64/include/cpu.h b/sys/ia64/include/cpu.h
index 424360a..982733d 100644
--- a/sys/ia64/include/cpu.h
+++ b/sys/ia64/include/cpu.h
@@ -44,17 +44,6 @@
#include <machine/frame.h>
-/*
- * Arguments to hardclock and gatherstats encapsulate the previous machine
- * state in an opaque clockframe.
- */
-struct clockframe {
- struct trapframe cf_tf;
-};
-#define CLKF_PC(cf) ((cf)->cf_tf.tf_special.iip)
-#define CLKF_CPL(cf) ((cf)->cf_tf.tf_special.psr & IA64_PSR_CPL)
-#define CLKF_USERMODE(cf) (CLKF_CPL(cf) != IA64_PSR_CPL_KERN)
-
#define TRAPF_PC(tf) ((tf)->tf_special.iip)
#define TRAPF_CPL(tf) ((tf)->tf_special.psr & IA64_PSR_CPL)
#define TRAPF_USERMODE(tf) (TRAPF_CPL(tf) != IA64_PSR_CPL_KERN)
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index 7a75cfb..f785849 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
#include <sys/power.h>
#include <machine/clock.h>
+#include <machine/cpu.h>
#include <machine/cputypes.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
@@ -155,7 +156,7 @@ static struct timecounter i8254_timecounter = {
};
static void
-clkintr(struct clockframe *frame)
+clkintr(struct trapframe *frame)
{
if (timecounter->tc_get_timecount == i8254_get_timecount) {
@@ -169,8 +170,8 @@ clkintr(struct clockframe *frame)
clkintr_pending = 0;
mtx_unlock_spin(&clock_lock);
}
- if (!using_lapic_timer)
- hardclock(frame);
+ KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer"));
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
#ifdef DEV_MCA
/* Reset clock interrupt by asserting bit 7 of port 0x61 */
if (MCA_system)
@@ -231,17 +232,17 @@ release_timer2()
* in the statistics, but the stat clock will no longer stop.
*/
static void
-rtcintr(struct clockframe *frame)
+rtcintr(struct trapframe *frame)
{
while (rtcin(RTC_INTR) & RTCIR_PERIOD) {
if (profprocs != 0) {
if (--pscnt == 0)
pscnt = psdiv;
- profclock(frame);
+ profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
if (pscnt == psdiv)
- statclock(frame);
+ statclock(TRAPF_USERMODE(frame));
}
}
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 4ffa978..33336b9 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -65,8 +65,6 @@ __FBSDID("$FreeBSD$");
#include <sys/limits.h>
#include <sys/timetc.h>
-#include <machine/cpu.h>
-
#ifdef GPROF
#include <sys/gmon.h>
#endif
@@ -189,12 +187,11 @@ initclocks(dummy)
/*
* Each time the real-time timer fires, this function is called on all CPUs.
- * Note that hardclock() calls hardclock_process() for the boot CPU, so only
+ * Note that hardclock() calls hardclock_cpu() for the boot CPU, so only
* the other CPUs in the system need to call this function.
*/
void
-hardclock_process(frame)
- register struct clockframe *frame;
+hardclock_cpu(int usermode)
{
struct pstats *pstats;
struct thread *td = curthread;
@@ -208,7 +205,7 @@ hardclock_process(frame)
/* XXXKSE What to do? */
} else {
pstats = p->p_stats;
- if (CLKF_USERMODE(frame) &&
+ if (usermode &&
timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value) &&
itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) {
p->p_sflag |= PS_ALRMPEND;
@@ -232,12 +229,11 @@ hardclock_process(frame)
* The real-time timer, interrupting hz times per second.
*/
void
-hardclock(frame)
- register struct clockframe *frame;
+hardclock(int usermode, uintfptr_t pc)
{
int need_softclock = 0;
- hardclock_process(frame);
+ hardclock_cpu(usermode);
tc_ticktock();
/*
@@ -246,8 +242,8 @@ hardclock(frame)
* XXX: this only works for UP
*/
if (stathz == 0) {
- profclock(frame);
- statclock(frame);
+ profclock(usermode, pc);
+ statclock(usermode);
}
#ifdef DEVICE_POLLING
@@ -401,8 +397,7 @@ stopprofclock(p)
* This should be called by all active processors.
*/
void
-statclock(frame)
- register struct clockframe *frame;
+statclock(int usermode)
{
struct rusage *ru;
struct vmspace *vm;
@@ -414,7 +409,7 @@ statclock(frame)
p = td->td_proc;
mtx_lock_spin_flags(&sched_lock, MTX_QUIET);
- if (CLKF_USERMODE(frame)) {
+ if (usermode) {
/*
* Charge the time as appropriate.
*/
@@ -473,8 +468,7 @@ statclock(frame)
}
void
-profclock(frame)
- register struct clockframe *frame;
+profclock(int usermode, uintfptr_t pc)
{
struct thread *td;
#ifdef GPROF
@@ -483,7 +477,7 @@ profclock(frame)
#endif
td = curthread;
- if (CLKF_USERMODE(frame)) {
+ if (usermode) {
/*
* Came from user mode; CPU was in user state.
* If this process is being profiled, record the tick.
@@ -491,7 +485,7 @@ profclock(frame)
* bother trying to count it.
*/
if (td->td_proc->p_flag & P_PROFIL)
- addupc_intr(td, CLKF_PC(frame), 1);
+ addupc_intr(td, pc, 1);
}
#ifdef GPROF
else {
@@ -499,11 +493,10 @@ profclock(frame)
* Kernel statistics are just like addupc_intr, only easier.
*/
g = &_gmonparam;
- if (g->state == GMON_PROF_ON && CLKF_PC(frame) >= g->lowpc) {
- i = PC_TO_I(g, CLKF_PC(frame));
+ if (g->state == GMON_PROF_ON && pc >= g->lowpc) {
+ i = PC_TO_I(g, pc);
if (i < g->textsize) {
- i /= HISTFRACTION * sizeof(*g->kcount);
- g->kcount[i]++;
+ KCOUNT(g, i)++;
}
}
}
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c
index 0260e7b..979a3a0 100644
--- a/sys/pc98/cbus/clock.c
+++ b/sys/pc98/cbus/clock.c
@@ -149,7 +149,7 @@ static struct timecounter i8254_timecounter = {
};
static void
-clkintr(struct clockframe *frame)
+clkintr(struct trapframe *frame)
{
if (timecounter->tc_get_timecount == i8254_get_timecount) {
@@ -163,8 +163,8 @@ clkintr(struct clockframe *frame)
clkintr_pending = 0;
mtx_unlock_spin(&clock_lock);
}
- if (!using_lapic_timer)
- hardclock(frame);
+ KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer"));
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
int
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 0260e7b..979a3a0 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -149,7 +149,7 @@ static struct timecounter i8254_timecounter = {
};
static void
-clkintr(struct clockframe *frame)
+clkintr(struct trapframe *frame)
{
if (timecounter->tc_get_timecount == i8254_get_timecount) {
@@ -163,8 +163,8 @@ clkintr(struct clockframe *frame)
clkintr_pending = 0;
mtx_unlock_spin(&clock_lock);
}
- if (!using_lapic_timer)
- hardclock(frame);
+ KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer"));
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
int
diff --git a/sys/powerpc/aim/clock.c b/sys/powerpc/aim/clock.c
index 8d738ec..3bff3dd 100644
--- a/sys/powerpc/aim/clock.c
+++ b/sys/powerpc/aim/clock.c
@@ -183,7 +183,7 @@ resettodr()
}
void
-decr_intr(struct clockframe *frame)
+decr_intr(struct trapframe *frame)
{
u_long tb;
long tick;
@@ -225,10 +225,10 @@ decr_intr(struct clockframe *frame)
*/
#if 0
while (--nticks > 0) {
- hardclock(frame);
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
#endif
- hardclock(frame);
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
void
diff --git a/sys/powerpc/aim/interrupt.c b/sys/powerpc/aim/interrupt.c
index 08a43b7..04a4506 100644
--- a/sys/powerpc/aim/interrupt.c
+++ b/sys/powerpc/aim/interrupt.c
@@ -72,7 +72,7 @@ ext_intr_install(void (*new_extint)(void))
powerpc_extintr_handler = new_extint;
}
-extern void decr_intr(struct clockframe *);
+extern void decr_intr(struct trapframe *);
extern void trap(struct trapframe *);
/*
@@ -84,7 +84,6 @@ void
powerpc_interrupt(struct trapframe *framep)
{
struct thread *td;
- struct clockframe ckframe;
td = curthread;
@@ -97,9 +96,7 @@ powerpc_interrupt(struct trapframe *framep)
case EXC_DECR:
atomic_add_int(&td->td_intr_nesting_level, 1);
- ckframe.srr0 = framep->srr0;
- ckframe.srr1 = framep->srr1;
- decr_intr(&ckframe);
+ decr_intr(framep);
atomic_subtract_int(&td->td_intr_nesting_level, 1);
break;
diff --git a/sys/powerpc/include/clock.h b/sys/powerpc/include/clock.h
index fb45259..a0918c9 100644
--- a/sys/powerpc/include/clock.h
+++ b/sys/powerpc/include/clock.h
@@ -19,7 +19,7 @@ int sysbeep(int pitch, int period);
int acquire_timer2(int mode);
int release_timer2(void);
-void decr_intr(struct clockframe *);
+void decr_intr(struct trapframe *);
#endif
diff --git a/sys/powerpc/include/cpu.h b/sys/powerpc/include/cpu.h
index 73a882b..913c910 100644
--- a/sys/powerpc/include/cpu.h
+++ b/sys/powerpc/include/cpu.h
@@ -39,11 +39,6 @@
#include <machine/pcb.h>
#include <machine/psl.h>
-#define CLKF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0)
-#define CLKF_BASEPRI(frame) ((frame)->pri == 0)
-#define CLKF_PC(frame) ((frame)->srr0)
-#define CLKF_INTR(frame) ((frame)->depth > 0)
-
#define TRAPF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0)
#define TRAPF_PC(frame) ((frame)->srr0)
diff --git a/sys/powerpc/include/frame.h b/sys/powerpc/include/frame.h
index 096ed67..09b7a95 100644
--- a/sys/powerpc/include/frame.h
+++ b/sys/powerpc/include/frame.h
@@ -65,13 +65,6 @@ struct trapframe {
#define FRAMELEN roundup(sizeof(struct trapframe) + 8, 16)
#define trapframe(td) ((td)->td_frame)
-struct clockframe {
- register_t srr1;
- register_t srr0;
- int pri;
- int depth;
-};
-
/*
* Call frame for PowerPC used during fork.
*/
diff --git a/sys/powerpc/powerpc/clock.c b/sys/powerpc/powerpc/clock.c
index 8d738ec..3bff3dd 100644
--- a/sys/powerpc/powerpc/clock.c
+++ b/sys/powerpc/powerpc/clock.c
@@ -183,7 +183,7 @@ resettodr()
}
void
-decr_intr(struct clockframe *frame)
+decr_intr(struct trapframe *frame)
{
u_long tb;
long tick;
@@ -225,10 +225,10 @@ decr_intr(struct clockframe *frame)
*/
#if 0
while (--nticks > 0) {
- hardclock(frame);
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
#endif
- hardclock(frame);
+ hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame));
}
void
diff --git a/sys/powerpc/powerpc/interrupt.c b/sys/powerpc/powerpc/interrupt.c
index 08a43b7..04a4506 100644
--- a/sys/powerpc/powerpc/interrupt.c
+++ b/sys/powerpc/powerpc/interrupt.c
@@ -72,7 +72,7 @@ ext_intr_install(void (*new_extint)(void))
powerpc_extintr_handler = new_extint;
}
-extern void decr_intr(struct clockframe *);
+extern void decr_intr(struct trapframe *);
extern void trap(struct trapframe *);
/*
@@ -84,7 +84,6 @@ void
powerpc_interrupt(struct trapframe *framep)
{
struct thread *td;
- struct clockframe ckframe;
td = curthread;
@@ -97,9 +96,7 @@ powerpc_interrupt(struct trapframe *framep)
case EXC_DECR:
atomic_add_int(&td->td_intr_nesting_level, 1);
- ckframe.srr0 = framep->srr0;
- ckframe.srr1 = framep->srr1;
- decr_intr(&ckframe);
+ decr_intr(framep);
atomic_subtract_int(&td->td_intr_nesting_level, 1);
break;
diff --git a/sys/sparc64/include/cpu.h b/sys/sparc64/include/cpu.h
index 4dfe1e9..f15078b 100644
--- a/sys/sparc64/include/cpu.h
+++ b/sys/sparc64/include/cpu.h
@@ -40,9 +40,6 @@
#include <machine/frame.h>
#include <machine/tstate.h>
-#define CLKF_USERMODE(cfp) TRAPF_USERMODE(&(cfp)->cf_tf)
-#define CLKF_PC(cfp) TRAPF_PC(&(cfp)->cf_tf)
-
#define TRAPF_PC(tfp) ((tfp)->tf_tpc)
#define TRAPF_USERMODE(tfp) (((tfp)->tf_tstate & TSTATE_PRIV) == 0)
diff --git a/sys/sparc64/include/frame.h b/sys/sparc64/include/frame.h
index 500a38f..a82d4aa 100644
--- a/sys/sparc64/include/frame.h
+++ b/sys/sparc64/include/frame.h
@@ -62,10 +62,6 @@ struct trapframe {
tf->tf_tnpc += 4; \
} while (0)
-struct clockframe {
- struct trapframe cf_tf;
-};
-
struct frame {
u_long fr_local[8];
u_long fr_in[8];
diff --git a/sys/sparc64/sparc64/tick.c b/sys/sparc64/sparc64/tick.c
index 64de96b..09ba1f1 100644
--- a/sys/sparc64/sparc64/tick.c
+++ b/sys/sparc64/sparc64/tick.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/timetc.h>
#include <machine/clock.h>
+#include <machine/cpu.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
#include <machine/tick.h>
@@ -62,7 +63,7 @@ static int adjust_ticks = 0;
SYSCTL_INT(_machdep_tick, OID_AUTO, adjust_ticks, CTLFLAG_RD, &adjust_ticks,
0, "total number of tick interrupts with adjustment");
-static void tick_hardclock(struct clockframe *);
+static void tick_hardclock(struct trapframe *);
void
cpu_initclocks(void)
@@ -73,20 +74,20 @@ cpu_initclocks(void)
}
static __inline void
-tick_process(struct clockframe *cf)
+tick_process(struct trapframe *tf)
{
if (PCPU_GET(cpuid) == 0)
- hardclock(cf);
+ hardclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
else
- hardclock_process(cf);
+ hardclock_cpu(TRAPF_USERMODE(tf));
if (profprocs != 0)
- profclock(cf);
- statclock(cf);
+ profclock(TRAPF_USERMODE(tf), TRAPF_PC(tf));
+ statclock(TRAPF_USERMODE(tf));
}
static void
-tick_hardclock(struct clockframe *cf)
+tick_hardclock(struct trapframe *tf)
{
u_long adj, s, tick, ref;
long delta;
@@ -108,7 +109,7 @@ tick_hardclock(struct clockframe *cf)
delta = tick - ref;
count = 0;
while (delta >= tick_increment) {
- tick_process(cf);
+ tick_process(tf);
delta -= tick_increment;
ref += tick_increment;
if (adj != 0)
@@ -163,8 +164,7 @@ tick_start(void)
u_long base, s;
if (PCPU_GET(cpuid) == 0)
- intr_setup(PIL_TICK, (ih_func_t *)tick_hardclock, -1, NULL,
- NULL);
+ intr_setup(PIL_TICK, tick_hardclock, -1, NULL, NULL);
/*
* Try to make the tick interrupts as synchronously as possible on
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index cbd95ee..400758c 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -112,7 +112,6 @@ extern char **kenvp;
* General function declarations.
*/
-struct clockframe;
struct malloc_type;
struct mtx;
struct proc;
@@ -207,11 +206,11 @@ intptr_t casuptr(intptr_t *p, intptr_t old, intptr_t new);
void realitexpire(void *);
-void hardclock(struct clockframe *frame);
-void hardclock_process(struct clockframe *frame);
+void hardclock(int usermode, uintfptr_t pc);
+void hardclock_cpu(int usermode);
void softclock(void *);
-void statclock(struct clockframe *frame);
-void profclock(struct clockframe *frame);
+void statclock(int usermode);
+void profclock(int usermode, uintfptr_t pc);
void startprofclock(struct proc *);
void stopprofclock(struct proc *);
OpenPOWER on IntegriCloud