1 /* CYGNUS LOCAL -- waiting for FSF sources to be restored/meissner */
3 * special support for trampolines
5 * Copyright (C) 1996 Free Software Foundation, Inc.
6 * Written By Michael Meissner
8 * This file is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * In addition to the permissions in the GNU General Public License, the
14 * Free Software Foundation gives you unlimited permission to link the
15 * compiled version of this file with other programs, and to distribute
16 * those programs without any restriction coming from the use of this
17 * file. (The General Public License restrictions do apply in other
18 * respects; for example, they cover modification of the file, and
19 * distribution when not linked into another program.)
21 * This file is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; see the file COPYING. If not, write to
28 * the Free Software Foundation, 59 Temple Place - Suite 330,
29 * Boston, MA 02111-1307, USA.
31 * As a special exception, if you link this library with files
32 * compiled with GCC to produce an executable, this does not cause
33 * the resulting executable to be covered by the GNU General Public License.
34 * This exception does not however invalidate any other reasons why
35 * the executable file might be covered by the GNU General Public License.
38 /* Set up trampolines */
44 .globl __trampoline_initial
45 .type __trampoline_initial,@object
50 .Lfunc = .-__trampoline_initial
51 .long 0 /* will be replaced with function address */
52 .Lchain = .-__trampoline_initial
53 .long 0 /* will be replaced with static chain */
56 lwz r0,0(r11) /* function address */
57 lwz r11,4(r11) /* static chain */
61 __trampoline_size = .-__trampoline_initial
62 .size __trampoline_initial,__trampoline_size
67 .long __trampoline_initial-4
73 /* R3 = stack address to store trampoline */
74 /* R4 = length of trampoline area */
75 /* R5 = function address */
76 /* R6 = static chain */
78 FUNC_START(__trampoline_setup)
79 mflr r0 /* save return address */
80 bl .LCF0 /* load up __trampoline_initial into r7 */
83 lwz r12,(.LCL0-.LCF0)(r11)
85 lwz r7,.Ltramp(r11) /* trampoline addres -4 */
87 li r8,__trampoline_size /* verify that the trampoline is big enough */
89 srwi r4,r4,2 /* # words to move */
90 addi r9,r3,-4 /* adjust pointer for lwzu */
96 /* Copy the instructions to the stack */
102 /* Store correct function and static chain */
106 /* Now flush both caches */
114 /* Finally synchronize things & return */
121 FUNC_END(__trampoline_setup)
122 /* END CYGNUS LOCAL -- waiting for FSF sources to be restored/meissner */