diff options
author | Paul Selkirk <paul@psgd.org> | 2018-04-06 16:14:43 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2018-04-06 22:34:05 -0400 |
commit | 6c7bd80b4e7bc5af1659b14b7fb0038f3dc53989 (patch) | |
tree | a10451c611dcf9f7d31a019c6bbc2e81fc8cd9ac /libraries/libprof/profiler.S | |
parent | b35b87ea14016760786319a23b87792f1e1041de (diff) | |
parent | f508e24f5b872a8f7d642eb4fb2217dd1497de96 (diff) |
Merge branch 'profiling'
Diffstat (limited to 'libraries/libprof/profiler.S')
-rw-r--r-- | libraries/libprof/profiler.S | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libraries/libprof/profiler.S b/libraries/libprof/profiler.S new file mode 100644 index 0000000..1aa5c97 --- /dev/null +++ b/libraries/libprof/profiler.S @@ -0,0 +1,28 @@ +/* + * profiler.S + * Implements the gprof profiler arc counting function. + * Created on: 06.08.2015 + * Author: Erich Styger + */ + + .syntax unified + .arch armv7-m + +.globl __gnu_mcount_nc +.type __gnu_mcount_nc, %function + +__gnu_mcount_nc: +#if 0 /* dummy version, doing nothing */ + mov ip, lr + pop { lr } + bx ip +#else + push {r0, r1, r2, r3, lr} /* save registers */ + bic r1, lr, #1 /* R1 contains callee address, with thumb bit cleared */ + ldr r0, [sp, #20] /* R0 contains caller address */ + bic r0, r0, #1 /* clear thumb bit */ + bl _mcount_internal /* jump to internal _mcount() implementation */ + pop {r0, r1, r2, r3, ip, lr} /* restore saved registers */ + bx ip /* return to caller */ +#endif + |