Thread: Help with interrupt handler

  1. #1
    Registered User
    Join Date
    Jul 2008

    Help with interrupt handler

    Hi everyone,

    What does this attribute do?

    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:

    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.


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Compile the code with gcc -S
    Then study the assembler.
    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. Can't pin down bug related to timer interrupt handler.
    By jalnewbie in forum C Programming
    Replies: 2
    Last Post: 11-21-2006, 02:05 PM
  2. How's interrupt handler?
    By lchunr in forum A Brief History of
    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
    Replies: 1
    Last Post: 01-07-2002, 07:06 PM