Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 2010 16:14:05 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208988 - in head/sys: kern sys
Message-ID:  <201006101614.o5AGE5Zh099383@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Jun 10 16:14:05 2010
New Revision: 208988
URL: http://svn.freebsd.org/changeset/base/208988

Log:
  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@

Modified:
  head/sys/kern/kern_intr.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_intr.c
==============================================================================
--- head/sys/kern/kern_intr.c	Thu Jun 10 16:13:32 2010	(r208987)
+++ head/sys/kern/kern_intr.c	Thu Jun 10 16:14:05 2010	(r208988)
@@ -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,
 	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,
 				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,
 	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,
 		if (ie->ie_pre_ithread != NULL)
 			ie->ie_pre_ithread(ie->ie_source);
 	}
+	td->td_intr_frame = oldframe;
 	critical_exit();
 	
 	/* Interrupt storm logic */

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Thu Jun 10 16:13:32 2010	(r208987)
+++ head/sys/sys/proc.h	Thu Jun 10 16:14:05 2010	(r208988)
@@ -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 *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006101614.o5AGE5Zh099383>