qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [5973] Introduce and use cache-utils.[ch]


From: Hollis Blanchard
Subject: Re: [Qemu-devel] [5973] Introduce and use cache-utils.[ch]
Date: Thu, 11 Dec 2008 12:19:23 -0600

On Wed, 2008-12-10 at 19:18 +0000, malc wrote:
> +#elif defined __linux__
> +#include <linux/auxvec.h>
> +
> +static void ppc_init_cacheline_sizes(char **envp)
> +{
> +    unsigned long *auxv;
> +
> +    while (*envp++);
> +
> +    for (auxv = (unsigned long *) envp; *auxv != AT_NULL; auxv += 2) {
> +        switch (*auxv) {
> +        case AT_DCACHEBSIZE: qemu_cache_conf.dcache_bsize = auxv[1]; break;
> +        case AT_ICACHEBSIZE: qemu_cache_conf.icache_bsize = auxv[1]; break;
> +        default: break;
> +        }
> +    }
> +}

I'm cross-compiling, and linux/auxvec.h was not installed with my glibc
headers. How about this:



Don't require linux/auxvec.h, which isn't always installed with libc.

Signed-off-by: Hollis Blanchard <address@hidden>

diff --git a/cache-utils.c b/cache-utils.c
index 0b4a5ac..7c98144 100644
--- a/cache-utils.c
+++ b/cache-utils.c
@@ -16,7 +16,10 @@ static void ppc_init_cacheline_sizes(void)
 }
 
 #elif defined __linux__
-#include <linux/auxvec.h>
+
+#define QEMU_AT_NULL        0
+#define QEMU_AT_DCACHEBSIZE 19
+#define QEMU_AT_ICACHEBSIZE 20
 
 static void ppc_init_cacheline_sizes(char **envp)
 {
@@ -24,10 +27,10 @@ static void ppc_init_cacheline_sizes(char **envp)
 
     while (*envp++);
 
-    for (auxv = (unsigned long *) envp; *auxv != AT_NULL; auxv += 2) {
+    for (auxv = (unsigned long *) envp; *auxv != QEMU_AT_NULL; auxv += 2) {
         switch (*auxv) {
-        case AT_DCACHEBSIZE: qemu_cache_conf.dcache_bsize = auxv[1]; break;
-        case AT_ICACHEBSIZE: qemu_cache_conf.icache_bsize = auxv[1]; break;
+        case QEMU_AT_DCACHEBSIZE: qemu_cache_conf.dcache_bsize = auxv[1]; break
+        case QEMU_AT_ICACHEBSIZE: qemu_cache_conf.icache_bsize = auxv[1]; break
         default: break;
         }
     }


-- 
Hollis Blanchard
IBM Linux Technology Center





reply via email to

[Prev in Thread] Current Thread [Next in Thread]