lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e40a85582eb46ad8e10e49a5dc296af588e1965d.1387336613.git.lv.zheng@intel.com>
Date:	Wed, 18 Dec 2013 17:06:57 +0800
From:	Lv Zheng <lv.zheng@...el.com>
To:	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Len Brown <len.brown@...el.com>
Cc:	Lv Zheng <lv.zheng@...el.com>, Lv Zheng <zetalog@...il.com>,
	<linux-kernel@...r.kernel.org>, linux-acpi@...r.kernel.org
Subject: [RFC PATCH 11/15] ACPICA: Linux: Add stub implementation of ACPICA 64-bit mathematics.

This patch adds default 64-bit mathematics in aclinux.h using do_div.  As
do_div can be used for all Linux architectures, this can also be used as
stub macros for ACPICA 64-bit mathematics.

Signed-off-by: Lv Zheng <lv.zheng@...el.com>
---
 arch/ia64/include/asm/acenv.h   |    2 ++
 arch/x86/include/asm/acenv.h    |    4 ++++
 include/acpi/platform/aclinux.h |   29 +++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/arch/ia64/include/asm/acenv.h b/arch/ia64/include/asm/acenv.h
index eb13318..f142a9d 100644
--- a/arch/ia64/include/asm/acenv.h
+++ b/arch/ia64/include/asm/acenv.h
@@ -66,6 +66,8 @@ ia64_acpi_release_global_lock (unsigned int *lock)
 #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq)				\
 	((Acq) = ia64_acpi_release_global_lock(&facs->global_lock))
 
+#define ARCH_HAS_ACPI_GLOBAL_LOCK 1
+
 #endif
 
 #endif /* _ASM_IA64_ACENV_H */
diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h
index 2359989..a85b478 100644
--- a/arch/x86/include/asm/acenv.h
+++ b/arch/x86/include/asm/acenv.h
@@ -45,6 +45,8 @@ int __acpi_release_global_lock(unsigned int *lock);
 #define ACPI_RELEASE_GLOBAL_LOCK(facs, Acq) \
 	((Acq) = __acpi_release_global_lock(&facs->global_lock))
 
+#define ARCH_HAS_ACPI_GLOBAL_LOCK 1
+
 /*
  * Math helper asm macros
  */
@@ -61,6 +63,8 @@ int __acpi_release_global_lock(unsigned int *lock);
 	    : "=r"(n_hi), "=r"(n_lo)	\
 	    : "0"(n_hi), "1"(n_lo))
 
+#define ARCH_HAS_ACPI_MATH64_HELPER 1
+
 #endif
 
 #endif /* _ASM_X86_ACENV_H */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index e9e6374..8176181 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -221,6 +221,35 @@
 #define acpi_spinlock                       spinlock_t *
 #define acpi_cpu_flags                      unsigned long
 
+#if ACPI_MACHINE_WIDTH == 64
+
+#ifndef ARCH_HAS_ACPI_MATH64_HELPER
+
+/* Default to ACPI_USE_NATIVE_DIVIDE support */
+
+#define ARCH_HAS_ACPI_MATH64_HELPER
+
+#endif
+
+#endif
+
+#ifndef ARCH_HAS_ACPI_MATH64_HELPER
+
+#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
+	do { \
+		u64 __dividend = (((u64)(n_hi) << 32) | (n_lo)); \
+		(r32) = do_div(__dividend, (d32)); \
+		(q32) = (u32)__dividend; \
+	} while (0)
+
+#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+	do { \
+		(n_lo) = ((n_lo) >> 1) | (((n_hi) & 1) << 31); \
+		(n_hi) >>= 1; \
+	} while (0)
+
+#endif
+
 #else				/* !__KERNEL__ */
 
 #include <stdarg.h>
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