Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm26/include Arrange to restore R14 on return from...
details: https://anonhg.NetBSD.org/src/rev/2979fde86694
branches: trunk
changeset: 509120:2979fde86694
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Thu Apr 26 22:09:57 2001 +0000
description:
Arrange to restore R14 on return from __mcount, so that profiled assembler
routines will work. We could put this in _PROF_PROLOGUE, but this seems
lighter-weight and possibly cleaner.
diffstat:
sys/arch/arm26/include/profile.h | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (50 lines):
diff -r 41b3a64d110c -r 2979fde86694 sys/arch/arm26/include/profile.h
--- a/sys/arch/arm26/include/profile.h Thu Apr 26 20:05:46 2001 +0000
+++ b/sys/arch/arm26/include/profile.h Thu Apr 26 22:09:57 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: profile.h,v 1.2 2000/06/08 23:25:05 bjh21 Exp $ */
+/* $NetBSD: profile.h,v 1.3 2001/04/26 22:09:57 bjh21 Exp $ */
/*
* Copyright (c) 1995-1996 Mark Brinicombe
@@ -36,6 +36,14 @@
* pushes a trapframe. Pity we cannot insert assembly before the function
* prologue.
*/
+/*
+ * The prologue for the function being profiled will include:
+ *
+ * mov ip, lr
+ * bl __mcount
+ *
+ * We arrange to preserve all registers, and return with lr restored.
+ */
#define MCOUNT \
__asm__(".text"); \
__asm__(".align 0"); \
@@ -45,7 +53,7 @@
/* \
* Preserve registers that are trashed during mcount \
*/ \
- __asm__("stmfd sp!, {r0-r3, lr}"); \
+ __asm__("stmfd sp!, {r0-r3, ip, lr}"); \
/* \
* find the return address for mcount, \
* and the return address for mcount's caller. \
@@ -64,13 +72,13 @@
/* \
* Restore registers that were trashed during mcount \
*/ \
- __asm__("ldmfd sp!, {r0-r3, pc}^");
+ __asm__("ldmfd sp!, {r0-r3, lr, pc}");
#ifdef _KERNEL
/*
* Note that we assume splhigh() and splx() cannot call mcount()
* recursively.
*/
-#define MCOUNT_ENTER int_off()
-#define MCOUNT_EXIT int_on()
+#define MCOUNT_ENTER s = splhigh()
+#define MCOUNT_EXIT splx(s)
#endif /* _KERNEL */
Home |
Main Index |
Thread Index |
Old Index