efirt efi_enter(): Release acquired locks and restore FPU ownership if

efi_arch_enter() returned an error.

Submitted:	Jan Martin Mikkelsen <janm@transactionware.com>
MFC after:	1 week
This commit is contained in:
Konstantin Belousov
2019-06-03 15:41:45 +00:00
parent e1216db508
commit b5c45a3e12
+8 -1
View File
@@ -275,6 +275,7 @@ efi_enter(void)
{
struct thread *td;
pmap_t curpmap;
int error;
if (efi_runtime == NULL)
return (ENXIO);
@@ -283,7 +284,13 @@ efi_enter(void)
PMAP_LOCK(curpmap);
mtx_lock(&efi_lock);
fpu_kern_enter(td, NULL, FPU_KERN_NOCTX);
return (efi_arch_enter());
error = efi_arch_enter();
if (error != 0) {
fpu_kern_leave(td, NULL);
mtx_unlock(&efi_lock);
PMAP_UNLOCK(curpmap);
}
return (error);
}
static void