LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-26-2004, 05:55 PM   #1
Dagda99
LQ Newbie
 
Registered: Jul 2004
Posts: 19

Rep: Reputation: 0
How to add a local APIC vector entry?


I'm creating a driver that would deal a little with the performance monitoring counters that are on Intel chips. I'm running a dual P3 Xeon system. Linux 2.4.26, Slackware 10.0, gcc 3.3.4. Written in C, with inline/extended assembly.

The counters are supposed to be able to fire an interrupt when they overflow; the IA-32 Intel Architecture Software Developers Manual, Volume 3 says to:
-Provide an interrupt vector for handling the counter-overflow interrupt.
-Initialize the APIC PERF local vector entry to enable handling of performance-monitor counter overflow events.
-Provide an entry in the IDT that points to a stub exception handler that returns without executing any instructions.
-Provide an event monitor driver that provides the actual interrupt handler and modifies the reserved IDT entry to point to its interrupt routine.

As I understand it, and correct me if I'm wrong, the first can be done just w/ request_irq(IRQNUMBER, &HANDLER_FUNCTION_NAME, FLAGS, NAME, NULL).
I was told that request_irq should automatically set up the IDT, is that true? (if not, how do you go about setting up the IDT) And finally, how do you initialize the apic local vector entry?

I'm a newb when it comes to kernel and driver programming, so a good reference that gives details and function names would be helpful. I've looked through O'Reilly, and of course a good dea; of googling, looking through code, etc; but most drivers with interrupts that I can understand don't have to deal with setting up specific apic vector entries, nor IDT entries.

Anything would be a great help. A reference, link; or instructions (but please include function names, that has been my biggest difficulty, finding a mention of how to generally do some small part of this with no mention of specifics).

Thanks!
-Dagda

Last edited by Dagda99; 07-27-2004 at 12:36 PM.
 
Old 07-27-2004, 03:45 PM   #2
Dagda99
LQ Newbie
 
Registered: Jul 2004
Posts: 19

Original Poster
Rep: Reputation: 0
Update

Still no ideas? I found the APIC documentation in the Developers Manual V.3. I'm doing some tinkering with that; but answers to the other things would be really helpful. Esp. the ones about the IDT, since I have no clue if request_irq sets that up and haven't found it anywhere.
-Dagda
 
Old 07-27-2004, 06:37 PM   #3
infamous41md
Member
 
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
since nobody else took a stab, i'll try. for grabbing the irq, yes request_irq() is all you need. however, iirc linux already can do all this for you, if u compile in support for it when building kernel. and i found these:
http://www.osc.edu/~troy/lperfex/
http://www.scl.ameslab.gov/Projects/Rabbit/menu4a.html
 
Old 08-02-2004, 06:45 PM   #4
Dagda99
LQ Newbie
 
Registered: Jul 2004
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks, the links helped; and I found another good project at oprofile.sourceforge.net, which has functions set up to request the NMI. Right now I'm trying to #include only those files necessary from the oprofile files, with some modifications, so that I can use the install_nmi, etc. functions. And to do that, I'm having an issue with a .S file, which is a separate problem entirely. I'll post if this path works out.
-Dagda
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
add entry to startup? TomalakBORG SUSE / openSUSE 1 11-22-2005 05:53 PM
local apic disabled slinky2004 Linux - General 4 11-08-2005 12:18 PM
Correct entry for local machine in /etc/hosts Kropotkin Linux - Networking 1 11-16-2004 05:41 PM
To Compile my kernel with Local & IO APIC or not? haimeltjnfg Linux - Software 0 05-31-2004 01:14 PM
Vector Linux : Can ping local network, can't access internet JoeLinux Linux - Networking 7 12-25-2002 10:08 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration