aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2024-11-21 19:40:18 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2024-11-21 22:05:28 +0000
commita03957a706a05bb0c2f627183b19d84f6d96dbb7 (patch)
tree1c8248636118844c12a67c01fe4f7081b203c537
parent38e3125d6df98919983ed800471673ff0e5c2337 (diff)
downloadsrc-a03957a706a05bb0c2f627183b19d84f6d96dbb7.tar.gz
src-a03957a706a05bb0c2f627183b19d84f6d96dbb7.zip
efirt: mark dynamic region executing the RT code with the TDP_EFIRT flag
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47694
-rw-r--r--sys/dev/efidev/efirt.c8
-rw-r--r--sys/sys/proc.h2
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/efidev/efirt.c b/sys/dev/efidev/efirt.c
index 2d45b4d6ac66..37b46ec38dad 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_pflags & TDP_EFIRT) == 0);
+ td->td_pflags |= TDP_EFIRT;
}
return (error);
}
@@ -319,10 +322,13 @@ efi_leave(void)
struct thread *td;
pmap_t curpmap;
+ td = curthread;
+ MPASS((td->td_pflags & TDP_EFIRT) == 0);
+ td->td_pflags &= ~TDP_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 a69eecbb4661..69b6c7a61da0 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -560,7 +560,7 @@ enum {
#define TDP_RESETSPUR 0x04000000 /* Reset spurious page fault history. */
#define TDP_NERRNO 0x08000000 /* Last errno is already in td_errno */
#define TDP_UIOHELD 0x10000000 /* Current uio has pages held in td_ma */
-#define TDP_UNUSED0 0x20000000 /* UNUSED */
+#define TDP_EFIRT 0x20000000 /* In firmware (EFI RT) call */
#define TDP_EXECVMSPC 0x40000000 /* Execve destroyed old vmspace */
#define TDP_SIGFASTPENDING 0x80000000 /* Pending signal due to sigfastblock */