Module Name: src
Committed By: jym
Date: Sat May 7 23:59:13 UTC 2011
Modified Files:
src/sys/arch/x86/include: pmap.h
Log Message:
Do as the comment says, use ilog2(). This gets optimized directly at
compile time, no call to fls() is needed.
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x86/include/pmap.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.37 src/sys/arch/x86/include/pmap.h:1.38
--- src/sys/arch/x86/include/pmap.h:1.37 Mon Apr 25 22:24:36 2011
+++ src/sys/arch/x86/include/pmap.h Sat May 7 23:59:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.37 2011/04/25 22:24:36 yamt Exp $ */
+/* $NetBSD: pmap.h,v 1.38 2011/05/07 23:59:13 jym Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -372,13 +372,11 @@
#ifdef XEN
+#include <sys/bitops.h>
+
#define XPTE_MASK L1_FRAME
-/* XPTE_SHIFT = L1_SHIFT - log2(sizeof(pt_entry_t)) */
-#if defined(__x86_64__) || defined(PAE)
-#define XPTE_SHIFT 9
-#else
-#define XPTE_SHIFT 10
-#endif
+/* Selects the index of a PTE in (A)PTE_BASE */
+#define XPTE_SHIFT (L1_SHIFT - ilog2(sizeof(pt_entry_t)))
/* PTE access inline fuctions */