This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 3783bfeaeb7 arm64/hwdebug: clear OS lock and OS double lock before 
enabling hwdebug
3783bfeaeb7 is described below

commit 3783bfeaeb792a55a249becc4e3bb5002e5c94f5
Author: wangmingrong1 <[email protected]>
AuthorDate: Mon Nov 2 19:00:08 2026 +0800

    arm64/hwdebug: clear OS lock and OS double lock before enabling hwdebug
    
    Clear OSLAR_EL1 and OSDLR_EL1 when the debug monitor is enabled.
    armv8-R requires the OS lock released before the debug registers are
    used, while armv8-A is more forgiving, so the extra writes are harmless
    there.
    
    Signed-off-by: wangmingrong1 <[email protected]>
---
 arch/arm64/src/common/arm64_hwdebug.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/src/common/arm64_hwdebug.c 
b/arch/arm64/src/common/arm64_hwdebug.c
index 6719204f566..8b71f51553f 100644
--- a/arch/arm64/src/common/arm64_hwdebug.c
+++ b/arch/arm64/src/common/arm64_hwdebug.c
@@ -342,6 +342,10 @@ int arm64_enable_dbgmonitor(void)
   mdscr |= ARM64_MDSCR_EL1_MDE | ARM64_MDSCR_EL1_KDE;
   write_sysreg(mdscr, mdscr_el1);
 
+  write_sysreg(0, osdlr_el1);
+  write_sysreg(0, oslar_el1);
+  UP_ISB();
+
   arm64_register_debug_hook(DBG_ESR_EVT_HWBP, arm64_breakpoint_match);
   arm64_register_debug_hook(DBG_ESR_EVT_HWWP, arm64_watchpoint_match);
   return OK;

Reply via email to