This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: unreviewed m68k patches
- From: Bernardo Innocenti <bernie at develer dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 11 Oct 2003 04:47:53 +0200
- Subject: Re: unreviewed m68k patches
- Organization: Develer S.r.l.
- References: <3F806385.9010706@develer.com> <20031011003256.GV19470@redhat.com>
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