Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Oct 2021 18:53:40 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0177102173f3 - main - arm64, riscv: Fix TRAF_PC() to return the PC, not the return address.
Message-ID:  <202110011853.191IreQB064049@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=0177102173f39e17366a32eb22653aeb5248c355

commit 0177102173f39e17366a32eb22653aeb5248c355
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-10-01 18:53:12 +0000
Commit:     John Baldwin <jhb@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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110011853.191IreQB064049>