Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/x86 Use roundup2() instead of hardcoding the CA...



details:   https://anonhg.NetBSD.org/src/rev/d7e9f6c3b4be
branches:  trunk
changeset: 752659:d7e9f6c3b4be
user:      jym <jym%NetBSD.org@localhost>
date:      Wed Mar 03 00:09:03 2010 +0000

description:
Use roundup2() instead of hardcoding the CACHE_LINE_SIZE rounding
operation.

diffstat:

 sys/arch/xen/x86/cpu.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (38 lines):

diff -r fda38f134786 -r d7e9f6c3b4be sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Wed Mar 03 00:01:20 2010 +0000
+++ b/sys/arch/xen/x86/cpu.c    Wed Mar 03 00:09:03 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.41 2010/02/24 22:37:55 dyoung Exp $  */
+/*     $NetBSD: cpu.c,v 1.42 2010/03/03 00:09:03 jym Exp $     */
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.41 2010/02/24 22:37:55 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.42 2010/03/03 00:09:03 jym Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -236,8 +236,7 @@
                aprint_naive(": Application Processor\n");
                ptr = (uintptr_t)kmem_zalloc(sizeof(*ci) + CACHE_LINE_SIZE - 1,
                    KM_SLEEP);
-               ci = (struct cpu_info *)((ptr + CACHE_LINE_SIZE - 1) &
-                   ~(CACHE_LINE_SIZE - 1));
+               ci = (struct cpu_info *)roundup2(ptr, CACHE_LINE_SIZE);
                ci->ci_curldt = -1;
        } else {
                aprint_naive(": %s Processor\n",
@@ -372,8 +371,7 @@
                aprint_naive(": Application Processor\n");
                ptr = (uintptr_t)kmem_alloc(sizeof(*ci) + CACHE_LINE_SIZE - 1,
                    KM_SLEEP);
-               ci = (struct cpu_info *)((ptr + CACHE_LINE_SIZE - 1) &
-                   ~(CACHE_LINE_SIZE - 1));
+               ci = (struct cpu_info *)roundup2(ptr, CACHE_LINE_SIZE);
                memset(ci, 0, sizeof(*ci));
 #ifdef TRAPLOG
                ci->ci_tlog_base = kmem_zalloc(sizeof(struct tlog), KM_SLEEP);



Home | Main Index | Thread Index | Old Index