diff options
author | 2010-01-27 05:35:02 +0000 | |
---|---|---|
committer | 2010-01-27 05:35:02 +0000 | |
commit | a5a6fd38e19fbb3a80b59855dbb7e40c40c61e0f (patch) | |
tree | 7af84d6fce69c286da4b175461a55d982b093848 | |
parent | 4.7-BETA (also, lo-carb and ozone layer friendly) (diff) | |
download | wireguard-openbsd-a5a6fd38e19fbb3a80b59855dbb7e40c40c61e0f.tar.xz wireguard-openbsd-a5a6fd38e19fbb3a80b59855dbb7e40c40c61e0f.zip |
disable interrupts in rdmsr() and wrmsr() so that their operation does not
risk being interrupted.
-rw-r--r-- | sys/arch/loongson/dev/glx.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/arch/loongson/dev/glx.c b/sys/arch/loongson/dev/glx.c index 6db5b8a523f..215153d0bd4 100644 --- a/sys/arch/loongson/dev/glx.c +++ b/sys/arch/loongson/dev/glx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glx.c,v 1.1.1.1 2009/12/25 22:11:08 miod Exp $ */ +/* $OpenBSD: glx.c,v 1.2 2010/01/27 05:35:02 miod Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -112,25 +112,36 @@ uint64_t rdmsr(uint msr) { uint64_t lo, hi; + uint32_t sr; +#ifdef DIAGNOSTIC if (glxbase_tag == 0) panic("rdmsr invoked before glx initialization"); +#endif + sr = disableintr(); pci_conf_write(glxbase_pc, glxbase_tag, PCI_MSR_ADDR, msr); lo = (uint32_t)pci_conf_read(glxbase_pc, glxbase_tag, PCI_MSR_LO32); hi = (uint32_t)pci_conf_read(glxbase_pc, glxbase_tag, PCI_MSR_HI32); + setsr(sr); return (hi << 32) | lo; } void wrmsr(uint msr, uint64_t value) { + uint32_t sr; + +#ifdef DIAGNOSTIC if (glxbase_tag == 0) - panic("rdmsr invoked before glx initialization"); + panic("wrmsr invoked before glx initialization"); +#endif + sr = disableintr(); pci_conf_write(glxbase_pc, glxbase_tag, PCI_MSR_ADDR, msr); pci_conf_write(glxbase_pc, glxbase_tag, PCI_MSR_LO32, (uint32_t)value); pci_conf_write(glxbase_pc, glxbase_tag, PCI_MSR_HI32, value >> 32); + setsr(sr); } int |