diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2008-09-15 06:47:52 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2008-09-15 06:47:52 +0000 |
commit | a9cbfb55cdc6f2ac0c38c5c9877fafbaad0c70ee (patch) | |
tree | d678c3a6dd0d4adcb19f4dae801ffb2b9ad8f0d6 /sys/amd64 | |
parent | 557d36f2a868b261d969813154cf130ba8c32029 (diff) | |
download | FreeBSD-src-a9cbfb55cdc6f2ac0c38c5c9877fafbaad0c70ee.zip FreeBSD-src-a9cbfb55cdc6f2ac0c38c5c9877fafbaad0c70ee.tar.gz |
Correct a callchain capture bug on the i386.
On the i386 architecture, the processor only saves the current value
of `%esp' on stack if a privilege switch is necessary when entering
the interrupt handler. Thus, `frame->tf_esp' is only valid for
an entry from user mode. For interrupts taken in kernel mode, we
need to determine the top-of-stack for the interrupted kernel
procedure by adding the appropriate offset to the current frame
pointer.
Reported by: kris, Fabien Thomas
Tested by: Fabien Thomas <fabien.thomas at netasq dot com>
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/include/pmc_mdep.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/amd64/include/pmc_mdep.h b/sys/amd64/include/pmc_mdep.h index 258d6aa..a11a82a 100644 --- a/sys/amd64/include/pmc_mdep.h +++ b/sys/amd64/include/pmc_mdep.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Joseph Koshy + * Copyright (c) 2003-2008 Joseph Koshy * Copyright (c) 2007 The FreeBSD Foundation * All rights reserved. * @@ -59,7 +59,8 @@ struct pmc; #define PMC_TRAPFRAME_TO_PC(TF) ((TF)->tf_rip) #define PMC_TRAPFRAME_TO_FP(TF) ((TF)->tf_rbp) -#define PMC_TRAPFRAME_TO_SP(TF) ((TF)->tf_rsp) +#define PMC_TRAPFRAME_TO_USER_SP(TF) ((TF)->tf_rsp) +#define PMC_TRAPFRAME_TO_KERNEL_SP(TF) ((TF)->tf_rsp) #define PMC_AT_FUNCTION_PROLOGUE_PUSH_BP(I) \ (((I) & 0xffffffff) == 0xe5894855) /* pushq %rbp; movq %rsp,%rbp */ |