This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


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

Re: SH1 port of eCos


Aaron Passey wrote:
> You have one nice interrupt routine and another exception routine.  I need
> potentially 256 copies of this routine.  I could do this with a bunch of
> macros and a lot of code duplication (not pretty) or possibly have a macro
> that saves a little bit of state, calls another routine to save the rest,
> and then jumps to the right ISR.  I have to think about this a little bit
> more.

I don't know the details here, but I think certain GAS constructs may be
useful in this, e.g. paraphrased from the v850 vectors.S

	.macro INTERRUPT
        .org    reset_vector+(0x0010*VECTOR)
        addi    -CYGARC_EXCEPTION_FRAME_SIZE,sp,sp
        st.w    r1,CYGARC_REG_R1[sp]
        movea   VECTOR,r0,r1
        jr      exception
 	.set VECTOR, VECTOR+1
	.endm

and then later:

	.set VECTOR, 8
	.rept CYGNUM_HAL_ISR_COUNT
	INTERRUPT
	.endr

Do you see what this does and how it does it? A small preamble that
identifies the vector in a register, followed by a jump. And all contained
in a macro in a way that is clean, even though CYGNUM_HAL_ISR_COUNT is very
large on the v850, like the SH1.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Un cheval, pas du glue. Pas du cheval, beaucoup du glue. || Opinions==mine

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