1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
/*
* Copyright (c) 1996-1999 The University of Utah and the Flux Group.
*
* This file is part of the OSKit Linux Glue Libraries, which are free
* software, also known as "open source;" you can redistribute them and/or
* modify them under the terms of the GNU General Public License (GPL),
* version 2, as published by the Free Software Foundation (FSF).
*
* The OSKit is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GPL for more details. You should have
* received a copy of the GPL along with the OSKit; see the file COPYING. If
* not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA.
*/
/*
* Linux software interrupts.
*/
#ifndef OSKIT
#define OSKIT
#endif
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <asm/system.h>
#include <asm/bitops.h>
#include <oskit/dev/dev.h>
#include "osenv.h"
atomic_t bh_mask_count[32];
/*
* Mask of pending interrupts.
*/
unsigned long bh_active = 0;
/*
* Mask of enabled interrupts.
*/
unsigned long bh_mask = 0;
/*
* List of software interrupt handlers.
*/
void (*bh_base[32])(void);
/*
* Flag indicating a soft interrupt is being handled.
*/
unsigned int local_bh_count[1]; /* SMP */
/*
* Software interrupt handler.
* Should be called (and return) with interupts enabled.
*/
void
do_bottom_half(void)
{
unsigned long active;
unsigned long mask, left;
void (**bh)(void);
osenv_assert(osenv_intr_enabled() != 0);
bh = bh_base;
active = bh_active & bh_mask;
for (mask = 1, left = ~0;
left & active; bh++, mask += mask, left += left) {
if (mask & active) {
void (*fn)(void);
bh_active &= ~mask;
fn = *bh;
if (fn == 0)
goto bad_bh;
local_bh_count[0]++;
fn();
local_bh_count[0]--;
}
}
osenv_assert(osenv_intr_enabled() != 0);
return;
bad_bh:
osenv_log(OSENV_LOG_WARNING,
"linux_soft_intr: bad interrupt handler entry 0x%08lx\n", mask);
}
|