From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Larmour To: Aaron Passey Cc: Jesper Skov , ecos-discuss@sources.redhat.com Subject: Re: [ECOS] SH1 port of eCos Date: Mon, 15 Jan 2001 18:40:00 -0000 Message-id: <3A63B48C.A4338AFE@redhat.com> References: <20010115234901.E4E05CC001@ngwee.ugcs.caltech.edu> X-SW-Source: 2001-01/msg00246.html 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