do_timer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* defines for inline arch setup functions */
  2. #include <asm/fixmap.h>
  3. #include "cobalt.h"
  4. static inline void do_timer_interrupt_hook(struct pt_regs *regs)
  5. {
  6. /* Clear the interrupt */
  7. co_cpu_write(CO_CPU_STAT,co_cpu_read(CO_CPU_STAT) & ~CO_STAT_TIMEINTR);
  8. do_timer(regs);
  9. #ifndef CONFIG_SMP
  10. update_process_times(user_mode(regs));
  11. #endif
  12. /*
  13. * In the SMP case we use the local APIC timer interrupt to do the
  14. * profiling, except when we simulate SMP mode on a uniprocessor
  15. * system, in that case we have to call the local interrupt handler.
  16. */
  17. #ifndef CONFIG_X86_LOCAL_APIC
  18. profile_tick(CPU_PROFILING, regs);
  19. #else
  20. if (!using_apic_timer)
  21. smp_local_timer_interrupt(regs);
  22. #endif
  23. }
  24. static inline int do_timer_overflow(int count)
  25. {
  26. int i;
  27. spin_lock(&i8259A_lock);
  28. /*
  29. * This is tricky when I/O APICs are used;
  30. * see do_timer_interrupt().
  31. */
  32. i = inb(0x20);
  33. spin_unlock(&i8259A_lock);
  34. /* assumption about timer being IRQ0 */
  35. if (i & 0x01) {
  36. /*
  37. * We cannot detect lost timer interrupts ...
  38. * well, that's why we call them lost, don't we? :)
  39. * [hmm, on the Pentium and Alpha we can ... sort of]
  40. */
  41. count -= LATCH;
  42. } else {
  43. printk("do_slow_gettimeoffset(): hardware timer problem?\n");
  44. }
  45. return count;
  46. }