summaryrefslogtreecommitdiff
path: root/cache-utils.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-12-20 15:58:44 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2013-01-12 18:42:50 +0100
commitbaacf04799ace72a9c735dd9306a1ceaf305e7cf (patch)
tree5e6750afe4b31c4343f9dd4bc07827cbdcb51466 /cache-utils.c
parentf157ebba2de4a6225679e13cc1ce01ff5d147c76 (diff)
downloadqemu-baacf04799ace72a9c735dd9306a1ceaf305e7cf.tar.gz
build: move libqemuutil.a components to util/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'cache-utils.c')
-rw-r--r--cache-utils.c97
1 files changed, 0 insertions, 97 deletions
diff --git a/cache-utils.c b/cache-utils.c
deleted file mode 100644
index b94013a8cb..0000000000
--- a/cache-utils.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include "qemu/cache-utils.h"
-
-#if defined(_ARCH_PPC)
-struct qemu_cache_conf qemu_cache_conf = {
- .dcache_bsize = 16,
- .icache_bsize = 16
-};
-
-#if defined _AIX
-#include <sys/systemcfg.h>
-
-static void ppc_init_cacheline_sizes(void)
-{
- qemu_cache_conf.icache_bsize = _system_configuration.icache_line;
- qemu_cache_conf.dcache_bsize = _system_configuration.dcache_line;
-}
-
-#elif defined __linux__
-
-#define QEMU_AT_NULL 0
-#define QEMU_AT_DCACHEBSIZE 19
-#define QEMU_AT_ICACHEBSIZE 20
-
-static void ppc_init_cacheline_sizes(char **envp)
-{
- unsigned long *auxv;
-
- while (*envp++);
-
- for (auxv = (unsigned long *) envp; *auxv != QEMU_AT_NULL; auxv += 2) {
- switch (*auxv) {
- 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;
- }
- }
-}
-
-#elif defined __APPLE__
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
-
-static void ppc_init_cacheline_sizes(void)
-{
- size_t len;
- unsigned cacheline;
- int name[2] = { CTL_HW, HW_CACHELINE };
-
- len = sizeof(cacheline);
- if (sysctl(name, 2, &cacheline, &len, NULL, 0)) {
- perror("sysctl CTL_HW HW_CACHELINE failed");
- } else {
- qemu_cache_conf.dcache_bsize = cacheline;
- qemu_cache_conf.icache_bsize = cacheline;
- }
-}
-#endif
-
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
-
-static void ppc_init_cacheline_sizes(void)
-{
- size_t len = 4;
- unsigned cacheline;
-
- if (sysctlbyname ("machdep.cacheline_size", &cacheline, &len, NULL, 0)) {
- fprintf(stderr, "sysctlbyname machdep.cacheline_size failed: %s\n",
- strerror(errno));
- exit(1);
- }
-
- qemu_cache_conf.dcache_bsize = cacheline;
- qemu_cache_conf.icache_bsize = cacheline;
-}
-#endif
-
-#ifdef __linux__
-void qemu_cache_utils_init(char **envp)
-{
- ppc_init_cacheline_sizes(envp);
-}
-#else
-void qemu_cache_utils_init(char **envp)
-{
- (void) envp;
- ppc_init_cacheline_sizes();
-}
-#endif
-
-#endif /* _ARCH_PPC */