home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.2 / LINUX-1.2 / LINUX-1 / linux / kernel / softirq.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-01  |  1.1 KB  |  56 lines

  1. /*
  2.  *    linux/kernel/softirq.c
  3.  *
  4.  *    Copyright (C) 1992 Linus Torvalds
  5.  *
  6.  * do_bottom_half() runs at normal kernel priority: all interrupts
  7.  * enabled.  do_bottom_half() is atomic with respect to itself: a
  8.  * bottom_half handler need not be re-entrant.
  9.  */
  10.  
  11. #include <linux/ptrace.h>
  12. #include <linux/errno.h>
  13. #include <linux/kernel_stat.h>
  14. #include <linux/signal.h>
  15. #include <linux/sched.h>
  16. #include <linux/interrupt.h>
  17. #include <linux/mm.h>
  18.  
  19. #include <asm/system.h>
  20. #include <asm/io.h>
  21. #include <asm/irq.h>
  22. #include <asm/bitops.h>
  23.  
  24. #define INCLUDE_INLINE_FUNCS
  25. #include <linux/tqueue.h>
  26.  
  27. unsigned long intr_count = 0;
  28.  
  29. unsigned long bh_active = 0;
  30. unsigned long bh_mask = 0;
  31. struct bh_struct bh_base[32];
  32.  
  33.  
  34. asmlinkage void do_bottom_half(void)
  35. {
  36.     unsigned long active;
  37.     unsigned long mask, left;
  38.     struct bh_struct *bh;
  39.  
  40.     bh = bh_base;
  41.     active = bh_active & bh_mask;
  42.     for (mask = 1, left = ~0 ; left & active ; bh++,mask += mask,left += left) {
  43.         if (mask & active) {
  44.             void (*fn)(void *);
  45.             bh_active &= ~mask;
  46.             fn = bh->routine;
  47.             if (!fn)
  48.                 goto bad_bh;
  49.             fn(bh->data);
  50.         }
  51.     }
  52.     return;
  53. bad_bh:
  54.     printk ("irq.c:bad bottom half entry %08lx\n", mask);
  55. }
  56.