Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

kernel - Add PC sampling for x86-64

* Xtimer interrupt (lapic timer) now samples the %rip value and stores
  it in the globaldata structure.  Sampling occurs whether the machine is
  in a critical section or not.

* Used for debugging.
  • Loading branch information...
commit 433c75c34a02757b400e474eab030c6e56f3e8a3 1 parent 4e9f1e6
Matthew Dillon authored
View
2  sys/platform/pc64/apic/apic_vector.s
@@ -322,6 +322,8 @@ Xtimer:
addq $8,%rsp /* turn into trapframe */
incl PCPU(cnt) + V_TIMER
+ movq TF_RIP(%rsp),%rbx /* sample addr before checking crit */
+ movq %rbx,PCPU(sample_pc)
movq PCPU(curthread),%rbx
testl $-1,TD_CRITCOUNT(%rbx)
jne 1f
View
1  sys/platform/pc64/x86_64/genassym.c
@@ -111,6 +111,7 @@ ASSYM(GD_CURTHREAD, offsetof(struct mdglobaldata, mi.gd_curthread));
ASSYM(GD_CNT, offsetof(struct mdglobaldata, mi.gd_cnt));
ASSYM(GD_CPUID, offsetof(struct mdglobaldata, mi.gd_cpuid));
ASSYM(GD_CPUMASK, offsetof(struct mdglobaldata, mi.gd_cpumask));
+ASSYM(GD_SAMPLE_PC, offsetof(struct mdglobaldata, mi.gd_sample_pc));
ASSYM(PCB_CR3, offsetof(struct pcb, pcb_cr3));
ASSYM(PCB_R15, offsetof(struct pcb, pcb_r15));
View
2  sys/platform/pc64/x86_64/global.s
@@ -82,6 +82,7 @@
.globl gd_cnt, gd_private_tss
.globl gd_scratch_rsp
.globl gd_user_fs, gd_user_gs
+ .globl gd_sample_pc
.set gd_cpuid,globaldata + GD_CPUID
.set gd_cpumask,globaldata + GD_CPUMASK
@@ -95,4 +96,5 @@
.set gd_scratch_rsp,globaldata + GD_SCRATCH_RSP
.set gd_user_fs,globaldata + GD_USER_FS
.set gd_user_gs,globaldata + GD_USER_GS
+ .set gd_sample_pc,globaldata + GD_SAMPLE_PC
View
3  sys/sys/globaldata.h
@@ -167,7 +167,8 @@ struct globaldata {
const char *gd_infomsg; /* debugging */
struct lwkt_tokref gd_handoff; /* hand-off tokref */
void *gd_delayed_wakeup[2];
- void *gd_preserved[6]; /* future fields */
+ void *gd_sample_pc; /* sample program ctr/tr */
+ void *gd_preserved[5]; /* future fields */
/* extended by <machine/globaldata.h> */
};
Please sign in to comment.
Something went wrong with that request. Please try again.