Store interrupt trap frame into struct thread. It allows interrupt handler
to obtain both trap frame and opaque argument submitted on registrction. After kernel and all drivers get used to it, legacy hack can be removed. Reviewed by: jhb@
This commit is contained in:
parent
a08050302b
commit
1f255bd340
@ -1347,6 +1347,7 @@ int
|
||||
intr_event_handle(struct intr_event *ie, struct trapframe *frame)
|
||||
{
|
||||
struct intr_handler *ih;
|
||||
struct trapframe *oldframe;
|
||||
struct thread *td;
|
||||
int error, ret, thread;
|
||||
|
||||
@ -1366,6 +1367,8 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame)
|
||||
thread = 0;
|
||||
ret = 0;
|
||||
critical_enter();
|
||||
oldframe = td->td_intr_frame;
|
||||
td->td_intr_frame = frame;
|
||||
TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
|
||||
if (ih->ih_filter == NULL) {
|
||||
thread = 1;
|
||||
@ -1403,6 +1406,7 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame)
|
||||
thread = 1;
|
||||
}
|
||||
}
|
||||
td->td_intr_frame = oldframe;
|
||||
|
||||
if (thread) {
|
||||
if (ie->ie_pre_ithread != NULL)
|
||||
@ -1592,6 +1596,7 @@ int
|
||||
intr_event_handle(struct intr_event *ie, struct trapframe *frame)
|
||||
{
|
||||
struct intr_thread *ithd;
|
||||
struct trapframe *oldframe;
|
||||
struct thread *td;
|
||||
int thread;
|
||||
|
||||
@ -1604,6 +1609,8 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame)
|
||||
td->td_intr_nesting_level++;
|
||||
thread = 0;
|
||||
critical_enter();
|
||||
oldframe = td->td_intr_frame;
|
||||
td->td_intr_frame = frame;
|
||||
thread = intr_filter_loop(ie, frame, &ithd);
|
||||
if (thread & FILTER_HANDLED) {
|
||||
if (ie->ie_post_filter != NULL)
|
||||
@ -1612,6 +1619,7 @@ intr_event_handle(struct intr_event *ie, struct trapframe *frame)
|
||||
if (ie->ie_pre_ithread != NULL)
|
||||
ie->ie_pre_ithread(ie->ie_source);
|
||||
}
|
||||
td->td_intr_frame = oldframe;
|
||||
critical_exit();
|
||||
|
||||
/* Interrupt storm logic */
|
||||
|
@ -301,6 +301,7 @@ struct thread {
|
||||
int td_errno; /* Error returned by last syscall. */
|
||||
struct vnet *td_vnet; /* (k) Effective vnet. */
|
||||
const char *td_vnet_lpush; /* (k) Debugging vnet push / pop. */
|
||||
struct trapframe *td_intr_frame;/* (k) Frame of the current irq */
|
||||
};
|
||||
|
||||
struct mtx *thread_lock_block(struct thread *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user