Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Nov 2021 23:48:56 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c8c2d908dd47 - stable/13 - arm64, riscv: Fix TRAF_PC() to return the PC, not the return address.
Message-ID:  <202111232348.1ANNmup0077896@gitrepo.freebsd.org>

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

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

commit c8c2d908dd477d6413eaf1f788df88c73ae73c5b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-10-01 18:53:12 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-11-23 23:48:07 +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
    
    (cherry picked from commit 0177102173f39e17366a32eb22653aeb5248c355)
---
 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?202111232348.1ANNmup0077896>