Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_intr.c
| Show First 20 Lines • Show All 1,340 Lines • ▼ Show 20 Lines | ithread_loop(void *arg) | ||||
| } | } | ||||
| } | } | ||||
| /* | /* | ||||
| * Main interrupt handling body. | * Main interrupt handling body. | ||||
| * | * | ||||
| * Input: | * Input: | ||||
| * o ie: the event connected to this interrupt. | * o ie: the event connected to this interrupt. | ||||
| * o frame: some archs (i.e. i386) pass a frame to some. | * o frame: the current trap frame. | ||||
| * handlers as their main argument. | * | ||||
| * Return value: | * Return value: | ||||
| * o 0: everything ok. | * o 0: everything ok. | ||||
| * o EINVAL: stray interrupt. | * o EINVAL: stray interrupt. | ||||
| */ | */ | ||||
| int | int | ||||
| intr_event_handle(struct intr_event *ie, struct trapframe *frame) | intr_event_handle(struct intr_event *ie, struct trapframe *frame) | ||||
| { | { | ||||
| struct intr_handler *ih; | struct intr_handler *ih; | ||||
| Show All 10 Lines | |||||
| #endif | #endif | ||||
| /* An interrupt with no event or handlers is a stray interrupt. */ | /* An interrupt with no event or handlers is a stray interrupt. */ | ||||
| if (ie == NULL || CK_SLIST_EMPTY(&ie->ie_handlers)) | if (ie == NULL || CK_SLIST_EMPTY(&ie->ie_handlers)) | ||||
| return (EINVAL); | return (EINVAL); | ||||
| /* | /* | ||||
| * Execute fast interrupt handlers directly. | * Execute fast interrupt handlers directly. | ||||
| * To support clock handlers, if a handler registers | |||||
| * with a NULL argument, then we pass it a pointer to | |||||
| * a trapframe as its argument. | |||||
| */ | */ | ||||
| td->td_intr_nesting_level++; | td->td_intr_nesting_level++; | ||||
| filter = false; | filter = false; | ||||
| thread = false; | thread = false; | ||||
| ret = 0; | ret = 0; | ||||
| critical_enter(); | critical_enter(); | ||||
| oldframe = td->td_intr_frame; | oldframe = td->td_intr_frame; | ||||
| td->td_intr_frame = frame; | td->td_intr_frame = frame; | ||||
| Show All 12 Lines | if ((ih->ih_flags & IH_SUSP) != 0) | ||||
| continue; | continue; | ||||
| if ((ie->ie_flags & IE_SOFT) != 0 && ih->ih_need == 0) | if ((ie->ie_flags & IE_SOFT) != 0 && ih->ih_need == 0) | ||||
| continue; | continue; | ||||
| if (ih->ih_filter == NULL) { | if (ih->ih_filter == NULL) { | ||||
| thread = true; | thread = true; | ||||
| continue; | continue; | ||||
| } | } | ||||
| CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__, | CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__, | ||||
| ih->ih_filter, ih->ih_argument == NULL ? frame : | ih->ih_filter, ih->ih_argument, ih->ih_name); | ||||
| ih->ih_argument, ih->ih_name); | |||||
| if (ih->ih_argument == NULL) | |||||
| ret = ih->ih_filter(frame); | |||||
| else | |||||
| ret = ih->ih_filter(ih->ih_argument); | ret = ih->ih_filter(ih->ih_argument); | ||||
| #ifdef HWPMC_HOOKS | #ifdef HWPMC_HOOKS | ||||
| PMC_SOFT_CALL_TF( , , intr, all, frame); | PMC_SOFT_CALL_TF( , , intr, all, frame); | ||||
| #endif | #endif | ||||
| KASSERT(ret == FILTER_STRAY || | KASSERT(ret == FILTER_STRAY || | ||||
| ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) != 0 && | ((ret & (FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) != 0 && | ||||
| (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) == 0), | (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) == 0), | ||||
| ("%s: incorrect return value %#x from %s", __func__, ret, | ("%s: incorrect return value %#x from %s", __func__, ret, | ||||
| ih->ih_name)); | ih->ih_name)); | ||||
| ▲ Show 20 Lines • Show All 282 Lines • Show Last 20 Lines | |||||