Print this page
8956 Implement KPTI
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
@@ -20,10 +20,11 @@
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2018 Joyent, Inc.
*/
#if defined(__lint)
@@ -50,10 +51,13 @@
movb val, %al; \
outb $0x80;
#define DISABLE_PAGING \
+ movl %cr4, %eax ;\
+ btrl $17, %eax /* clear PCIDE bit */ ;\
+ movl %eax, %cr4 ;\
movl %cr0, %eax ;\
btrl $31, %eax /* clear PG bit */ ;\
movl %eax, %cr0
/*
@@ -220,10 +224,11 @@
/*
* Disable long mode by:
* - shutting down paging (bit 31 of cr0). This will flush the
* TLBs.
+ * - turning off PCID in cr4
* - disabling LME (long mode enable) in EFER (extended feature reg)
*/
#endif
DISABLE_PAGING /* clobbers %eax */