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


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

Re: GCC 2.8.1 for PowerPC/EABI: interrupt handler




Mark Naumann <naumann@wagoner> writes:
  > 
  > Yaroslav:
  > 
  > Which processor are you using?  For the 603e, here is the minimal code
  > needed in the interrupt vector to call an EABI handler...
  > 
  > 	.org	EVT_EXT_INT
  > 	# Interrupts are disabled at this point.
  > 	
  > 	# create an isr stack frame before calling C function
  > 	stwu	r1,-16(r1)
  > 	stw	r0,12(r1)	# save r0
  > 	mflr	r0
  > 	stw	r0,20(r1)	# save lr
  > 	bl	_int_isr
  > 	# unwind isr stack frame
  > 	lwz	r0,20(r1)	# restore lr
  > 	mtlr	r0
  > 	lwz	r0,12(r1)	# restore r0
  > 	addi	r1,r1,16
  > 	rfi
  > 

That last email was sent before I was finished...

This assumes that the interrupt stack can be put on top of the current
user stack.  If this is not the case, you need to also save r1 (the
user's stack pointer) change to the system interrupt stack pointer, then
call the C-function to handle the interrupt, "void _int_isr(void)".  The
_int_isr() function should return, so that this routine can restore
registers and do the return from interrupt instruction.

Mark