Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/include Do as the comment says, use ilog2(). Th...



details:   https://anonhg.NetBSD.org/src/rev/c1191369da41
branches:  trunk
changeset: 764836:c1191369da41
user:      jym <jym%NetBSD.org@localhost>
date:      Sat May 07 23:59:13 2011 +0000

description:
Do as the comment says, use ilog2(). This gets optimized directly at
compile time, no call to fls() is needed.

diffstat:

 sys/arch/x86/include/pmap.h |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (27 lines):

diff -r 6e9ba8af122a -r c1191369da41 sys/arch/x86/include/pmap.h
--- a/sys/arch/x86/include/pmap.h       Sat May 07 19:15:48 2011 +0000
+++ b/sys/arch/x86/include/pmap.h       Sat May 07 23:59:13 2011 +0000
@@ -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 */
 



Home | Main Index | Thread Index | Old Index