OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [machine/] [spu/] [spu_timer_flih.S] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
/*
/*
(C) Copyright IBM Corp. 2008
(C) Copyright IBM Corp. 2008
All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
documentation and/or other materials provided with the distribution.
* Neither the name of IBM nor the names of its contributors may be
* Neither the name of IBM nor the names of its contributors may be
used to endorse or promote products derived from this software without
used to endorse or promote products derived from this software without
specific prior written permission.
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
*/
*/
/*  First-level interrupt handler.  */
/*  First-level interrupt handler.  */
/* The following two convenience macros assist in the coding of the
/* The following two convenience macros assist in the coding of the
   saving and restoring the volatile register starting from register
   saving and restoring the volatile register starting from register
   2 up to register 79.
   2 up to register 79.
   saveregs     first, last    Saves registers from first to the last.
   saveregs     first, last    Saves registers from first to the last.
   restoreregs  first, last    Restores registers from last down to first.
   restoreregs  first, last    Restores registers from last down to first.
   Note:       first must be less than or equal to last.  */
   Note:       first must be less than or equal to last.  */
.macro  saveregs        first, last
.macro  saveregs        first, last
        stqd            $\first, -(STACK_SKIP+\first)*16($SP)
        stqd            $\first, -(STACK_SKIP+\first)*16($SP)
.if     \last-\first
.if     \last-\first
        saveregs        "(\first+1)",\last
        saveregs        "(\first+1)",\last
.endif
.endif
.endm
.endm
.macro  restoreregs     first, last
.macro  restoreregs     first, last
        lqd             $\last, (82-\last)*16($SP)
        lqd             $\last, (82-\last)*16($SP)
.if     \last-\first
.if     \last-\first
        restoreregs     \first,"(\last-1)"
        restoreregs     \first,"(\last-1)"
.endif
.endif
.endm
.endm
        .section        .interrupt,"ax"
        .section        .interrupt,"ax"
        .align          3
        .align          3
        .type           spu_flih, @function
        .type           spu_flih, @function
spu_flih:
spu_flih:
        /* Adjust the stack pointer to skip the maximum register save area
        /* Adjust the stack pointer to skip the maximum register save area
           (STACK_SKIP quadword registers) in case an interrupt occurred while
           (STACK_SKIP quadword registers) in case an interrupt occurred while
           executing a leaf function that used the stack area without actually
           executing a leaf function that used the stack area without actually
           allocating its own stack frame.  */
           allocating its own stack frame.  */
        .set            STACK_SKIP, 125
        .set            STACK_SKIP, 125
        /* Save the current link register on a new stack frame for the
        /* Save the current link register on a new stack frame for the
           normal spu_flih() version of this file.  */
           normal spu_flih() version of this file.  */
        stqd            $0,  -(STACK_SKIP+80)*16($SP)
        stqd            $0,  -(STACK_SKIP+80)*16($SP)
        stqd            $SP, -(STACK_SKIP+82)*16($SP)   /* Save back chain pointer.  */
        stqd            $SP, -(STACK_SKIP+82)*16($SP)   /* Save back chain pointer.  */
        saveregs        2, 39
        saveregs        2, 39
        il              $2,  -(STACK_SKIP+82)*16        /* Stack frame size.  */
        il              $2,  -(STACK_SKIP+82)*16        /* Stack frame size.  */
        rdch            $3, $SPU_RdEventStat            /* Read event status.  */
        rdch            $3, $SPU_RdEventStat            /* Read event status.  */
        rdch            $6, $SPU_RdEventMask            /* Read event mask.  */
        rdch            $6, $SPU_RdEventMask            /* Read event mask.  */
        hbrp                                            /* Open a slot for instruction prefetch.  */
        hbrp                                            /* Open a slot for instruction prefetch.  */
        saveregs        40,59
        saveregs        40,59
        clz             $4, $3                          /* Get first slih index.  */
        clz             $4, $3                          /* Get first slih index.  */
        stqd            $6,  -(STACK_SKIP+1)*16($SP)    /* Save event mask on stack.  */
        stqd            $6,  -(STACK_SKIP+1)*16($SP)    /* Save event mask on stack.  */
        saveregs        60, 67
        saveregs        60, 67
        /* Do not disable/ack the decrementer event here.
        /* Do not disable/ack the decrementer event here.
           The timer library manages this and expects it
           The timer library manages this and expects it
           to be enabled upon entry to the SLIH. */
           to be enabled upon entry to the SLIH. */
        il              $7, 0x20
        il              $7, 0x20
        andc            $5, $3, $7
        andc            $5, $3, $7
        andc            $7, $6, $5                      /* Clear event bits.  */
        andc            $7, $6, $5                      /* Clear event bits.  */
        saveregs        68, 69
        saveregs        68, 69
        wrch            $SPU_WrEventAck, $3             /* Ack events(s) - include decrementer event.  */
        wrch            $SPU_WrEventAck, $3             /* Ack events(s) - include decrementer event.  */
        wrch            $SPU_WrEventMask, $7            /* Disable event(s) - exclude decrementer event.  */
        wrch            $SPU_WrEventMask, $7            /* Disable event(s) - exclude decrementer event.  */
        saveregs        70, 79
        saveregs        70, 79
        a               $SP, $SP, $2                    /* Instantiate flih stack frame.  */
        a               $SP, $SP, $2                    /* Instantiate flih stack frame.  */
