]> gcc.gnu.org Git - gcc.git/blame - gcc/config/rs6000/tramp.asm
Daily bump.
[gcc.git] / gcc / config / rs6000 / tramp.asm
CommitLineData
a0d66c8d 1/* Special support for trampolines
eaf1bcf1 2 *
a0d66c8d 3 * Copyright (C) 1996, 1997 Free Software Foundation, Inc.
eaf1bcf1
MM
4 * Written By Michael Meissner
5 *
6 * This file is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * In addition to the permissions in the GNU General Public License, the
12 * Free Software Foundation gives you unlimited permission to link the
13 * compiled version of this file with other programs, and to distribute
14 * those programs without any restriction coming from the use of this
15 * file. (The General Public License restrictions do apply in other
16 * respects; for example, they cover modification of the file, and
17 * distribution when not linked into another program.)
18 *
19 * This file is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; see the file COPYING. If not, write to
26 * the Free Software Foundation, 59 Temple Place - Suite 330,
27 * Boston, MA 02111-1307, USA.
28 *
29 * As a special exception, if you link this library with files
30 * compiled with GCC to produce an executable, this does not cause
31 * the resulting executable to be covered by the GNU General Public License.
32 * This exception does not however invalidate any other reasons why
33 * the executable file might be covered by the GNU General Public License.
34 */
35
36/* Set up trampolines */
37
38 .file "tramp.asm"
39 .section ".text"
40 #include "ppc-asm.h"
41
42 .globl __trampoline_initial
43 .type __trampoline_initial,@object
44 .align 2
45__trampoline_initial:
46 mflr r0
47 bl 1f
48.Lfunc = .-__trampoline_initial
49 .long 0 /* will be replaced with function address */
50.Lchain = .-__trampoline_initial
51 .long 0 /* will be replaced with static chain */
521: mflr r11
53 mtlr r0
54 lwz r0,0(r11) /* function address */
55 lwz r11,4(r11) /* static chain */
56 mtctr r0
57 bctr
58
59__trampoline_size = .-__trampoline_initial
60 .size __trampoline_initial,__trampoline_size
61
62 .section ".got2","aw"
63.LCTOC1 = .+32768
64.Ltramp = .-.LCTOC1
65 .long __trampoline_initial-4
66
67 .section ".text"
68.LCL0:
69 .long .LCTOC1-.LCF0
70
71/* R3 = stack address to store trampoline */
72/* R4 = length of trampoline area */
73/* R5 = function address */
74/* R6 = static chain */
75
76FUNC_START(__trampoline_setup)
77 mflr r0 /* save return address */
78 bl .LCF0 /* load up __trampoline_initial into r7 */
79.LCF0:
80 mflr r11
81 lwz r12,(.LCL0-.LCF0)(r11)
82 add r11,r12,r11
a0d66c8d 83 lwz r7,.Ltramp(r11) /* trampoline address -4 */
eaf1bcf1
MM
84
85 li r8,__trampoline_size /* verify that the trampoline is big enough */
86 cmpw cr1,r8,r4
87 srwi r4,r4,2 /* # words to move */
88 addi r9,r3,-4 /* adjust pointer for lwzu */
89 mtctr r4
90 blt cr1,.Labort
91
92 mtlr r0
93
94 /* Copy the instructions to the stack */
95.Lmove:
96 lwzu r10,4(r7)
97 stwu r10,4(r9)
98 bdnz .Lmove
99
100 /* Store correct function and static chain */
101 stw r5,.Lfunc(r3)
102 stw r6,.Lchain(r3)
103
104 /* Now flush both caches */
105 mtctr r4
106.Lcache:
107 icbi 0,r3
108 dcbf 0,r3
109 addi r3,r3,4
110 bdnz .Lcache
111
112 /* Finally synchronize things & return */
113 sync
114 isync
115 blr
116
117.Labort:
118 bl abort
119FUNC_END(__trampoline_setup)
120/* END CYGNUS LOCAL -- waiting for FSF sources to be restored/meissner */
This page took 0.655499 seconds and 5 git commands to generate.