This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: m68k attribute interrupt


Unfortunetly I have discovered a problem with your patch. If an interrupt
routine does nothing but call a function with a constant parameter, the
scratch registers (d0/d1/a0/a1) are not saved, however the stack pointer is
(which seems a bit redundant anyhow). Here is a simple test case and the 
code it generates:( gcc -m68000 -O2 -fomit-frame-pointers -g )

	#define INTERRUPT __attribute__ ((interrupt))

	volatile char *p;

	void AnotherFunction( char b )
	{
	  p = b;
	  *p = 0x00;
	}

	void INTERRUPT TestInt( void )
	{
	  AnotherFunction( 0xf8 );
	}

The output from this is as follows:(using objdump)

00000000 <AnotherFunction>:
   0:   102f 0007       moveb %sp@(7),%d0
   4:   4880            extw %d0
   6:   3040            moveaw %d0,%a0
   8:   23c8 0000 0000  movel %a0,0 <AnotherFunction>
   e:   10bc 0000       moveb #0,%a0@
  12:   4e75            rts
  14:   4e71            nop

00000016 <TestInt>:
  16:   2f0f            movel %sp,%sp@-
  18:   4878 fff8       pea fffffff8 <.stabstr+0xfffffe20>
  1c:   4eb9 0000 0000  jsr 0 <AnotherFunction>
  22:   588f            addql #4,%sp
  24:   2e5f            moveal %sp@+,%sp
  26:   4e73            rte

As you can see, TestInt only touches the stack pointer, so this is the only
register saved (is this needed?) . AnotherFunction uses d0 and a0 which have

not been saved because TestInt did not know about it.
I'm not sure what can be done about this...any ideas?

cheers.
paul.


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]