summaryrefslogtreecommitdiffstats
path: root/sys/i386
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/i386
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/i386')
-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
8 files changed, 16 insertions, 44 deletions
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));
}
}
OpenPOWER on IntegriCloud