handling interrupts in linux

handling interrupts in linux

Post by dini » Tue, 30 Jul 2002 16:04:52



please help me to learn interrupt handling in linux.
 
 
 

handling interrupts in linux

Post by mjt » Tue, 30 Jul 2002 18:12:19


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message


> please help me to learn interrupt handling in linux.

http://www.oreilly.com/catalog/linuxkernel/
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Michael J. Tobler: motorcyclist, surfer,  #    Black holes result
 skydiver, and author: "Inside Linux",     #   when God divides the  
 "C++ HowTo", "C++ Unleashed"              #     universe by zero

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9RQa8tTveLPAHcDIRAsLEAJ4mxJ1lbAmoDWJ1RAENR5hJ8im+qwCfe610
tdpdKoekeLP78xKR2rOWWaI=
=CcD/
-----END PGP SIGNATURE-----

 
 
 

handling interrupts in linux

Post by c.. » Wed, 31 Jul 2002 03:09:40



> please help me to learn interrupt handling in linux.

'man signal' should get you started.  Before to look at the 'see alsos'
at the end of the man page, and 'man longjmp' might be useful.
Actually, since I was just working on some code with signals, here's
a little example:
Have this function (I'm calling it handleit because it handles the
signal):
void
handleit(int x)
{
        longjmp(env,1);

Quote:}

Then set yourself up to 'catch' the signal, somewhere in the code:
        signal(1,handleit);
        if (setjmp(env))
        {
                printf("got a signal 1\n");
                goto skip;
        }
        for (;;) /* forever, waiting for the signal */
        {
                sleep(1);
        } /* end forever */
skip:
        printf("Escaped the forever loop\n");

There are other system calls to use in place of signal, but this is the
simplest way to do it I know.  You run a program with that piece
of code, note its process id, and issue the command 'kill -1 <pid>'

CAUTION:  I didn't actually try this exact code, so there me be a typo
or other oversight, but it's pretty close to something I wrote recently
that does work.

--
Replace ragwind.loc or bluemouth.loc with rahul for my real email address

 
 
 

handling interrupts in linux

Post by Paul Evan » Wed, 31 Jul 2002 07:47:07


On 29 Jul 2002 11:09:40 -0700


> void
> handleit(int x)
> {
>         longjmp(env,1);
> }

> Then set yourself up to 'catch' the signal, somewhere in the code:
>         signal(1,handleit);
>         if (setjmp(env))
>         {
>                 printf("got a signal 1\n");
>                 goto skip;
>         }
>         for (;;) /* forever, waiting for the signal */
>         {
>                 sleep(1);
>         } /* end forever */
> skip:
>         printf("Escaped the forever loop\n");

Is it just me, or do others find this setjmp/longjmp functions very messy?
It seems to me that it's a rather dodgy hack at adding exception handling
to C... are there not neater alternatives to implement exceptions?

--
Paul Evans


ICQ# 4135350     |  Registered Linux# 179460

 
 
 

handling interrupts in linux

Post by mjt » Wed, 31 Jul 2002 16:35:48


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message



>> void
>> handleit(int x)
[snip]
>>         printf("Escaped the forever loop\n");

> Is it just me, or do others find this setjmp/longjmp functions very messy?
> It seems to me that it's a rather dodgy hack at adding exception handling
> to C... are there not neater alternatives to implement exceptions?

... i'm with you Paul ... set/long-jump has it's place, but for
proper signal handling, you're better off using the POSIX signal
handling funcs, the "sig*" family. start at, "man sigaction"
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Michael J. Tobler: motorcyclist, surfer,  #    Black holes result
 skydiver, and author: "Inside Linux",     #   when God divides the  
 "C++ HowTo", "C++ Unleashed"              #     universe by zero

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9RjWHtTveLPAHcDIRAnXlAJ0aPiy0dC+VL9ESxSUwFDZ4/PJb3ACeM0Q2
nWa6ycByP6PzxnpKjKrZ1oo=
=iN8u
-----END PGP SIGNATURE-----

 
 
 

handling interrupts in linux

Post by Jean-David Beye » Wed, 31 Jul 2002 20:55:57


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

| -----BEGIN PGP SIGNED MESSAGE-----
| Hash: SHA1
| NotDashEscaped: You need GnuPG to verify this message
|
|
|>
|>
|>>void
|>>handleit(int x)
|>
| [snip]
|
|>>        printf("Escaped the forever loop\n");
|>
|>Is it just me, or do others find this setjmp/longjmp functions very messy?
|>It seems to me that it's a rather dodgy hack at adding exception handling
|>to C... are there not neater alternatives to implement exceptions?
|
|
| ... i'm with you Paul ... set/long-jump has it's place, but for
| proper signal handling, you're better off using the POSIX signal
| handling funcs, the "sig*" family. start at, "man sigaction"

You sometimes need setjump and longjump, but they have been a pain ever
since they were introduced. When I was working on optimizers for C and
C++, the ambiguities in their definitions were a curse, since the
optimized code was required to be logically equivalent to the
unoptimized code (of course). But the definitions were not such as to
make it possible to know.

It was not sufficient to merely test the code, since the code to be
tested may have been invalid, and an optimizer is not required to return
the same undefined values from wrong code as unoptimized code. But when
you do not even know what the requirements mean, it is really
impossible. I stopped working on optimizers at the end of 1989, so they
may have fixed the definitions since then, but I doubt it.

- --
~  .~.  Jean-David Beyer           Registered Linux User 85642.
~  /V\                             Registered Machine    73926.
~ /( )\ Shrewsbury, New Jersey     http://counter.li.org
~ ^^-^^ 7:50am up 5 days, 18:26, 2 users, load average: 2.08, 2.20, 2.18
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9Rn7MPtu2XpovyZoRAqt7AKC1kCuflZc+CTJ8cA3iNlyce50qWgCgwcpb
1e9oiJQ64KvmMQ+BBYTZ+fg=
=mSaY
-----END PGP SIGNATURE-----

 
 
 

1. How to generate/handle software interrupt on alpha/linux?

Hi, all:
    I am in the process porting a software from i386/linux to
Alpha-linux. In the code software interrupt (0x81)
    is used to allow transition from user mode to kernel mode. I have
some ideas how all these work on an intel
    based platform (IDT and so on). I wonder whether I can (how) do the
very same thing on alpha linux platform.
    Do I have to do this by calling PAL code? Any examples,
documentation? Thanks in advance.

--
#####################################################
Jie Chen
Thomas Jefferson National Accelerator Facility
12000, Jefferson Ave.
Newport News, VA 23606

(757)269-5046 (office) (757)269-5279 (fax)

#####################################################

2. Bug in ldconfig

3. Handling Interrupts on LINUX

4. mkfs question

5. Hardware interrupt handling in Linux

6. linux dymo labelwriter 320/330

7. hardware interrupt handling in linux

8. clean up directory structure

9. Linux Interrupt handling

10. Interrupt handling with linux (robotics application)

11. Interrupt handling in Linux

12. interrupt handling in linux driver programming

13. linux and interrupt handling - ??