1 # MIPS simulator testsuite utility functions.
2 # Copyright (C) 2004-2024 Free Software Foundation, Inc.
3 # Contributed by Chris Demetriou of Broadcom Corporation.
5 # This file is part of the GNU simulators.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 # $1, $4, $5, %6, are used as temps by the macros defined here.
38 # The MIPS simulator uses "break 0x3ff" as the code to exit,
39 # with the return value in $4 (a0).
74 # The MIPS simulator can use multiple different monitor types,
75 # so we hard-code the simulator "write" reserved instruction opcode,
76 # rather than jumping to a vector that invokes it. The operation
77 # expects RA to point to the location at which to continue
82 # Write opcode (reserved instruction). See sim_monitor and its
83 # callers in sim/mips/interp.c.
84 .word 0x00000039 | ((8 << 1) << 6)
108 .macro load32 reg, val
113 .macro load64 reg, val
118 .macro loadaddr reg, addr
123 .macro checkreg reg, expreg
127 beq \expreg, \reg, 901f
135 .macro check32 reg, val
144 .macro check64 reg, val
153 # Check hi-lo register pair against data stored at base+o1 and base+o2
155 .macro checkpair lo, hi, base, w, o1, o2
167 .macro checkpair_le_d lo, hi, base
168 checkpair \lo, \hi, \base, w, 0, 4
171 .macro checkpair_be_d lo, hi, base
172 checkpair \lo, \hi, \base, w, 4, 0
175 .macro checkpair_le_q lo, hi, base
176 checkpair \lo, \hi, \base, d, 0, 8
179 .macro checkpair_be_q lo, hi, base
180 checkpair \lo, \hi, \base, d, 8, 0
183 # Endian-ness for comparison is determined by reading a word at ec
184 .macro checkpair_xendian lo, hi, base, ec, w
192 checkpair_be_\w \lo, \hi, \base
195 checkpair_le_\w \lo, \hi, \base
199 .macro checkpair_qword lo, hi, base, oe
200 checkpair_xendian \lo, \hi, \base, \oe, q
203 .macro checkpair_dword lo, hi, base, oe
204 checkpair_xendian \lo, \hi, \base, \oe, d