annotate packages/hal/powerpc/arch/current/src/mcount.S @ 3403:8c8767bb9a62 default tip

devs/nand/micron_mt29: Remove defunct references (in comments) to mt29f2g08_oob_ecc.
author Ross Younger <wry@ecoscentric.com>
date Sun, 18 Jan 2015 17:59:01 +1300
parents 42c5ca5ac4e2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3363
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
1 /*==========================================================================
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
2 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
3 // mcount.S
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
4 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
5 // PowerPC mcount implementation
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
6 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
7 //==========================================================================
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
8 // ####ECOSGPLCOPYRIGHTBEGIN####
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
9 // -------------------------------------------
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
10 // This file is part of eCos, the Embedded Configurable Operating System.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
11 // Copyright (C) 2014 Free Software Foundation, Inc.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
12 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
13 // eCos is free software; you can redistribute it and/or modify it under
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
14 // the terms of the GNU General Public License as published by the Free
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
15 // Software Foundation; either version 2 or (at your option) any later
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
16 // version.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
17 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
18 // eCos is distributed in the hope that it will be useful, but WITHOUT
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
19 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
21 // for more details.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
22 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
23 // You should have received a copy of the GNU General Public License
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
24 // along with eCos; if not, write to the Free Software Foundation, Inc.,
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
25 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
26 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
27 // As a special exception, if other files instantiate templates or use
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
28 // macros or inline functions from this file, or you compile this file
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
29 // and link it with other works to produce a work based on this file,
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
30 // this file does not by itself cause the resulting work to be covered by
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
31 // the GNU General Public License. However the source code for this file
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
32 // must still be made available in accordance with section (3) of the GNU
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
33 // General Public License v2.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
34 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
35 // This exception does not invalidate any other reasons why a work based
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
36 // on this file might be covered by the GNU General Public License.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
37 // -------------------------------------------
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
38 // ####ECOSGPLCOPYRIGHTEND####
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
39 //==========================================================================
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
40 //#####DESCRIPTIONBEGIN####
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
41 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
42 // Author(s): jld
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
43 // Contributor(s):
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
44 // Date: 2014-03-20
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
45 // Description: This file provides mcount functions used for
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
46 // call-graph profiling.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
47 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
48 //####DESCRIPTIONEND####
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
49 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
50 //========================================================================
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
51 */
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
52
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
53 #include <cyg/hal/arch.inc>
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
54
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
55 /*
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
56 // GCC inserts mcount code at the start of every function when compiling
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
57 // with "-pg". For GCC targeting PowerPC, the following code is inserted:
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
58 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
59 // mflr r0
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
60 // stw r0, 4(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
61 // bl _mcount
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
62 //
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
63 // We provide an implementation of _mcount() to call the eCos
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
64 // __profile_mcount() function.
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
65 */
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
66
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
67 .section ".text.mcount"
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
68 .globl _mcount
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
69 _mcount:
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
70 // create stack frame
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
71 stwu r1, -48(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
72
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
73 // caller assumes r3-r10 will be preserved and we use r14
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
74 stw r3, 8(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
75 stw r4, 12(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
76 stw r5, 16(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
77 stw r6, 20(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
78 stw r7, 24(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
79 stw r8, 28(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
80 stw r9, 32(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
81 stw r10, 36(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
82 stw r14, 40(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
83
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
84 // set up parameters for __profile_mcount() and preserve
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
85 // lr across our __profile_mcount() call
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
86 lwz r3, 52(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
87 subi r3, r3, 2
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
88 mflr r4
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
89 stw r4, 44(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
90
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
91 // disable interrupts
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
92 lwi r0, ~CYGARC_REG_MSR_INTBITS
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
93 mfmsr r14
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
94 and r0, r0, r14
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
95 mtmsr r0
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
96
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
97 // call eCos __profile_mcount()
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
98 // r14 is preserved across the call per EABI standard
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
99 bl __profile_mcount
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
100
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
101 // restore interrupts
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
102 mtmsr r14
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
103
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
104 // restore registers
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
105 lwz r3, 8(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
106 lwz r4, 12(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
107 lwz r5, 16(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
108 lwz r6, 20(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
109 lwz r7, 24(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
110 lwz r8, 28(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
111 lwz r9, 32(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
112 lwz r10, 36(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
113 lwz r14, 40(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
114
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
115 // unwind stack frame and return
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
116 lwz r0, 44(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
117 mtctr r0
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
118 lwz r0, 52(r1)
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
119 mtlr r0
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
120 addi r1, r1, 48
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
121 bctr
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
122
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
123 //==========================================================================
42c5ca5ac4e2 * src/mcount.S: Add mcount functions for call-graph profiling.
jld
parents:
diff changeset
124 // end of mcount.S