[Liboil] [patch] liboil: make oil_cpu_detect_arch() un-static

Robert Schwebel r.schwebel at pengutronix.de
Fri Feb 22 16:16:23 PST 2008


From: Robert Schwebel <r.schwebel at pengutronix.de>

Looks like ARM was forgotten while converting oil_cpu_detect_arch().
Additionally, arm still needs get_rpoc_cpuinfo().

Signed-off-by: Robert Schwebel <r.schwebel at pengutronix.de>

---
 liboil/liboilcpu-arm.c |   35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

Index: liboil-0.3.13/liboil/liboilcpu-arm.c
===================================================================
--- liboil-0.3.13.orig/liboil/liboilcpu-arm.c	2008-02-22 20:59:17.000000000 +0100
+++ liboil-0.3.13/liboil/liboilcpu-arm.c	2008-02-23 01:01:48.000000000 +0100
@@ -60,10 +60,6 @@
  *
  */
 
-static void oil_cpu_detect_arch(void);
-
-static unsigned long oil_cpu_flags;
-
 extern unsigned long (*_oil_profile_stamp)(void);
 
 #if defined(__arm__)
@@ -126,6 +122,35 @@
   free (cpuinfo_flags);
 }
 
+static char *
+get_proc_cpuinfo (void)
+{
+  char *cpuinfo;
+  int fd;
+  int n;
+
+  cpuinfo = malloc(4096);
+  if (cpuinfo == NULL) return NULL;
+
+  fd = open("/proc/cpuinfo", O_RDONLY);
+  if (fd < 0) {
+    free (cpuinfo);
+    return NULL;
+  }
+
+  n = read(fd, cpuinfo, 4095);
+  if (n < 0) {
+    free (cpuinfo);
+    close (fd);
+    return NULL;
+  }
+  cpuinfo[n] = 0;
+
+  close (fd);
+
+  return cpuinfo;
+}
+
 static void
 oil_cpu_detect_arm(void)
 {
@@ -249,7 +274,7 @@
 }
 #endif
 
-static void
+void
 oil_cpu_detect_arch(void)
 {
 #if defined(__i386__) || defined(__amd64__)


More information about the Liboil mailing list