Thread: Help with interrupt handler

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    52

    Help with interrupt handler

    Hi everyone,

    What does this attribute do?

    Code:
    void __attribute__ ((interrupt)) context_switch (void)
    {
    ...
    }
    What I undrestand is that it basically does a return from interrupt (rti) assembly instruction for you.

    so this would be the same:

    Code:
    void context_switch (void)
    {
    ...
     volatile asm ("rti")
    }
    When I try this though! I get a program stopped with signal 4 error

    So the __attribute__ ((interrupt)) must be doing more than an RTI instruction to return where it was.

    Any help appreciated.

    Ted

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,059
    Shouldn't that inline assembly instruction be
    Code:
    asm volatile ("rti");

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with interrupt handler
    By afflictedd2 in forum C Programming
    Replies: 1
    Last Post: 02-17-2010, 03:47 PM
  2. How's interrupt handler?
    By lchunr in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 03-22-2003, 09:10 PM
  3. interrupt handler functions in Visual C++ 6.0
    By scromer in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 01-07-2002, 07:06 PM