shithub: riscv

Download patch

ref: 263dc8093d7eeece36160515b3a4f76a95352050
parent: 4db8a82f5a5afbd72abb6d251f67edb0b251d556
author: cinap_lenrek <[email protected]>
date: Tue Dec 8 11:00:57 EST 2020

pc64: preserve reserved bits in CR0/CR4 for amd64 in mtrr setstate()

On AMD64, CR0/CR4 are 64-bit registers, with
the upper half reserved. So use uintptr type
to store the register values to get 32 bit on 386
and 64 bit on AMD64.

--- a/sys/src/9/pc/mtrr.c
+++ b/sys/src/9/pc/mtrr.c
@@ -354,7 +354,7 @@
 static void
 putstate(State *s)
 {
-	ulong cr0, cr4;
+	uintptr cr0, cr4;
 	int i, x;
 
 	x = splhi();