1# /*
2#  * Copyright (C) 2015 The Android Open Source Project
3#  * All rights reserved.
4#  *
5#  * Redistribution and use in source and binary forms, with or without
6#  * modification, are permitted provided that the following conditions
7#  * are met:
8#  *  * Redistributions of source code must retain the above copyright
9#  *    notice, this list of conditions and the following disclaimer.
10#  *  * Redistributions in binary form must reproduce the above copyright
11#  *    notice, this list of conditions and the following disclaimer in
12#  *    the documentation and/or other materials provided with the
13#  *    distribution.
14#  *
15#  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16#  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17#  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18#  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19#  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20#  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21#  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22#  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23#  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24#  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25#  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26#  * SUCH DAMAGE.
27#  */
28
29    .text
30    .align 8
31
32    .global asm_mips_test_jacket
33
34    # // Set the register
35    # // Calls the asm function
36    # // Reads the register values to output register
37
38    # // Parameters
39    # // a0 - Function to jump
40    # // a1 - register values array
41    # // a2 - flag values array
42asm_mips_test_jacket:
43    # // Save registers to stack
44    daddiu $sp, $sp, -96
45    sd  $s0, 64($sp)
46    sd  $s1, 72($sp)
47    sd  $s2, 80($sp)
48    sd  $ra, 88($sp)
49
50    move $s0, $a0
51    move $s1, $a1
52    move $s2, $a2
53
54    ld  $v0, 16($s1)
55    ld  $v1, 24($s1)
56    ld  $a0, 32($s1)
57    ld  $a1, 40($s1)
58    ld  $a2, 48($s1)
59    ld  $a3, 56($s1)
60    ld  $a4, 64($s1)
61    ld  $a5, 72($s1)
62    ld  $a6, 80($s1)
63    ld  $a7, 88($s1)
64    ld  $t0, 96($s1)
65    ld  $t1, 104($s1)
66    ld  $t2, 112($s1)
67    ld  $t3, 120($s1)
68
69    jal $s0
70
71    sd  $v0, 16($s1)
72    sd  $v1, 24($s1)
73    sd  $a0, 32($s1)
74    sd  $a1, 40($s1)
75    sd  $a2, 48($s1)
76    sd  $a3, 56($s1)
77    sd  $a4, 64($s1)
78    sd  $a5, 72($s1)
79    sd  $a6, 80($s1)
80    sd  $a7, 88($s1)
81    sd  $t0, 96($s1)
82    sd  $t1, 104($s1)
83    sd  $t2, 112($s1)
84    sd  $t3, 120($s1)
85
86    ld  $s0, 64($sp)
87    ld  $s1, 72($sp)
88    ld  $s2, 80($sp)
89    ld  $ra, 88($sp)
90
91    daddiu $sp, $sp, 96
92
93    j   $ra
94