Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Interruptions on x86 cpus
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
nelsooon
n00b
n00b


Joined: 08 Aug 2004
Posts: 73

PostPosted: Wed May 14, 2008 2:29 pm    Post subject: Interruptions on x86 cpus Reply with quote

Hi all,
Can any one help me to understand the interruption system on linux, on intel based architectures please ?
I need to execute a function that i want by redirecting an IT routine. like 1CH in the vector of interrupt.
example:
I'v done regirect of the SIGINT signal to my function :
Code:

struct sigaction action_ctrlC;

   action_ctrlC.sa_handler = hand_ctrlC;
   sigaction(SIGINT, &action_ctrlC, NULL);


I wanna do the same thing with the IT system of linux (on windows we use getvect() and setvect() of dos.h, to modify the interupt vect)

Some references ? documents or ebooks ?
thanks
Adel
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9892
Location: almost Mile High in the USA

PostPosted: Wed May 14, 2008 8:38 pm    Post subject: Reply with quote

I don't understand what you're trying to do. A bit more details?

sigaction is the interface to software, OS-sourced signals/asynchronous interrupts. This has almost nothing to do with hardware interrupts or even software INTxx calls on the processor(though it may use it underneath). You cannot access the hardware interrupts as a user-level application, if you must tie a hardware interrupt to your software, you would need a kernel module.

My first guess is that IT means "Interval Timer" which isn't clear. However, depending on what you need to do, you don't need to patch into the hardware interrupt and just use kernel provided timer interrupts. The POSIX setitimer() function can be used to create a interval timer for user applications, and optionally run the app as a realtime app to make sure these interrupts don't get lost while context swapped.

This should be portable to all Linux implementations. But this may not have the accuracy you need, again brings back to the point what you're trying to do...

[My cursory check on setvect/getvect seems to imply you're talking about hardware/software interrupt vector tables, which is clearly disallowed for a user-mode application.]
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
nelsooon
n00b
n00b


Joined: 08 Aug 2004
Posts: 73

PostPosted: Thu May 15, 2008 9:44 am    Post subject: Reply with quote

thanks eccerr0r for your response,
I'm talking about the vector of interrupt of the intel architecture.
I have to do just a small example, by derouting an interruption in the vector of interrupt of the system.
When I press CTRL+C keys, the 50h interruption is executed, my routine of interrupt "do some thing", for example write "hello" on /home/test.txt
This is my purpose.
I did that by derouting the SIGINT, that OK.
No I want to do that by using the vector of interrupt of my Intel architecture.
All that in order to understand the difference between interrupt signals (sigint...) and physical interrupt (interrupts of the vector of interrupt).
PS: the meaning of IT was InTerrupt :-) sorry.
thanks
Back to top
View user's profile Send private message
Link31
Apprentice
Apprentice


Joined: 17 Apr 2006
Posts: 200
Location: France

PostPosted: Thu May 15, 2008 10:10 am    Post subject: Re: Interruptions on x86 cpus Reply with quote

nelsooon wrote:
I wanna do the same thing with the IT system of linux (on windows we use getvect() and setvect() of dos.h, to modify the interupt vect)

Hardware interrupts are only accessible from kernel space (ring0, on Linux), or from real mode (on DOS). Maybe you can use them from a 16-bit assembly code on Linux, but it is very unlikely.

In kernel space, this is done by reprogramming the PIC (programmable interrupt controller) in order to tell the hardware to jump to a callback function each time an interrupt occurs. You should have a look at OsDev.org or SOS (in French) if you want to learn kernel programming.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum