unreviewed m68k patches
Bernardo Innocenti
bernie@develer.com
Sat Oct 11 02:47:00 GMT 2003
Richard Henderson wrote:
>>- Add __attribute__((interrupt_handler))
>> (Not needed for uClinux, useful for embedded developers)
>> http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01262.html
>
> I guess this is ok. It'd be nice if you'd generate a fake
> exception frame when these functions are called directly,
> but I suppose no one actually does that. ;-)
Even in this era of strict compile time checks, whoever
dares calling an interrupt handler in interrupt handler
as it was a normal function deserves what they get :-)
Well, actually I've seen this pattern used in some
embedded programs:
void serial_tx_irq()
{
if (buffer_not_empty)
send_one_byte;
else
sending = false;
}
void serial_putchar(char c)
{
buffer_push(c);
disable_irqs;
if (!sending)
{
sending = true;
serial_tx_irq();
}
enable_irqs;
}
If serial_tx_irq() is given the interrupt_handler attribute,
it's not going to work any more. One would have to resort
to a linux-ism such implementing serial_tx_irq() in terms
of a plain function __serial_tx_irq() and make that
always_inline for efficiency.
Bleah, embedded code sometimes really sucks ;-)
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/
Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html
More information about the Gcc-patches
mailing list