do_timer.h 1.2 KB

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