From 4ae46f175424455223efc4900a37984cb683378d Mon Sep 17 00:00:00 2001 From: msmith Date: Fri, 2 Feb 2001 08:31:50 +0000 Subject: Patch the reintroduced (~0 << 32) == 1 bug with a cryptic but functional version. This should fix the read-before-write problem again. Obtained from: "Adam J. Richter" --- sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c | 3 ++- sys/contrib/dev/acpica/exfldio.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/contrib') diff --git a/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c b/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c index ad40aec..b8583d8 100644 --- a/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c +++ b/sys/contrib/dev/acpica/Subsystem/Interpreter/amfldio.c @@ -572,7 +572,8 @@ AcpiAmlWriteFieldDataWithUpdateRule ( /* Check if update rule needs to be applied (not if mask is all ones) */ - if (((1 << BitGranularity) -1) & ~Mask) + /* The left shift drops the bits we want to ignore. */ + if ((~Mask << (sizeof(Mask) * 8 - BitGranularity)) != 0) { /* * Read the current contents of the byte/word/dword containing diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index ad40aec..b8583d8 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -572,7 +572,8 @@ AcpiAmlWriteFieldDataWithUpdateRule ( /* Check if update rule needs to be applied (not if mask is all ones) */ - if (((1 << BitGranularity) -1) & ~Mask) + /* The left shift drops the bits we want to ignore. */ + if ((~Mask << (sizeof(Mask) * 8 - BitGranularity)) != 0) { /* * Read the current contents of the byte/word/dword containing -- cgit v1.1