Page MenuHomeFreeBSD

D62456.1796511347.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D62456.1796511347.diff

diff --git a/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c b/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
--- a/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
+++ b/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
@@ -66,7 +66,7 @@
(x) <= DMAP_MAX_ADDRESS))
static __inline int
-dtrace_sp_inkernel(uintptr_t sp)
+dtrace_sp_inkernel(uintptr_t sp, uintptr_t lr)
{
struct trapframe *frame;
vm_offset_t callpc;
@@ -74,6 +74,15 @@
/* Not within the kernel, or not aligned. */
if (!INKERNEL(sp) || (sp & 0xf) != 0)
return (0);
+
+ /*
+ * The frame of a function that a trap interrupted. Its LR save
+ * word may not have been written to yet, the return address is the
+ * LR of the trap frame.
+ */
+ if (lr != 0)
+ return (1);
+
#ifdef __powerpc64__
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET64);
#else
@@ -113,9 +122,12 @@
/*
* trapexit() and asttrapexit() are sentinels
- * for kernel stack tracing.
+ * for kernel stack tracing. Only as a return address saved in a
+ * frame, though: the LR of an interrupted function can have them
+ * too, and the frame of that function is not a trap frame.
*/
- if ((callpc + OFFSET == (vm_offset_t) &trapexit ||
+ if ((lr == NULL || *lr == 0) &&
+ (callpc + OFFSET == (vm_offset_t) &trapexit ||
callpc + OFFSET == (vm_offset_t) &asttrapexit)) {
/* Access the trap frame */
frame = (struct trapframe *)(sp + FRAME_OFFSET);
@@ -163,7 +175,7 @@
if (sp <= osp)
break;
- if (!dtrace_sp_inkernel(sp))
+ if (!dtrace_sp_inkernel(sp, lr))
break;
osp = sp;
dtrace_next_sp_pc(osp, &sp, &callpc, &lr);
@@ -525,7 +537,7 @@
if (sp <= osp)
break;
- if (!dtrace_sp_inkernel(sp))
+ if (!dtrace_sp_inkernel(sp, 0))
break;
depth++;

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 5, 10:55 PM (7 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42241335
Default Alt Text
D62456.1796511347.diff (1 KB)

Event Timeline