--- //depot/vendor/freebsd/src/sys/alpha/alpha/clock.c 2005/12/14 21:45:23 +++ //depot/user/jhb/acpipci/alpha/alpha/clock.c 2005/12/14 21:49:43 @@ -157,7 +157,7 @@ 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); @@ -275,7 +275,9 @@ */ 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 +285,6 @@ } stathz = hz / 8; - platform.clockintr = (void (*)(void *)) handleclock; /* * Get the clock started. @@ -424,27 +425,23 @@ } 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 --- //depot/vendor/freebsd/src/sys/alpha/alpha/interrupt.c 2005/10/25 19:50:36 +++ //depot/user/jhb/acpipci/alpha/alpha/interrupt.c 2005/12/09 18:38:37 @@ -489,23 +489,22 @@ */ 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)); + 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 + + /* XXX: Shouldn't we run profhz at hz rather than stathz here? */ + /* divide hz (1024) by 8 to get stathz (128) */ + if ((schedclk2 & 0x7) == 0) { + if (profprocs != 0) + profclock(TRAPF_USERMODE(framep), + TRAPF_PC(framep)); + statclock(TRAPF_USERMODE(framep)); } -#endif critical_exit(); } } --- //depot/vendor/freebsd/src/sys/alpha/include/cpu.h 2005/01/05 20:11:19 +++ //depot/user/jhb/acpipci/alpha/include/cpu.h 2005/12/09 18:38:37 @@ -48,21 +48,10 @@ #include -/* - * 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. */ --- //depot/vendor/freebsd/src/sys/alpha/include/cpuconf.h 2005/01/31 23:10:40 +++ //depot/user/jhb/acpipci/alpha/include/cpuconf.h 2005/12/09 18:38:37 @@ -68,7 +68,7 @@ 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); --- //depot/vendor/freebsd/src/sys/amd64/amd64/local_apic.c 2005/12/13 18:30:20 +++ //depot/user/jhb/acpipci/amd64/amd64/local_apic.c 2005/12/14 21:21:48 @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -617,7 +618,7 @@ } void -lapic_handle_timer(struct clockframe frame) +lapic_handle_timer(struct trapframe frame) { struct lapic *la; @@ -634,16 +635,16 @@ 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 @@ 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(); } --- //depot/vendor/freebsd/src/sys/amd64/amd64/mp_machdep.c 2005/12/08 18:35:19 +++ //depot/user/jhb/acpipci/amd64/amd64/mp_machdep.c 2005/12/14 21:21:48 @@ -917,7 +917,7 @@ } void -ipi_bitmap_handler(struct clockframe frame) +ipi_bitmap_handler(struct trapframe frame) { int cpu = PCPU_GET(cpuid); u_int ipi_bitmap; --- //depot/vendor/freebsd/src/sys/amd64/include/apicvar.h 2005/12/08 18:35:19 +++ //depot/user/jhb/acpipci/amd64/include/apicvar.h 2005/12/14 21:21:48 @@ -202,7 +202,7 @@ 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); --- //depot/vendor/freebsd/src/sys/amd64/include/clock.h 2005/01/05 20:20:40 +++ //depot/user/jhb/acpipci/amd64/include/clock.h 2005/12/09 19:39:46 @@ -29,7 +29,6 @@ /* * Driver to clock driver interface. */ -struct clockframe; int acquire_timer2(int mode); int release_timer2(void); --- //depot/vendor/freebsd/src/sys/amd64/include/cpu.h 2004/08/03 18:45:29 +++ //depot/user/jhb/acpipci/amd64/include/cpu.h 2005/12/09 19:39:46 @@ -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. */ --- //depot/vendor/freebsd/src/sys/amd64/include/frame.h 2005/12/08 18:35:19 +++ //depot/user/jhb/acpipci/amd64/include/frame.h 2005/12/14 21:21:48 @@ -76,34 +76,4 @@ 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_ */ --- //depot/vendor/freebsd/src/sys/amd64/include/smp.h 2005/12/08 18:35:19 +++ //depot/user/jhb/acpipci/amd64/include/smp.h 2005/12/14 21:21:48 @@ -52,7 +52,7 @@ 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); --- //depot/vendor/freebsd/src/sys/amd64/isa/clock.c 2005/12/12 22:30:21 +++ //depot/user/jhb/acpipci/amd64/isa/clock.c 2005/12/14 21:21:48 @@ -67,6 +67,7 @@ #include #include +#include #include #include #include @@ -141,7 +142,7 @@ }; static void -clkintr(struct clockframe *frame) +clkintr(struct trapframe *frame) { if (timecounter->tc_get_timecount == i8254_get_timecount) { @@ -155,8 +156,8 @@ 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 @@ * 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)); } } --- //depot/vendor/freebsd/src/sys/arm/arm/intr.c 2005/10/25 19:50:36 +++ //depot/user/jhb/acpipci/arm/arm/intr.c 2005/12/09 20:23:11 @@ -55,7 +55,7 @@ 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 @@ } void -arm_handler_execute(void *frame, int irqnb) +arm_handler_execute(struct trapframe *frame, int irqnb) { struct intr_event *event; struct intr_handler *ih; --- //depot/vendor/freebsd/src/sys/arm/include/cpu.h 2005/02/01 06:37:10 +++ //depot/user/jhb/acpipci/arm/include/cpu.h 2005/12/09 20:23:11 @@ -29,10 +29,7 @@ #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) --- //depot/vendor/freebsd/src/sys/arm/include/frame.h 2005/01/05 22:01:30 +++ //depot/user/jhb/acpipci/arm/include/frame.h 2005/12/09 20:23:11 @@ -137,28 +137,6 @@ 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 */ --- //depot/vendor/freebsd/src/sys/arm/sa11x0/sa11x0_ost.c 2005/01/05 22:01:30 +++ //depot/user/jhb/acpipci/arm/sa11x0/sa11x0_ost.c 2005/12/09 20:23:11 @@ -144,7 +144,7 @@ clockintr(arg) void *arg; { - struct clockframe *frame = arg; + struct trapframe *frame = arg; u_int32_t oscr, nextmatch, oldmatch; int s; @@ -179,7 +179,7 @@ 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 +190,7 @@ statintr(arg) void *arg; { - struct clockframe *frame = arg; + struct trapframe *frame = arg; u_int32_t oscr, nextmatch, oldmatch; int s; @@ -225,7 +225,7 @@ } saost_sc->sc_statclock_count = nextmatch; - statclock(frame); + statclock(TRAPF_USERMODE(frame)); } #endif --- //depot/vendor/freebsd/src/sys/arm/xscale/i80321/i80321_timer.c 2005/12/09 23:55:52 +++ //depot/user/jhb/acpipci/arm/xscale/i80321/i80321_timer.c 2005/12/14 21:21:48 @@ -377,11 +377,11 @@ 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)(); --- //depot/vendor/freebsd/src/sys/i386/i386/local_apic.c 2005/12/13 18:30:20 +++ //depot/user/jhb/acpipci/i386/i386/local_apic.c 2005/12/14 21:21:48 @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -619,7 +620,7 @@ } void -lapic_handle_timer(struct clockframe frame) +lapic_handle_timer(struct trapframe frame) { struct lapic *la; @@ -636,16 +637,16 @@ 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 @@ 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(); } --- //depot/vendor/freebsd/src/sys/i386/i386/mp_machdep.c 2005/12/05 22:30:21 +++ //depot/user/jhb/acpipci/i386/i386/mp_machdep.c 2005/12/09 20:11:07 @@ -1117,7 +1117,7 @@ } void -ipi_bitmap_handler(struct clockframe frame) +ipi_bitmap_handler(struct trapframe frame) { int cpu = PCPU_GET(cpuid); u_int ipi_bitmap; --- //depot/vendor/freebsd/src/sys/i386/include/apicvar.h 2005/12/05 22:40:27 +++ //depot/user/jhb/acpipci/i386/include/apicvar.h 2005/12/09 20:11:07 @@ -201,7 +201,7 @@ 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); --- //depot/vendor/freebsd/src/sys/i386/include/clock.h 2005/04/13 13:15:21 +++ //depot/user/jhb/acpipci/i386/include/clock.h 2005/12/09 20:11:07 @@ -29,7 +29,6 @@ /* * Driver to clock driver interface. */ -struct clockframe; int acquire_timer2(int mode); int release_timer2(void); --- //depot/vendor/freebsd/src/sys/i386/include/cpu.h 2004/11/16 20:46:59 +++ //depot/user/jhb/acpipci/i386/include/cpu.h 2005/12/09 20:11:07 @@ -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. */ --- //depot/vendor/freebsd/src/sys/i386/include/frame.h 2005/12/05 22:40:27 +++ //depot/user/jhb/acpipci/i386/include/frame.h 2005/12/09 20:11:07 @@ -97,29 +97,4 @@ 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_ */ --- //depot/vendor/freebsd/src/sys/i386/include/smp.h 2005/12/05 22:30:21 +++ //depot/user/jhb/acpipci/i386/include/smp.h 2005/12/09 20:11:07 @@ -61,7 +61,7 @@ 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); --- //depot/vendor/freebsd/src/sys/i386/isa/clock.c 2005/12/13 19:10:20 +++ //depot/user/jhb/acpipci/i386/isa/clock.c 2005/12/14 21:21:48 @@ -70,6 +70,7 @@ #include #include +#include #include #include #include @@ -155,7 +156,7 @@ }; static void -clkintr(struct clockframe *frame) +clkintr(struct trapframe *frame) { if (timecounter->tc_get_timecount == i8254_get_timecount) { @@ -169,8 +170,8 @@ 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 @@ * 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)); } } --- //depot/vendor/freebsd/src/sys/ia64/ia64/interrupt.c 2005/10/30 17:25:24 +++ //depot/user/jhb/acpipci/ia64/ia64/interrupt.c 2005/12/09 20:14:53 @@ -173,12 +173,12 @@ 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) --- //depot/vendor/freebsd/src/sys/ia64/include/cpu.h 2005/01/06 22:21:32 +++ //depot/user/jhb/acpipci/ia64/include/cpu.h 2005/12/09 20:14:53 @@ -44,17 +44,6 @@ #include -/* - * 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) --- //depot/vendor/freebsd/src/sys/kern/kern_clock.c 2005/10/27 17:25:28 +++ //depot/user/jhb/acpipci/kern/kern_clock.c 2005/12/13 23:08:41 @@ -65,8 +65,6 @@ #include #include -#include - #ifdef GPROF #include #endif @@ -189,12 +187,11 @@ /* * 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 @@ /* 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,13 +229,12 @@ * 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; CTR0(KTR_CLK, "hardclock fired"); - hardclock_process(frame); + hardclock_cpu(usermode); tc_ticktock(); /* @@ -247,8 +243,8 @@ * XXX: this only works for UP */ if (stathz == 0) { - profclock(frame); - statclock(frame); + profclock(usermode, pc); + statclock(usermode); } #ifdef DEVICE_POLLING @@ -402,8 +398,7 @@ * This should be called by all active processors. */ void -statclock(frame) - register struct clockframe *frame; +statclock(int usermode) { struct rusage *ru; struct vmspace *vm; @@ -415,7 +410,7 @@ p = td->td_proc; mtx_lock_spin_flags(&sched_lock, MTX_QUIET); - if (CLKF_USERMODE(frame)) { + if (usermode) { /* * Charge the time as appropriate. */ @@ -474,17 +469,16 @@ } void -profclock(frame) - register struct clockframe *frame; +profclock(int usermode, uintfptr_t pc) { struct thread *td; #ifdef GPROF struct gmonparam *g; - int i; + u_long i; #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. @@ -492,7 +486,7 @@ * 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 { @@ -501,7 +495,7 @@ */ g = &_gmonparam; if (g->state == GMON_PROF_ON) { - i = CLKF_PC(frame) - g->lowpc; + i = pc - g->lowpc; if (i < g->textsize) { i /= HISTFRACTION * sizeof(*g->kcount); g->kcount[i]++; --- //depot/vendor/freebsd/src/sys/kern/subr_prof.c 2005/03/02 21:35:38 +++ //depot/user/jhb/acpipci/kern/subr_prof.c 2005/12/09 18:21:56 @@ -442,6 +442,8 @@ * Scale is a fixed-point number with the binary point 16 bits * into the value, and is <= 1.0. pc is at most 32 bits, so the * intermediate result is at most 48 bits. + * + * XXX: pc is 64 bits on LP64 archs. */ #define PC_TO_INDEX(pc, prof) \ ((int)(((u_quad_t)((pc) - (prof)->pr_off) * \ @@ -461,7 +463,7 @@ * inaccurate. */ void -addupc_intr(struct thread *td, uintptr_t pc, u_int ticks) +addupc_intr(struct thread *td, uintfptr_t pc, u_int ticks) { struct uprof *prof; caddr_t addr; @@ -495,7 +497,7 @@ * update fails, we simply turn off profiling. */ void -addupc_task(struct thread *td, uintptr_t pc, u_int ticks) +addupc_task(struct thread *td, uintfptr_t pc, u_int ticks) { struct proc *p = td->td_proc; struct uprof *prof; --- //depot/vendor/freebsd/src/sys/pc98/cbus/clock.c 2005/07/13 15:48:06 +++ //depot/user/jhb/acpipci/pc98/cbus/clock.c 2005/12/09 20:47:21 @@ -149,7 +149,7 @@ }; static void -clkintr(struct clockframe *frame) +clkintr(struct trapframe *frame) { if (timecounter->tc_get_timecount == i8254_get_timecount) { @@ -163,8 +163,8 @@ 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 --- //depot/vendor/freebsd/src/sys/powerpc/include/clock.h 2005/01/07 02:32:16 +++ //depot/user/jhb/acpipci/powerpc/include/clock.h 2005/12/09 20:37:32 @@ -19,7 +19,7 @@ int acquire_timer2(int mode); int release_timer2(void); -void decr_intr(struct clockframe *); +void decr_intr(struct trapframe *); #endif --- //depot/vendor/freebsd/src/sys/powerpc/include/cpu.h 2005/01/07 02:32:16 +++ //depot/user/jhb/acpipci/powerpc/include/cpu.h 2005/12/09 20:37:32 @@ -39,11 +39,6 @@ #include #include -#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) --- //depot/vendor/freebsd/src/sys/powerpc/include/frame.h 2005/01/07 02:32:16 +++ //depot/user/jhb/acpipci/powerpc/include/frame.h 2005/12/09 20:39:52 @@ -65,22 +65,6 @@ #define FRAMELEN roundup(sizeof(struct trapframe) + 8, 16) #define trapframe(td) ((td)->td_frame) -struct switchframe { - register_t sp; - register_t fill; - register_t user_sr; - register_t cr; - register_t fixreg2; - register_t fixreg[19]; /* R13-R31 */ -}; - -struct clockframe { - register_t srr1; - register_t srr0; - int pri; - int depth; -}; - /* * Call frame for PowerPC used during fork. */ @@ -92,52 +76,6 @@ register_t cf_arg1; }; -#define IFRAMELEN sizeof(struct intrframe) -struct intrframe { - register_t r1; /* 0 */ - register_t _pad4; /* 4 */ - /* - * The next 4 fields are "clockframe" - */ - register_t srr1; /* 8 */ - register_t srr0; /* 12 */ - int pri; /* 16 */ - int intr_depth; /* 20 */ - register_t vrsave; /* 24 */ - register_t ctr; /* 28 */ - register_t xer; /* 32 */ - register_t cr; /* 36 */ - register_t lr; /* 40 */ - register_t r12; /* 44 */ - register_t r11; /* 48 */ - register_t r10; /* 52 */ - register_t r9; /* 56 */ - register_t r8; /* 60 */ - register_t r7; /* 64 */ - register_t r6; /* 68 */ - register_t r5; /* 72 */ - register_t r4; /* 76 */ - register_t r3; /* 80 */ - register_t r0; /* 84 */ -}; - -#define SPFRAMELEN sizeof(struct spillframe) -struct spillframe { - register_t r1; /* 0 */ - register_t _pad4; /* 4 */ - register_t r12; /* 8 */ - register_t r11; /* 12 */ - register_t r10; /* 16 */ - register_t r9; /* 20 */ - register_t r8; /* 24 */ - register_t r7; /* 28 */ - register_t r6; /* 32 */ - register_t r5; /* 36 */ - register_t r4; /* 40 */ - register_t r3; /* 44 */ - register_t r0; /* 48 */ -}; - /* Definitions for syscalls */ #define FIRSTARG 3 /* first arg in reg 3 */ #define NARGREG 8 /* 8 args in regs */ --- //depot/vendor/freebsd/src/sys/powerpc/powerpc/clock.c 2005/02/04 01:45:20 +++ //depot/user/jhb/acpipci/powerpc/powerpc/clock.c 2005/12/09 20:37:32 @@ -183,7 +183,7 @@ } void -decr_intr(struct clockframe *frame) +decr_intr(struct trapframe *frame) { u_long tb; long tick; @@ -225,10 +225,10 @@ */ #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 --- //depot/vendor/freebsd/src/sys/powerpc/powerpc/genassym.c 2004/11/20 02:31:01 +++ //depot/user/jhb/acpipci/powerpc/powerpc/genassym.c 2005/12/09 20:39:52 @@ -122,45 +122,6 @@ ASSYM(FRAME_DSISR, offsetof(struct trapframe, dsisr)); ASSYM(FRAME_EXC, offsetof(struct trapframe, exc)); -ASSYM(SFRAMELEN, roundup(sizeof(struct switchframe), 16)); - -ASSYM(IFRAMELEN, IFRAMELEN); -ASSYM(IFRAME_R1, offsetof(struct intrframe, r1)); -ASSYM(IFRAME_SRR1, offsetof(struct intrframe, srr1)); -ASSYM(IFRAME_SRR0, offsetof(struct intrframe, srr0)); -ASSYM(IFRAME_PRI, offsetof(struct intrframe, pri)); -ASSYM(IFRAME_INTR_DEPTH, offsetof(struct intrframe, intr_depth)); -ASSYM(IFRAME_VRSAVE, offsetof(struct intrframe, vrsave)); -ASSYM(IFRAME_CTR, offsetof(struct intrframe, ctr)); -ASSYM(IFRAME_XER, offsetof(struct intrframe, xer)); -ASSYM(IFRAME_CR, offsetof(struct intrframe, cr)); -ASSYM(IFRAME_LR, offsetof(struct intrframe, lr)); -ASSYM(IFRAME_R12, offsetof(struct intrframe, r12)); -ASSYM(IFRAME_R11, offsetof(struct intrframe, r11)); -ASSYM(IFRAME_R10, offsetof(struct intrframe, r10)); -ASSYM(IFRAME_R9, offsetof(struct intrframe, r9)); -ASSYM(IFRAME_R8, offsetof(struct intrframe, r8)); -ASSYM(IFRAME_R7, offsetof(struct intrframe, r7)); -ASSYM(IFRAME_R6, offsetof(struct intrframe, r6)); -ASSYM(IFRAME_R5, offsetof(struct intrframe, r5)); -ASSYM(IFRAME_R4, offsetof(struct intrframe, r4)); -ASSYM(IFRAME_R3, offsetof(struct intrframe, r3)); -ASSYM(IFRAME_R0, offsetof(struct intrframe, r0)); - -ASSYM(SPFRAMELEN, SPFRAMELEN); -ASSYM(SPFRAME_R1, offsetof(struct spillframe, r1)); -ASSYM(SPFRAME_R12, offsetof(struct spillframe, r12)); -ASSYM(SPFRAME_R11, offsetof(struct spillframe, r11)); -ASSYM(SPFRAME_R10, offsetof(struct spillframe, r10)); -ASSYM(SPFRAME_R9, offsetof(struct spillframe, r9)); -ASSYM(SPFRAME_R8, offsetof(struct spillframe, r8)); -ASSYM(SPFRAME_R7, offsetof(struct spillframe, r7)); -ASSYM(SPFRAME_R6, offsetof(struct spillframe, r6)); -ASSYM(SPFRAME_R5, offsetof(struct spillframe, r5)); -ASSYM(SPFRAME_R4, offsetof(struct spillframe, r4)); -ASSYM(SPFRAME_R3, offsetof(struct spillframe, r3)); -ASSYM(SPFRAME_R0, offsetof(struct spillframe, r0)); - ASSYM(CF_FUNC, offsetof(struct callframe, cf_func)); ASSYM(CF_ARG0, offsetof(struct callframe, cf_arg0)); ASSYM(CF_ARG1, offsetof(struct callframe, cf_arg1)); --- //depot/vendor/freebsd/src/sys/powerpc/powerpc/interrupt.c 2005/01/07 02:32:16 +++ //depot/user/jhb/acpipci/powerpc/powerpc/interrupt.c 2005/12/09 20:37:32 @@ -72,7 +72,7 @@ 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 @@ powerpc_interrupt(struct trapframe *framep) { struct thread *td; - struct clockframe ckframe; td = curthread; @@ -97,9 +96,7 @@ 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; --- //depot/vendor/freebsd/src/sys/sparc64/include/cpu.h 2004/08/03 18:45:29 +++ //depot/user/jhb/acpipci/sparc64/include/cpu.h 2005/12/09 20:45:43 @@ -40,9 +40,6 @@ #include #include -#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) --- //depot/vendor/freebsd/src/sys/sparc64/include/frame.h 2004/07/10 23:10:24 +++ //depot/user/jhb/acpipci/sparc64/include/frame.h 2005/12/09 20:45:43 @@ -62,10 +62,6 @@ tf->tf_tnpc += 4; \ } while (0) -struct clockframe { - struct trapframe cf_tf; -}; - struct frame { u_long fr_local[8]; u_long fr_in[8]; --- //depot/vendor/freebsd/src/sys/sparc64/sparc64/tick.c 2005/08/07 13:21:48 +++ //depot/user/jhb/acpipci/sparc64/sparc64/tick.c 2005/12/13 22:22:53 @@ -37,6 +37,7 @@ #include #include +#include #include #include #include @@ -62,7 +63,7 @@ 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 @@ } 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 @@ 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 @@ 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 --- //depot/vendor/freebsd/src/sys/sys/proc.h 2005/11/30 05:15:23 +++ //depot/user/jhb/acpipci/sys/proc.h 2005/12/09 18:21:56 @@ -289,7 +289,7 @@ stack_t td_sigstk; /* (k) Stack ptr and on-stack flag. */ int td_kflags; /* (c) Flags for KSE threading. */ int td_xsig; /* (c) Signal for ptrace */ - u_long td_profil_addr; /* (k) Temporary addr until AST. */ + uintfptr_t td_profil_addr; /* (k) Temporary addr until AST. */ u_int td_profil_ticks; /* (k) Temporary ticks until AST. */ #define td_endzero td_base_pri --- //depot/vendor/freebsd/src/sys/sys/resourcevar.h 2005/09/27 18:10:31 +++ //depot/user/jhb/acpipci/sys/resourcevar.h 2005/12/09 18:21:56 @@ -61,7 +61,7 @@ struct uprof { /* Profile arguments. */ caddr_t pr_base; /* (c + j) Buffer base. */ u_long pr_size; /* (c + j) Buffer size. */ - u_long pr_off; /* (c + j) PC offset. */ + uintfptr_t pr_off; /* (c + j) PC offset. */ u_long pr_scale; /* (c + j) PC scaling. */ } p_prof; #define pstat_endcopy p_start @@ -104,8 +104,8 @@ struct rusage_ext; struct thread; -void addupc_intr(struct thread *td, uintptr_t pc, u_int ticks); -void addupc_task(struct thread *td, uintptr_t pc, u_int ticks); +void addupc_intr(struct thread *td, uintfptr_t pc, u_int ticks); +void addupc_task(struct thread *td, uintfptr_t pc, u_int ticks); void calccru(struct proc *p, struct timeval *up, struct timeval *sp); void calcru(struct proc *p, struct timeval *up, struct timeval *sp); int chgproccnt(struct uidinfo *uip, int diff, int maxval); --- //depot/vendor/freebsd/src/sys/sys/systm.h 2005/08/19 22:10:32 +++ //depot/user/jhb/acpipci/sys/systm.h 2005/12/09 18:21:56 @@ -112,7 +112,6 @@ * General function declarations. */ -struct clockframe; struct malloc_type; struct mtx; struct proc; @@ -207,11 +206,11 @@ 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 *);