1/* This file contains the floating-point save and restore routines. 2 * 3 * Copyright (C) 2004 Free Software Foundation, Inc. 4 * 5 * This file is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the 7 * Free Software Foundation; either version 2, or (at your option) any 8 * later version. 9 * 10 * In addition to the permissions in the GNU General Public License, the 11 * Free Software Foundation gives you unlimited permission to link the 12 * compiled version of this file with other programs, and to distribute 13 * those programs without any restriction coming from the use of this 14 * file. (The General Public License restrictions do apply in other 15 * respects; for example, they cover modification of the file, and 16 * distribution when not linked into another program.) 17 * 18 * This file is distributed in the hope that it will be useful, but 19 * WITHOUT ANY WARRANTY; without even the implied warranty of 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 * General Public License for more details. 22 * 23 * You should have received a copy of the GNU General Public License 24 * along with this program; see the file COPYING. If not, write to 25 * the Free Software Foundation, 51 Franklin Street, Fifth Floor, 26 * Boston, MA 02110-1301, USA. 27 * 28 * As a special exception, if you link this library with files 29 * compiled with GCC to produce an executable, this does not cause the 30 * resulting executable to be covered by the GNU General Public License. 31 * This exception does not however invalidate any other reasons why the 32 * executable file might be covered by the GNU General Public License. 33 */ 34 35/* THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE 36 ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31, 37 for example. For FP reg saves/restores, it takes one instruction 38 (4 bytes) to do the operation; for Vector regs, 2 instructions are 39 required (8 bytes.) 40 41 MORAL: DO NOT MESS AROUND WITH THESE FUNCTIONS! */ 42 43#include "darwin-asm.h" 44 45.text 46 .align 2 47 48/* saveFP saves R0 -- assumed to be the callers LR -- to 8/16(R1). */ 49 50.private_extern saveFP 51saveFP: 52 stfd f14,-144(r1) 53 stfd f15,-136(r1) 54 stfd f16,-128(r1) 55 stfd f17,-120(r1) 56 stfd f18,-112(r1) 57 stfd f19,-104(r1) 58 stfd f20,-96(r1) 59 stfd f21,-88(r1) 60 stfd f22,-80(r1) 61 stfd f23,-72(r1) 62 stfd f24,-64(r1) 63 stfd f25,-56(r1) 64 stfd f26,-48(r1) 65 stfd f27,-40(r1) 66 stfd f28,-32(r1) 67 stfd f29,-24(r1) 68 stfd f30,-16(r1) 69 stfd f31,-8(r1) 70 stg r0,SAVED_LR_OFFSET(r1) 71 blr 72 73/* restFP restores the caller`s LR from 8/16(R1). Note that the code for 74 this starts at the offset of F30 restoration, so calling this 75 routine in an attempt to restore only F31 WILL NOT WORK (it would 76 be a stupid thing to do, anyway.) */ 77 78.private_extern restFP 79restFP: 80 lfd f14,-144(r1) 81 lfd f15,-136(r1) 82 lfd f16,-128(r1) 83 lfd f17,-120(r1) 84 lfd f18,-112(r1) 85 lfd f19,-104(r1) 86 lfd f20,-96(r1) 87 lfd f21,-88(r1) 88 lfd f22,-80(r1) 89 lfd f23,-72(r1) 90 lfd f24,-64(r1) 91 lfd f25,-56(r1) 92 lfd f26,-48(r1) 93 lfd f27,-40(r1) 94 lfd f28,-32(r1) 95 lfd f29,-24(r1) 96 /* <OFFSET OF F30 RESTORE> restore callers LR */ 97 lg r0,SAVED_LR_OFFSET(r1) 98 lfd f30,-16(r1) 99 /* and prepare for return to caller */ 100 mtlr r0 101 lfd f31,-8(r1) 102 blr 103