URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [machine/] [spu/] [spu_timer_flih.S] - Rev 419
Go to most recent revision | Compare with Previous | Blame | View Log
/*(C) Copyright IBM Corp. 2008All rights reserved.Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met:* Redistributions of source code must retain the above copyright notice,this list of conditions and the following disclaimer.* Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in thedocumentation and/or other materials provided with the distribution.* Neither the name of IBM nor the names of its contributors may beused to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BELIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OFSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESSINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE.*//* First-level interrupt handler. *//* The following two convenience macros assist in the coding of thesaving and restoring the volatile register starting from register2 up to register 79.saveregs first, last Saves registers from first to the last.restoreregs first, last Restores registers from last down to first.Note: first must be less than or equal to last. */.macro saveregs first, laststqd $\first, -(STACK_SKIP+\first)*16($SP).if \last-\firstsaveregs "(\first+1)",\last.endif.endm.macro restoreregs first, lastlqd $\last, (82-\last)*16($SP).if \last-\firstrestoreregs \first,"(\last-1)".endif.endm.section .interrupt,"ax".align 3.type spu_flih, @functionspu_flih:/* Adjust the stack pointer to skip the maximum register save area(STACK_SKIP quadword registers) in case an interrupt occurred whileexecuting a leaf function that used the stack area without actuallyallocating its own stack frame. */.set STACK_SKIP, 125/* Save the current link register on a new stack frame for thenormal spu_flih() version of this file. */stqd $0, -(STACK_SKIP+80)*16($SP)stqd $SP, -(STACK_SKIP+82)*16($SP) /* Save back chain pointer. */saveregs 2, 39il $2, -(STACK_SKIP+82)*16 /* Stack frame size. */rdch $3, $SPU_RdEventStat /* Read event status. */rdch $6, $SPU_RdEventMask /* Read event mask. */hbrp /* Open a slot for instruction prefetch. */saveregs 40,59clz $4, $3 /* Get first slih index. */stqd $6, -(STACK_SKIP+1)*16($SP) /* Save event mask on stack. */saveregs 60, 67/* Do not disable/ack the decrementer event here.The timer library manages this and expects itto be enabled upon entry to the SLIH. */il $7, 0x20andc $5, $3, $7andc $7, $6, $5 /* Clear event bits. */saveregs 68, 69wrch $SPU_WrEventAck, $3 /* Ack events(s) - include decrementer event. */wrch $SPU_WrEventMask, $7 /* Disable event(s) - exclude decrementer event. */saveregs 70, 79a $SP, $SP, $2 /* Instantiate flih stack frame. */next_event:/* Fetch and dispatch the event handler for the first non-zero event. Thedispatch handler is indexed into the __spu_slih_handlers array using thecount of zero off the event status as an index. */ila $5, __spu_slih_handlers /* Slih array offset. */shli $4, $4, 2 /* Slih entry offset. */lqx $5, $4, $5 /* Load slih address. */rotqby $5, $5, $4 /* Rotate to word 0. */bisl $0, $5 /* Branch to slih. */clz $4, $3 /* Get next slih index. */brnz $3, next_eventlqd $2, 81*16($SP) /* Read event mask from stack. */restoreregs 40, 79wrch $SPU_WrEventMask, $2 /* Restore event mask. */hbrp /* Open a slot for instruction pre-fetch. */restoreregs 2, 39/* Restore the link register from the new stack frame for thenormal spu_flih() version of this file. */lqd $0, 2*16($SP)lqd $SP, 0*16($SP) /* restore stack pointer from back chain ptr. */irete /* Return from interrupt and re-enable interrupts. */.size spu_flih, .-spu_flih/* spu_slih_handlers[]Here we initialize 33 default event handlers. The first entry in this arraycorresponds to the event handler for the event associated with bit 0 ofChannel 0 (External Event Status). The 32nd entry in this array correspondsto bit 31 of Channel 0 (DMA Tag Status Update Event). The 33rd entry inthis array is a special case entry to handle "phantom events" which occurwhen the channel count for Channel 0 is 1, causing an asynchronous SPUinterrupt, but the value returned for a read of Channel 0 is 0. The indexcalculated into this array by spu_flih() for this case is 32, hence the33rd entry. */.data.align 4.extern __spu_default_slih.global __spu_slih_handlers.type __spu_slih_handlers, @object__spu_slih_handlers:.rept 33.long __spu_default_slih.endr.size __spu_slih_handlers, .-__spu_slih_handlers
Go to most recent revision | Compare with Previous | Blame | View Log
