[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] TimerA interrupt handler



On 04/01/2013 08:40, Markus Fröschle wrote:
Depending on target architecture, gcc also saves and restores the math
coprocessor scratch registers (FP0-FP1) which might or might not be what
you want.

Indeed, you are right!

First, a precision: with __attribute__ ((interrupt)), GCC backups all the registers *modified* by the function. If it can be sure that some registers are not modified, they are not backuped. So no useless backup is done.

If the function calls another external function, then potentially all the scratch registers are trashed. In that case, all the scratch registers are backuped.

Markus is totally right, when compiling with -m68000 (the default), only the standard registers are automatically backuped by __attribute__ ((interrupt)). When compiling with -m68020-60 or -mcpu=5475, the FPU registers are also backuped (namely, fp0/fp1). Since such executables are anyway expected on a machine with FPU, this should never hurt...

Anyway, I agree that such compiler dependent features are dangerous when we don't know exactly what happens behind the scenes. Looking at the generated assembler code is always a good practice.

--
Vincent Rivière