git: 0177102173f3 - main - arm64, riscv: Fix TRAF_PC() to return the PC, not the return address.
John Baldwin
jhb at FreeBSD.org
Fri Oct 1 18:53:41 UTC 2021
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=0177102173f39e17366a32eb22653aeb5248c355
commit 0177102173f39e17366a32eb22653aeb5248c355
Author: John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-10-01 18:53:12 +0000
Commit: John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-10-01 18:53:12 +0000
arm64, riscv: Fix TRAF_PC() to return the PC, not the return address.
Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31969
---
sys/arm64/include/cpu.h | 2 +-
sys/riscv/include/cpu.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h
index 0b1aa2d93b03..c926372a0ec6 100644
--- a/sys/arm64/include/cpu.h
+++ b/sys/arm64/include/cpu.h
@@ -45,7 +45,7 @@
#include <machine/frame.h>
#include <machine/armreg.h>
-#define TRAPF_PC(tfp) ((tfp)->tf_lr)
+#define TRAPF_PC(tfp) ((tfp)->tf_elr)
#define TRAPF_USERMODE(tfp) (((tfp)->tf_spsr & PSR_M_MASK) == PSR_M_EL0t)
#define cpu_getstack(td) ((td)->td_frame->tf_sp)
diff --git a/sys/riscv/include/cpu.h b/sys/riscv/include/cpu.h
index 79c6f730f2a6..453a6af1a0f8 100644
--- a/sys/riscv/include/cpu.h
+++ b/sys/riscv/include/cpu.h
@@ -41,7 +41,7 @@
#include <machine/cpufunc.h>
#include <machine/frame.h>
-#define TRAPF_PC(tfp) ((tfp)->tf_ra)
+#define TRAPF_PC(tfp) ((tfp)->tf_sepc)
#define TRAPF_USERMODE(tfp) (((tfp)->tf_sstatus & SSTATUS_SPP) == 0)
#define cpu_getstack(td) ((td)->td_frame->tf_sp)
More information about the dev-commits-src-main
mailing list