2 * SPDX-License-Identifier: BSD-1-Clause
4 * Copyright 2019 Justin Hibbits
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 #include <machine/asm.h>
25 __FBSDID("$FreeBSD$");
30 * The PowerPC ABI spec requires the following save/restore functions to be
40 * With N ranging from 14 to 31, to save the nonvolatile registers.
43 #define _CRTENTRY(name) \
46 .type name,@function; \
49 #define SAVEFPR(r) _CRTENTRY(__CONCAT(_savefpr_,r)) \
50 stfd r,(-256 + r * 8)(11)
72 #define RESTFPR(r) _CRTENTRY(__CONCAT(_restfpr_,r)) \
73 lfd r,(-256 + r * 8)(11)
95 #define SAVEGPR(r) _CRTENTRY(__CONCAT(_savegpr_,r)) \
96 stfd r,(-128 + r*4)(11)
118 #define RESTGPR(r) _CRTENTRY(__CONCAT(_restgpr_,r)) \
119 lwz r,(-128 + r*4)(11)
141 #define RESTFPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restfpr_,r),_x)) \
142 lfd r,(-256 + r * 8)(11)
167 #define RESTGPR_X(r) _CRTENTRY(__CONCAT(__CONCAT(_restgpr_,r),_x)) \
168 lwz r,(-128 + r*4)(11)