OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [config/] [rs6000/] [darwin-tramp.asm] - Blame information for rev 856

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/*  Special support for trampolines
2
 *
3
 *   Copyright (C) 1996, 1997, 2000, 2004, 2005 Free Software Foundation, Inc.
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, 51 Franklin Street, Fifth Floor,
27
 * Boston, MA 02110-1301, 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 the
31
 *  resulting executable to be covered by the GNU General Public License.
32
 *  This exception does not however invalidate any other reasons why the
33
 *  executable file might be covered by the GNU General Public License.
34
 */
35
 
36
#include "darwin-asm.h"
37
 
38
/* Set up trampolines.  */
39
 
40
.text
41
        .align  LOG2_GPR_BYTES
42
Ltrampoline_initial:
43
        mflr    r0
44
        bl      1f
45
Lfunc = .-Ltrampoline_initial
46
        .g_long 0                /* will be replaced with function address */
47
Lchain = .-Ltrampoline_initial
48
        .g_long 0                /* will be replaced with static chain */
49
1:      mflr    r11
50
        lg      r12,0(r11)      /* function address */
51
        mtlr    r0
52
        mtctr   r12
53
        lg      r11,GPR_BYTES(r11)      /* static chain */
54
        bctr
55
 
56
trampoline_size = .-Ltrampoline_initial
57
 
58
/* R3 = stack address to store trampoline */
59
/* R4 = length of trampoline area */
60
/* R5 = function address */
61
/* R6 = static chain */
62
 
63
        .globl ___trampoline_setup
64
___trampoline_setup:
65
        mflr    r0              /* save return address */
66
        bcl 20,31,LCF0          /* load up __trampoline_initial into r7 */
67
LCF0:
68
        mflr    r11
69
        addis   r7,r11,ha16(LTRAMP-LCF0)
70
        lg      r7,lo16(LTRAMP-LCF0)(r7)
71
        subi    r7,r7,4
72
        li      r8,trampoline_size      /* verify trampoline big enough */
73
        cmpg    cr1,r8,r4
74
        srwi    r4,r4,2                 /* # words to move (insns always 4-byte) */
75
        addi    r9,r3,-4        /* adjust pointer for lgu */
76
        mtctr   r4
77
        blt     cr1,Labort
78
 
79
        mtlr    r0
80
 
81
        /* Copy the instructions to the stack */
82
Lmove:
83
        lwzu    r10,4(r7)
84
        stwu    r10,4(r9)
85
        bdnz    Lmove
86
 
87
        /* Store correct function and static chain */
88
        stg     r5,Lfunc(r3)
89
        stg     r6,Lchain(r3)
90
 
91
        /* Now flush both caches */
92
        mtctr   r4
93
Lcache:
94
        icbi    0,r3
95
        dcbf    0,r3
96
        addi    r3,r3,4
97
        bdnz    Lcache
98
 
99
        /* Ensure cache-flushing has finished.  */
100
        sync
101
        isync
102
 
103
        /* Make stack writeable.  */
104
        b       ___enable_execute_stack
105
 
106
Labort:
107
#ifdef __DYNAMIC__
108
        bl      L_abort$stub
109
.data
110
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
111
        .align 2
112
L_abort$stub:
113
        .indirect_symbol _abort
114
        mflr r0
115
        bcl 20,31,L0$_abort
116
L0$_abort:
117
        mflr r11
118
        addis r11,r11,ha16(L_abort$lazy_ptr-L0$_abort)
119
        mtlr r0
120
        lgu r12,lo16(L_abort$lazy_ptr-L0$_abort)(r11)
121
        mtctr r12
122
        bctr
123
.data
124
.lazy_symbol_pointer
125
L_abort$lazy_ptr:
126
        .indirect_symbol _abort
127
        .g_long dyld_stub_binding_helper
128
#else
129
        bl      _abort
130
#endif
131
.data
132
        .align LOG2_GPR_BYTES
133
LTRAMP:
134
        .g_long Ltrampoline_initial
135
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.