From owner-svn-src-all@FreeBSD.ORG Thu Jun 10 16:14:05 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64DB31065672; Thu, 10 Jun 2010 16:14:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54DB58FC17; Thu, 10 Jun 2010 16:14:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5AGE5vY099386; Thu, 10 Jun 2010 16:14:05 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5AGE5Zh099383; Thu, 10 Jun 2010 16:14:05 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201006101614.o5AGE5Zh099383@svn.freebsd.org> From: Alexander Motin Date: Thu, 10 Jun 2010 16:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208988 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2010 16:14:05 -0000 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 *);