[444] | 1 | /* Copyright (c) 2011 Red Hat Incorporated. |
---|
| 2 | All rights reserved. |
---|
| 3 | |
---|
| 4 | Redistribution and use in source and binary forms, with or without |
---|
| 5 | modification, are permitted provided that the following conditions |
---|
| 6 | are met: |
---|
| 7 | |
---|
| 8 | Redistributions of source code must retain the above copyright |
---|
| 9 | notice, this list of conditions and the following disclaimer. |
---|
| 10 | |
---|
| 11 | Redistributions in binary form must reproduce the above copyright |
---|
| 12 | notice, this list of conditions and the following disclaimer in the |
---|
| 13 | documentation and/or other materials provided with the distribution. |
---|
| 14 | |
---|
| 15 | The name of Red Hat Incorporated may not be used to endorse |
---|
| 16 | or promote products derived from this software without specific |
---|
| 17 | prior written permission. |
---|
| 18 | |
---|
| 19 | This software is provided by the copyright holders and contributors |
---|
| 20 | "AS IS" and any express or implied warranties, including, but not |
---|
| 21 | limited to, the implied warranties of merchantability and fitness for |
---|
| 22 | a particular purpose are disclaimed. In no event shall Red Hat |
---|
| 23 | incorporated be liable for any direct, indirect, incidental, special, |
---|
| 24 | exemplary, or consequential damages (including, but not limited to, |
---|
| 25 | procurement of substitute goods or services; loss of use, data, or |
---|
| 26 | profits; or business interruption) however caused and on any theory of |
---|
| 27 | liability, whether in contract, strict liability, or tort (including |
---|
| 28 | negligence or otherwise) arising in any way out of the use of this |
---|
| 29 | software, even if advised of the possibility of such damage. */ |
---|
| 30 | |
---|
| 31 | #define PROFILE_SUPPORT 1 |
---|
| 32 | |
---|
| 33 | #include "crt0.S" |
---|
| 34 | |
---|
| 35 | .global __mcount |
---|
| 36 | .type __mcount, @function |
---|
| 37 | __mcount: |
---|
| 38 | ;; When a function is compiled for profiling, gcc creates code |
---|
| 39 | ;; like this at the start of each profiled function: |
---|
| 40 | ;; |
---|
| 41 | ;; .global <func_name> |
---|
| 42 | ;; <func_name>: |
---|
| 43 | ;; bsr __mcount |
---|
| 44 | ;; <...function's prologue...> |
---|
| 45 | ;; <...function's body...> |
---|
| 46 | ;; |
---|
| 47 | ;; We must save all of the argument registers, extract the |
---|
| 48 | ;; address of <func_name>, call _mcount_internal to do the |
---|
| 49 | ;; real work and then restore the argument registers before |
---|
| 50 | ;; returning. |
---|
| 51 | |
---|
| 52 | movw ax, [sp] |
---|
| 53 | push ax |
---|
| 54 | call !!__mcount_internal |
---|
| 55 | pop ax |
---|
| 56 | ret |
---|
| 57 | |
---|
| 58 | .size __mcount, . - __mcount |
---|