[444] | 1 | /* |
---|
| 2 | * Copyright (c) 2011 Aeroflex Gaisler |
---|
| 3 | * |
---|
| 4 | * BSD license: |
---|
| 5 | * |
---|
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
| 7 | * of this software and associated documentation files (the "Software"), to deal |
---|
| 8 | * in the Software without restriction, including without limitation the rights |
---|
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
| 10 | * copies of the Software, and to permit persons to whom the Software is |
---|
| 11 | * furnished to do so, subject to the following conditions: |
---|
| 12 | * |
---|
| 13 | * The above copyright notice and this permission notice shall be included in |
---|
| 14 | * all copies or substantial portions of the Software. |
---|
| 15 | * |
---|
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
| 22 | * THE SOFTWARE. |
---|
| 23 | */ |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | #include <asm-leon/head.h> |
---|
| 27 | |
---|
| 28 | .section .text |
---|
| 29 | /* ------- */ |
---|
| 30 | .weak _cleanregs_custom_weak |
---|
| 31 | .set _cleanregs_custom_weak,_cleanregs_donothing |
---|
| 32 | /* ------- */ |
---|
| 33 | .global _cleanregs_libgloss |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | _cleanregs_donothing: |
---|
| 37 | _cleanregs_libgloss: |
---|
| 38 | retl |
---|
| 39 | nop |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | #define NUMREGWINDOWS 8 |
---|
| 43 | |
---|
| 44 | //_cleanregs_libgloss: |
---|
| 45 | |
---|
| 46 | !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
---|
| 47 | ! initialize regs with values |
---|
| 48 | //#define REGINIT |
---|
| 49 | #ifdef REGINIT |
---|
| 50 | |
---|
| 51 | mov %psr, %g3 |
---|
| 52 | mov %wim, %g4 |
---|
| 53 | mov %sp, %g5 |
---|
| 54 | mov %fp, %g6 |
---|
| 55 | mov %o7, %g7 |
---|
| 56 | mov %g0, %wim |
---|
| 57 | set 0, %g1 |
---|
| 58 | andn %g3,0x1f,%l0 |
---|
| 59 | mov %l0,%psr |
---|
| 60 | nop; nop; nop |
---|
| 61 | |
---|
| 62 | 3: set 0x0001,%i0 |
---|
| 63 | set 0x0101,%i1 |
---|
| 64 | set 0x0201,%i2 |
---|
| 65 | set 0x0301,%i3 |
---|
| 66 | set 0x0401,%i4 |
---|
| 67 | set 0x0501,%i5 |
---|
| 68 | set 0x0601,%i6 |
---|
| 69 | set 0x0701,%i7 |
---|
| 70 | set 0x0801,%l0 |
---|
| 71 | set 0x0901,%l1 |
---|
| 72 | set 0x1001,%l2 |
---|
| 73 | set 0x1101,%l3 |
---|
| 74 | set 0x1201,%l4 |
---|
| 75 | set 0x1301,%l5 |
---|
| 76 | set 0x1401,%l6 |
---|
| 77 | set 0x1501,%l7 |
---|
| 78 | or %g1,%i0,%i0 |
---|
| 79 | or %g1,%i1,%i1 |
---|
| 80 | or %g1,%i2,%i2 |
---|
| 81 | or %g1,%i3,%i3 |
---|
| 82 | or %g1,%i4,%i4 |
---|
| 83 | or %g1,%i5,%i5 |
---|
| 84 | or %g1,%i6,%i6 |
---|
| 85 | or %g1,%i7,%i7 |
---|
| 86 | or %g1,%l0,%l0 |
---|
| 87 | or %g1,%l1,%l1 |
---|
| 88 | or %g1,%l2,%l2 |
---|
| 89 | or %g1,%l3,%l3 |
---|
| 90 | or %g1,%l4,%l4 |
---|
| 91 | or %g1,%l5,%l5 |
---|
| 92 | or %g1,%l6,%l6 |
---|
| 93 | or %g1,%l7,%l7 |
---|
| 94 | restore |
---|
| 95 | set 0x10000,%g2 |
---|
| 96 | add %g1,%g2,%g1 |
---|
| 97 | set NUMREGWINDOWS*0x10000,%g2 |
---|
| 98 | cmp %g1,%g2 |
---|
| 99 | bne 3b |
---|
| 100 | nop |
---|
| 101 | |
---|
| 102 | mov %g4,%wim |
---|
| 103 | nop; nop; nop; |
---|
| 104 | mov %g3,%psr |
---|
| 105 | nop; nop; nop; |
---|
| 106 | mov %g5, %sp |
---|
| 107 | mov %g6, %fp |
---|
| 108 | |
---|
| 109 | #endif |
---|
| 110 | !'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
---|
| 111 | |
---|
| 112 | jmpl %g7+8,%g0 |
---|
| 113 | nop |
---|
| 114 | |
---|