Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/arch/i386/include Pull up following revision(s) (requ...



details:   https://anonhg.NetBSD.org/src/rev/af57825a0151
branches:  netbsd-8
changeset: 434775:af57825a0151
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Mar 22 17:03:02 2018 +0000

description:
Pull up following revision(s) (requested by christos in ticket #653):
        sys/arch/i386/include/profile.h: revision 1.36
        sys/arch/i386/include/profile.h: revision 1.37

- prevent optimization from omitting the frame pointer (and re-using it);
  we use it in our inline assembly.
- convert to c a little assembly to make the code more understandable.

use compiler builtins to compute addresses instead %ebp assembly arithmetic.
(from joerg)

diffstat:

 sys/arch/i386/include/profile.h |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (25 lines):

diff -r 03c9a258c122 -r af57825a0151 sys/arch/i386/include/profile.h
--- a/sys/arch/i386/include/profile.h   Thu Mar 22 16:59:03 2018 +0000
+++ b/sys/arch/i386/include/profile.h   Thu Mar 22 17:03:02 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: profile.h,v 1.35 2017/05/31 01:50:19 christos Exp $    */
+/*     $NetBSD: profile.h,v 1.35.2.1 2018/03/22 17:03:02 martin Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -71,12 +71,11 @@
         *                                                              \
         * selfpc = pc pushed by mcount call                            \
         */                                                             \
-       __asm volatile("movl 4(%%ebp),%0" : "=r" (selfpc));             \
+       selfpc = (int)__builtin_return_address(0);                      \
        /*                                                              \
-        * frompcindex = pc pushed by call into self.                   \
+        * frompcindex = stack frame of caller, assuming frame pointer  \
         */                                                             \
-       __asm volatile("movl (%%ebp),%0;movl 4(%0),%0"                  \
-           : "=r" (frompcindex));                                      \
+       frompcindex = ((int *)__builtin_frame_address(1))[1];           \
        _mcount((u_long)frompcindex, (u_long)selfpc);                   \
                                                                        \
        __asm volatile("movl %0,%%edx" : : "g" (edx));                  \



Home | Main Index | Thread Index | Old Index