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