diff options
| author | Alexander Motin <mav@FreeBSD.org> | 2009-05-02 12:20:43 +0000 |
|---|---|---|
| committer | Alexander Motin <mav@FreeBSD.org> | 2009-05-02 12:20:43 +0000 |
| commit | 6a3a164d6e1a5b3c59daefd59ac885cd467c3caf (patch) | |
| tree | f18d346c3109119beca341888aa2edfe43eac759 /sys/amd64/isa | |
| parent | 36cf744872cc6b9eb3391ad09ac69f0e7e3dfa53 (diff) | |
Notes
Diffstat (limited to 'sys/amd64/isa')
| -rw-r--r-- | sys/amd64/isa/clock.c | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index 4d365c9e0ca63..b5260257a4da3 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/module.h> #include <sys/sched.h> +#include <sys/smp.h> #include <sys/sysctl.h> #include <machine/clock.h> @@ -62,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include <machine/apicvar.h> #include <machine/ppireg.h> #include <machine/timerreg.h> +#include <machine/smp.h> #include <isa/rtc.h> #ifdef DEV_ISA @@ -112,6 +114,35 @@ static struct timecounter i8254_timecounter = { 0 /* quality */ }; +int +hardclockintr(struct trapframe *frame) +{ + + if (PCPU_GET(cpuid) == 0) + hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + else + hardclock_cpu(TRAPF_USERMODE(frame)); + return (FILTER_HANDLED); +} + +int +statclockintr(struct trapframe *frame) +{ + + if (profprocs != 0) + profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + statclock(TRAPF_USERMODE(frame)); + return (FILTER_HANDLED); +} + +int +profclockintr(struct trapframe *frame) +{ + + profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + return (FILTER_HANDLED); +} + static int clkintr(struct trapframe *frame) { @@ -128,7 +159,14 @@ clkintr(struct trapframe *frame) mtx_unlock_spin(&clock_lock); } KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer")); - hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); +#ifdef SMP + if (smp_started) + ipi_all_but_self(IPI_HARDCLOCK); +#endif + if (PCPU_GET(cpuid) == 0) + hardclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + else + hardclock_cpu(TRAPF_USERMODE(frame)); return (FILTER_HANDLED); } @@ -209,10 +247,19 @@ rtcintr(struct trapframe *frame) if (profprocs != 0) { if (--pscnt == 0) pscnt = psdiv; +#ifdef SMP + if (pscnt != psdiv && smp_started) + ipi_all_but_self(IPI_PROFCLOCK); +#endif profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); } - if (pscnt == psdiv) + if (pscnt == psdiv) { +#ifdef SMP + if (smp_started) + ipi_all_but_self(IPI_STATCLOCK); +#endif statclock(TRAPF_USERMODE(frame)); + } } return(flag ? FILTER_HANDLED : FILTER_STRAY); } |
