From 83ba1468ab9d92804507ce44f31965f51252c9d4 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 3 Nov 2019 11:52:50 +0000 Subject: [PATCH] amd64: Store %cr3 into pcpu saved_ucr3 on double fault. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/exception.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S index 12ff584d1a22..6a0b09a474f2 100644 --- a/sys/amd64/amd64/exception.S +++ b/sys/amd64/amd64/exception.S @@ -349,6 +349,8 @@ IDTVEC(dblfault) jz 1f /* already running with kernel GS.base */ swapgs 1: lfence + movq %cr3,%rax + movq %rax,PCPU(SAVED_UCR3) movq PCPU(KCR3),%rax cmpq $~0,%rax je 2f