Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102007283
D38303.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D38303.id.diff
View Options
diff --git a/sys/cddl/dev/dtrace/riscv/dtrace_isa.c b/sys/cddl/dev/dtrace/riscv/dtrace_isa.c
--- a/sys/cddl/dev/dtrace/riscv/dtrace_isa.c
+++ b/sys/cddl/dev/dtrace/riscv/dtrace_isa.c
@@ -169,7 +169,7 @@
{
volatile uint16_t *flags;
struct trapframe *tf;
- uintptr_t pc, sp, fp;
+ uintptr_t pc, fp;
proc_t *p;
int n;
@@ -195,7 +195,6 @@
return;
pc = tf->tf_sepc;
- sp = tf->tf_sp;
fp = tf->tf_s[0];
if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) {
@@ -207,7 +206,6 @@
* at the current stack pointer address since the call
* instruction puts it there right before the branch.
*/
-
*pcstack++ = (uint64_t)pc;
pcstack_limit--;
if (pcstack_limit <= 0)
@@ -231,8 +229,33 @@
int
dtrace_getustackdepth(void)
{
+ struct trapframe *tf;
+ uintptr_t pc, fp;
+ int n = 0;
- printf("IMPLEMENT ME: %s\n", __func__);
+ if (curproc == NULL || (tf = curthread->td_frame) == NULL)
+ return (0);
+
+ if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_FAULT))
+ return (-1);
+
+ pc = tf->tf_sepc;
+ fp = tf->tf_s[0];
+
+ if (DTRACE_CPUFLAG_ISSET(CPU_DTRACE_ENTRY)) {
+ /*
+ * In an entry probe. The frame pointer has not yet been
+ * pushed (that happens in the function prologue). The
+ * best approach is to add the current pc as a missing top
+ * of stack and back the pc up to the caller, which is stored
+ * at the current stack pointer address since the call
+ * instruction puts it there right before the branch.
+ */
+ pc = tf->tf_ra;
+ n++;
+ }
+
+ n += dtrace_getustack_common(NULL, 0, pc, fp);
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 7, 11:41 AM (19 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14511297
Default Alt Text
D38303.id.diff (1 KB)
Attached To
Mode
D38303: riscv: implement dtrace_getustackdepth()
Attached
Detach File
Event Timeline
Log In to Comment