2 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
7 #include "linux/sched.h"
8 #include "linux/errno.h"
9 #include "asm/system.h"
11 #include "sysdep/ptrace.h"
14 void arch_init_thread(void)
18 void arch_check_bugs(void)
22 int arch_handle_signal(int sig, union uml_pt_regs *regs)
29 /* Set during early boot */
30 int host_has_cmov = 1;
33 static char token(int fd, char *buf, int len, char stop)
41 n = os_read_file(fd, ptr, sizeof(*ptr));
43 if(n != sizeof(*ptr)){
45 printk("Reading /proc/cpuinfo failed, err = %d\n", -n);
51 } while((c != '\n') && (c != stop) && (ptr < end));
54 printk("Failed to find '%c' in /proc/cpuinfo\n", stop);
61 static int find_cpuinfo_line(int fd, char *key, char *scratch, int len)
66 scratch[len - 1] = '\0';
68 c = token(fd, scratch, len - 1, ':');
72 printk("Failed to find ':' in /proc/cpuinfo\n");
76 if(!strncmp(scratch, key, strlen(key)))
80 n = os_read_file(fd, &c, sizeof(c));
82 printk("Failed to find newline in "
83 "/proc/cpuinfo, err = %d\n", -n);
91 int cpu_feature(char *what, char *buf, int len)
95 fd = os_open_file("/proc/cpuinfo", of_read(OPENFLAGS()), 0);
97 printk("Couldn't open /proc/cpuinfo, err = %d\n", -fd);
101 if(!find_cpuinfo_line(fd, what, buf, len)){
102 printk("Couldn't find '%s' line in /proc/cpuinfo\n", what);
106 token(fd, buf, len, '\n');
114 /* Overrides for Emacs so that we follow Linus's tabbing style.
115 * Emacs will notice this stuff at the end of the file and automatically
116 * adjust the settings for this buffer only. This must remain at the end
118 * ---------------------------------------------------------------------------
120 * c-file-style: "linux"