[1] | 1 | # This file is part of MutekP. |
---|
| 2 | |
---|
| 3 | # MutekP is free software; you can redistribute it and/or modify it |
---|
| 4 | # under the terms of the GNU General Public License as published by |
---|
| 5 | # the Free Software Foundation; either version 2 of the License, or |
---|
| 6 | # (at your option) any later version. |
---|
| 7 | |
---|
| 8 | # MutekP is distributed in the hope that it will be useful, but |
---|
| 9 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 11 | # General Public License for more details. |
---|
| 12 | |
---|
| 13 | # You should have received a copy of the GNU General Public License |
---|
| 14 | # along with MutekP; if not, write to the Free Software Foundation, |
---|
| 15 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 16 | |
---|
| 17 | # UPMC / LIP6 / SOC (c) 2007 |
---|
| 18 | # Copyright Ghassan Almaless <ghassan.almaless@gmail.com> |
---|
| 19 | # Copyright Franck Wajsbürt <franck.wajsburt@lip6.fr> |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #------------------------------------------------------- |
---|
| 24 | # __setjmp: |
---|
| 25 | # save of current function context. |
---|
| 26 | # arguments: |
---|
| 27 | # $4: struct __jmp_buffer_s *buff |
---|
| 28 | #------------------------------------------------------- |
---|
| 29 | .section .text,"ax", @progbits |
---|
| 30 | .align 2 |
---|
| 31 | .globl __setjmp |
---|
| 32 | .ent __setjmp |
---|
| 33 | |
---|
| 34 | __setjmp: |
---|
| 35 | sw $16, 0*4($4) |
---|
| 36 | sw $17, 1*4($4) |
---|
| 37 | sw $18, 2*4($4) |
---|
| 38 | sw $19, 3*4($4) |
---|
| 39 | sw $20, 4*4($4) |
---|
| 40 | sw $21, 5*4($4) |
---|
| 41 | sw $22, 6*4($4) |
---|
| 42 | sw $23, 7*4($4) |
---|
| 43 | sw $28, 8*4($4) |
---|
| 44 | sw $29, 9*4($4) |
---|
| 45 | sw $30, 10*4($4) |
---|
| 46 | sw $31, 11*4($4) |
---|
| 47 | xor $2, $2, $2 |
---|
| 48 | jr $31 |
---|
| 49 | .end __setjmp |
---|
| 50 | |
---|
| 51 | #------------------------------------------------------- |
---|
| 52 | # __longjmp |
---|
| 53 | # resume previously saved context |
---|
| 54 | # arguments: |
---|
| 55 | # $4: struct __jmp_buffer_s *buff |
---|
| 56 | # $5: val |
---|
| 57 | #------------------------------------------------------- |
---|
| 58 | .section .text,"ax", @progbits |
---|
| 59 | .align 2 |
---|
| 60 | |
---|
| 61 | .globl __longjmp |
---|
| 62 | .ent __longjmp |
---|
| 63 | |
---|
| 64 | __longjmp: |
---|
| 65 | .set noreorder |
---|
| 66 | lw $16, 0*4($4) |
---|
| 67 | lw $17, 1*4($4) |
---|
| 68 | lw $18, 2*4($4) |
---|
| 69 | lw $19, 3*4($4) |
---|
| 70 | lw $20, 4*4($4) |
---|
| 71 | lw $21, 5*4($4) |
---|
| 72 | lw $22, 6*4($4) |
---|
| 73 | lw $23, 7*4($4) |
---|
| 74 | lw $28, 8*4($4) |
---|
| 75 | lw $29, 9*4($4) # get stack ptr |
---|
| 76 | lw $31, 11*4($4) |
---|
| 77 | bnez $5, __jmp_next |
---|
| 78 | or $2, $0, $5 |
---|
| 79 | ori $2, $0, 1 |
---|
| 80 | __jmp_next: |
---|
| 81 | jr $31 |
---|
| 82 | lw $30, 10*4($4) |
---|
| 83 | .set reorder |
---|
| 84 | .end __longjmp |
---|
| 85 | |
---|
| 86 | #------------------------------------------------------- |
---|