next_event:
next_event:
        /* Fetch and dispatch the event handler for the first non-zero event. The
        /* Fetch and dispatch the event handler for the first non-zero event. The
           dispatch handler is indexed into the __spu_slih_handlers array using the
           dispatch handler is indexed into the __spu_slih_handlers array using the
           count of zero off the event status as an index.  */
           count of zero off the event status as an index.  */
        ila             $5, __spu_slih_handlers         /* Slih array offset.  */
        ila             $5, __spu_slih_handlers         /* Slih array offset.  */
        shli            $4, $4, 2                       /* Slih entry offset.  */
        shli            $4, $4, 2                       /* Slih entry offset.  */
        lqx             $5, $4, $5                      /* Load slih address.  */
        lqx             $5, $4, $5                      /* Load slih address.  */
        rotqby          $5, $5, $4                      /* Rotate to word 0.  */
        rotqby          $5, $5, $4                      /* Rotate to word 0.  */
        bisl            $0, $5                          /* Branch to slih.  */
        bisl            $0, $5                          /* Branch to slih.  */
        clz             $4, $3                          /* Get next slih index.  */
        clz             $4, $3                          /* Get next slih index.  */
        brnz            $3, next_event
        brnz            $3, next_event
        lqd             $2, 81*16($SP)                  /* Read event mask from stack.  */
        lqd             $2, 81*16($SP)                  /* Read event mask from stack.  */
        restoreregs     40, 79
        restoreregs     40, 79
        wrch            $SPU_WrEventMask, $2            /* Restore event mask.  */
        wrch            $SPU_WrEventMask, $2            /* Restore event mask.  */
        hbrp                                            /* Open a slot for instruction pre-fetch.  */
        hbrp                                            /* Open a slot for instruction pre-fetch.  */
        restoreregs     2, 39
        restoreregs     2, 39
        /* Restore the link register from the new stack frame for the
        /* Restore the link register from the new stack frame for the
           normal spu_flih() version of this file.  */
           normal spu_flih() version of this file.  */
        lqd             $0,  2*16($SP)
        lqd             $0,  2*16($SP)
        lqd             $SP, 0*16($SP)                 /* restore stack pointer from back chain ptr.  */
        lqd             $SP, 0*16($SP)                 /* restore stack pointer from back chain ptr.  */
        irete                                          /* Return from interrupt and re-enable interrupts.  */
        irete                                          /* Return from interrupt and re-enable interrupts.  */
        .size           spu_flih, .-spu_flih
        .size           spu_flih, .-spu_flih
/* spu_slih_handlers[]
/* spu_slih_handlers[]
   Here we initialize 33 default event handlers.  The first entry in this array
   Here we initialize 33 default event handlers.  The first entry in this array
   corresponds to the event handler for the event associated with bit 0 of
   corresponds to the event handler for the event associated with bit 0 of
   Channel 0 (External Event Status).  The 32nd entry in this array corresponds
   Channel 0 (External Event Status).  The 32nd entry in this array corresponds
   to bit 31 of Channel 0 (DMA Tag Status Update Event).  The 33rd entry in
   to bit 31 of Channel 0 (DMA Tag Status Update Event).  The 33rd entry in
   this array is a special case entry to handle "phantom events" which occur
   this array is a special case entry to handle "phantom events" which occur
   when the channel count for Channel 0 is 1, causing an asynchronous SPU
   when the channel count for Channel 0 is 1, causing an asynchronous SPU
   interrupt, but the value returned for a read of Channel 0 is 0.  The index
   interrupt, but the value returned for a read of Channel 0 is 0.  The index
   calculated into this array by spu_flih() for this case is 32, hence the
   calculated into this array by spu_flih() for this case is 32, hence the
   33rd entry.  */
   33rd entry.  */
.data
.data
        .align  4
        .align  4
        .extern __spu_default_slih
        .extern __spu_default_slih
        .global __spu_slih_handlers
        .global __spu_slih_handlers
        .type   __spu_slih_handlers, @object
        .type   __spu_slih_handlers, @object
__spu_slih_handlers:
__spu_slih_handlers:
        .rept 33
        .rept 33
        .long   __spu_default_slih
        .long   __spu_default_slih
        .endr
        .endr
        .size   __spu_slih_handlers, .-__spu_slih_handlers
        .size   __spu_slih_handlers, .-__spu_slih_handlers
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.