1169689Skan/* This file contains the floating-point save and restore routines. 2169689Skan * 3169689Skan * Copyright (C) 2004 Free Software Foundation, Inc. 4169689Skan * 5169689Skan * This file is free software; you can redistribute it and/or modify it 6169689Skan * under the terms of the GNU General Public License as published by the 7169689Skan * Free Software Foundation; either version 2, or (at your option) any 8169689Skan * later version. 9169689Skan * 10169689Skan * In addition to the permissions in the GNU General Public License, the 11169689Skan * Free Software Foundation gives you unlimited permission to link the 12169689Skan * compiled version of this file with other programs, and to distribute 13169689Skan * those programs without any restriction coming from the use of this 14169689Skan * file. (The General Public License restrictions do apply in other 15169689Skan * respects; for example, they cover modification of the file, and 16169689Skan * distribution when not linked into another program.) 17169689Skan * 18169689Skan * This file is distributed in the hope that it will be useful, but 19169689Skan * WITHOUT ANY WARRANTY; without even the implied warranty of 20169689Skan * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21169689Skan * General Public License for more details. 22169689Skan * 23169689Skan * You should have received a copy of the GNU General Public License 24169689Skan * along with this program; see the file COPYING. If not, write to 25169689Skan * the Free Software Foundation, 51 Franklin Street, Fifth Floor, 26169689Skan * Boston, MA 02110-1301, USA. 27169689Skan * 28169689Skan * As a special exception, if you link this library with files 29169689Skan * compiled with GCC to produce an executable, this does not cause the 30169689Skan * resulting executable to be covered by the GNU General Public License. 31169689Skan * This exception does not however invalidate any other reasons why the 32169689Skan * executable file might be covered by the GNU General Public License. 33169689Skan */ 34169689Skan 35169689Skan/* THE SAVE AND RESTORE ROUTINES CAN HAVE ONLY ONE GLOBALLY VISIBLE 36169689Skan ENTRY POINT - callers have to jump to "saveFP+60" to save f29..f31, 37169689Skan for example. For FP reg saves/restores, it takes one instruction 38169689Skan (4 bytes) to do the operation; for Vector regs, 2 instructions are 39169689Skan required (8 bytes.) 40169689Skan 41169689Skan MORAL: DO NOT MESS AROUND WITH THESE FUNCTIONS! */ 42169689Skan 43169689Skan#include "darwin-asm.h" 44169689Skan 45169689Skan.text 46169689Skan .align 2 47169689Skan 48169689Skan/* saveFP saves R0 -- assumed to be the callers LR -- to 8/16(R1). */ 49169689Skan 50169689Skan.private_extern saveFP 51169689SkansaveFP: 52169689Skan stfd f14,-144(r1) 53169689Skan stfd f15,-136(r1) 54169689Skan stfd f16,-128(r1) 55169689Skan stfd f17,-120(r1) 56169689Skan stfd f18,-112(r1) 57169689Skan stfd f19,-104(r1) 58169689Skan stfd f20,-96(r1) 59169689Skan stfd f21,-88(r1) 60169689Skan stfd f22,-80(r1) 61169689Skan stfd f23,-72(r1) 62169689Skan stfd f24,-64(r1) 63169689Skan stfd f25,-56(r1) 64169689Skan stfd f26,-48(r1) 65169689Skan stfd f27,-40(r1) 66169689Skan stfd f28,-32(r1) 67169689Skan stfd f29,-24(r1) 68169689Skan stfd f30,-16(r1) 69169689Skan stfd f31,-8(r1) 70169689Skan stg r0,SAVED_LR_OFFSET(r1) 71169689Skan blr 72169689Skan 73169689Skan/* restFP restores the caller`s LR from 8/16(R1). Note that the code for 74169689Skan this starts at the offset of F30 restoration, so calling this 75169689Skan routine in an attempt to restore only F31 WILL NOT WORK (it would 76169689Skan be a stupid thing to do, anyway.) */ 77169689Skan 78169689Skan.private_extern restFP 79169689SkanrestFP: 80169689Skan lfd f14,-144(r1) 81169689Skan lfd f15,-136(r1) 82169689Skan lfd f16,-128(r1) 83169689Skan lfd f17,-120(r1) 84169689Skan lfd f18,-112(r1) 85169689Skan lfd f19,-104(r1) 86169689Skan lfd f20,-96(r1) 87169689Skan lfd f21,-88(r1) 88169689Skan lfd f22,-80(r1) 89169689Skan lfd f23,-72(r1) 90169689Skan lfd f24,-64(r1) 91169689Skan lfd f25,-56(r1) 92169689Skan lfd f26,-48(r1) 93169689Skan lfd f27,-40(r1) 94169689Skan lfd f28,-32(r1) 95169689Skan lfd f29,-24(r1) 96169689Skan /* <OFFSET OF F30 RESTORE> restore callers LR */ 97169689Skan lg r0,SAVED_LR_OFFSET(r1) 98169689Skan lfd f30,-16(r1) 99169689Skan /* and prepare for return to caller */ 100169689Skan mtlr r0 101169689Skan lfd f31,-8(r1) 102169689Skan blr 103