From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 5 01:24:55 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A079F37B401; Sat, 5 Apr 2003 01:24:55 -0800 (PST) Received: from pedigree.cs.ubc.ca (pedigree.cs.ubc.ca [142.103.6.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 22CDA43FBF; Sat, 5 Apr 2003 01:24:55 -0800 (PST) (envelope-from kcai@cs.ubc.ca) Received: from granville.cs.ubc.ca (granville.cs.ubc.ca [142.103.7.20]) by pedigree.cs.ubc.ca (8.12.9/8.11.4) with ESMTP id h359Os0V027420; Sat, 5 Apr 2003 01:24:54 -0800 (PST) Date: Sat, 5 Apr 2003 01:24:54 -0800 (PST) From: Kan Cai To: Terry Lambert In-Reply-To: <3E8E2418.9B46EBDD@mindspring.com> Message-ID: References: <3E8E2418.9B46EBDD@mindspring.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org cc: freebsd-questions@freebsd.org Subject: Re: the CPU interrupt handler X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Apr 2003 09:24:56 -0000 On Fri, 4 Apr 2003, Terry Lambert wrote: > Kan Cai wrote: > > I am trying to locate the CPU interrupt handler, but with no luck. I > > guess it is somewhere in the "1386" folder, but not sure which file is > > doing the job. Could someone there shed some lights on this? > > > > Since I am trying to capture the NIC interrupts, so it should not be > > exceptions. Thanks a lot. > > You need to look at an existing NIC driver to see how it > grabs interrupts. The functions you are probably interested > in are bus_setup_intr() and bus_teardown_intr(). > > If you are trying to do this in an evil, i386 way, because you > want to intercept the interrupt path for some legitimate > instrumentation purpose, or because you have some wrong idea > that this will make your networking product run faster, then > you could do worse than to look at the functions "inthand_*" > in /usr/src/sys/i386/isa/intr_machdep.c. Thanks a lot for this info, but I guess I didn't express myself clearly. The real goal of mine is to insert a timer into where the processor gets interrupted, switches the context, and finally calls the corresponding handlers. After reading the intr_machdept.c, I am kinda doubt that it is the right file I should focus, it mainly does the setup and remove entries in GDT and IDT, doesn't it? I found that in "apic_vector.s", there is a function called "INTR", is that true that I should put my timer in this function? Any related info is highly appreciated. Cheers, ken > > -- Terry >