The branch stable/14 has been updated by kib:

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

commit 617e683319bec099e02301c6f1120fd5d065d3ba
Author:     Konstantin Belousov <k...@freebsd.org>
AuthorDate: 2024-11-21 19:40:18 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2024-11-28 12:53:16 +0000

    efirt: mark dynamic region executing the RT code with the TDP_EFIRT flag
    
    For MFC purposes, the TDP_EFIRT flag is moved to td_pflags2.
    
    (cherry picked from commit a03957a706a05bb0c2f627183b19d84f6d96dbb7)
---
 sys/dev/efidev/efirt.c | 8 +++++++-
 sys/sys/proc.h         | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c
index 2d45b4d6ac66..92ffeae12734 100644
--- a/sys/dev/efidev/efirt.c
+++ b/sys/dev/efidev/efirt.c
@@ -309,6 +309,9 @@ efi_enter(void)
                fpu_kern_leave(td, NULL);
                mtx_unlock(&efi_lock);
                PMAP_UNLOCK(curpmap);
+       } else {
+               MPASS((td->td_pflags2 & TDP2_EFIRT) == 0);
+               td->td_pflags2 |= TDP2_EFIRT;
        }
        return (error);
 }
@@ -319,10 +322,13 @@ efi_leave(void)
        struct thread *td;
        pmap_t curpmap;
 
+       td = curthread;
+       MPASS((td->td_pflags2 & TDP2_EFIRT) == 0);
+       td->td_pflags2 &= ~TDP2_EFIRT;
+
        efi_arch_leave();
 
        curpmap = &curproc->p_vmspace->vm_pmap;
-       td = curthread;
        fpu_kern_leave(td, NULL);
        mtx_unlock(&efi_lock);
        PMAP_UNLOCK(curpmap);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index f794cbe17442..3815571cd46f 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -567,6 +567,7 @@ enum {
 #define        TDP2_SBPAGES    0x00000001 /* Owns sbusy on some pages */
 #define        TDP2_COMPAT32RB 0x00000002 /* compat32 ABI for robust lists */
 #define        TDP2_ACCT       0x00000004 /* Doing accounting */
+#define        TDP2_EFIRT      0x20000000 /* In firmware (EFI RT) call */
 
 /*
  * Reasons that the current thread can not be run yet.

Reply via email to