/*
* Copyright 2001 MontaVista Software Inc.
* Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- * Copyright (c) 2003 Maciej W. Rozycki
+ * Copyright (c) 2003, 2004 Maciej W. Rozycki
*
* Common time service routines for MIPS machines. See
* Documentation/mips/time.README.
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
-#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <asm/bootinfo.h>
+#include <asm/compiler.h>
#include <asm/cpu.h>
#include <asm/cpu-features.h>
#include <asm/div64.h>
-#include <asm/hardirq.h>
#include <asm/sections.h>
#include <asm/time.h>
*/
extern volatile unsigned long wall_jiffies;
-spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
-
-/*
- * whether we emulate local_timer_interrupts for SMP machines.
- */
-int emulate_local_timer_interrupt;
-
+DEFINE_SPINLOCK(rtc_lock);
/*
* By default we provide the null RTC ops
__asm__("multu %1,%2"
: "=h" (res)
: "r" (count), "r" (sll32_usecs_per_cycle)
- : "lo", "accum");
+ : "lo", GCC_REG_ACCUM);
/*
* Due to possible jiffies inconsistencies, we need to check
__asm__("multu %1,%2"
: "=h" (res)
: "r" (count), "r" (quotient)
- : "lo", "accum");
+ : "lo", GCC_REG_ACCUM);
/*
* Due to possible jiffies inconsistencies, we need to check
: "r" (timerhi), "m" (timerlo),
"r" (tmp), "r" (USECS_PER_JIFFY),
"r" (USECS_PER_JIFFY_FRAC)
- : "hi", "lo", "accum");
+ : "hi", "lo", GCC_REG_ACCUM);
cached_quotient = quotient;
}
}
__asm__("multu %1,%2"
: "=h" (res)
: "r" (count), "r" (quotient)
- : "lo", "accum");
+ : "lo", GCC_REG_ACCUM);
/*
* Due to possible jiffies inconsistencies, we need to check
*/
void local_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
- if (!user_mode(regs)) {
- if (prof_buffer && current->pid) {
- unsigned long pc = regs->cp0_epc;
-
- pc -= (unsigned long) _stext;
- pc >>= prof_shift;
- /*
- * Dont ignore out-of-bounds pc values silently,
- * put them into the last histogram slot, so if
- * present, they will show up as a sharp peak.
- */
- if (pc > prof_len - 1)
- pc = prof_len - 1;
- atomic_inc((atomic_t *)&prof_buffer[pc]);
- }
- }
-
-#ifdef CONFIG_SMP
- /* in UP mode, update_process_times() is invoked by do_timer() */
+ if (current->pid)
+ profile_tick(CPU_PROFILING, regs);
update_process_times(user_mode(regs));
-#endif
}
/*
}
}
-#if !defined(CONFIG_SMP)
/*
* In UP mode, we call local_timer_interrupt() to do profiling
* and process accouting.
*/
local_timer_interrupt(irq, dev_id, regs);
-#else /* CONFIG_SMP */
-
- if (emulate_local_timer_interrupt) {
- /*
- * this is the place where we send out inter-process
- * interrupts and let each CPU do its own profiling
- * and process accouting.
- *
- * Obviously we need to call local_timer_interrupt() for
- * the current CPU too.
- */
- panic("Not implemented yet!!!");
- }
-#endif /* CONFIG_SMP */
-
return IRQ_HANDLED;
}