Re: [cc65] __IRQFUNC_*__

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2004-09-15 11:19:37
On Wed, Sep 15, 2004 at 10:38:06AM +0200, Adam Dunkels wrote:
> But I don't really know what they do :-)

That is simple: The __IRQFUNC_TABLE__ is a table of function vectors built by
the linker that is called from the interrupt. So a module that wants to add an
interrupt handler does no longer have to chain the IRQ vector, but just
declare the handler function as

        .condes         irq_handler, <priority>

and it will be called as a subroutine in the interrupt. No need to save any
registers, and no need for an RTI.

The feature was added for two reasons:

  * Less overhead, because the code to chain and restore the interrupt is not
    needed any longer. Plus the interrupt handler doesn't need to save and
    restore any registers.

  * Avoid problems with the order of interrupt handlers. When chaining the
    interrupt, the handlers must be removed in the reverse order as they were
    installed. Since loadable modules contain interrupt handlers, these
    handlers - and therefore the modules - must be deinstalled when the module
    is unloaded. But the compiler resp. the runtime cannot guarantee that the
    modules are unloaded in the correct order, and in fact it would be stupid
    to enforce such an unloading order.

Not all platforms support this feature until now, but I expect most platforms
to adopt it sooner or later. If you want to know if your platform supports it,
just check linker config file.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Sep 15 11:19:40 2004

This archive was generated by hypermail 2.1.8 : 2004-09-15 11:19:49 CEST