aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-x86_64/bugs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/sys-x86_64/bugs.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/sys-x86_64/bugs.c')
-rw-r--r--arch/um/sys-x86_64/bugs.c122
1 files changed, 122 insertions, 0 deletions
diff --git a/arch/um/sys-x86_64/bugs.c b/arch/um/sys-x86_64/bugs.c
new file mode 100644
index 000000000000..fdce7ea98ca7
--- /dev/null
+++ b/arch/um/sys-x86_64/bugs.c
@@ -0,0 +1,122 @@
1/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#include "linux/sched.h"
8#include "linux/errno.h"
9#include "asm/system.h"
10#include "asm/pda.h"
11#include "sysdep/ptrace.h"
12#include "os.h"
13
14void arch_init_thread(void)
15{
16}
17
18void arch_check_bugs(void)
19{
20}
21
22int arch_handle_signal(int sig, union uml_pt_regs *regs)
23{
24 return(0);
25}
26
27#define MAXTOKEN 64
28
29/* Set during early boot */
30int host_has_cmov = 1;
31int host_has_xmm = 0;
32
33static char token(int fd, char *buf, int len, char stop)
34{
35 int n;
36 char *ptr, *end, c;
37
38 ptr = buf;
39 end = &buf[len];
40 do {
41 n = os_read_file(fd, ptr, sizeof(*ptr));
42 c = *ptr++;
43 if(n != sizeof(*ptr)){
44 if(n == 0) return(0);
45 printk("Reading /proc/cpuinfo failed, err = %d\n", -n);
46 if(n < 0)
47 return(n);
48 else
49 return(-EIO);
50 }
51 } while((c != '\n') && (c != stop) && (ptr < end));
52
53 if(ptr == end){
54 printk("Failed to find '%c' in /proc/cpuinfo\n", stop);
55 return(-1);
56 }
57 *(ptr - 1) = '\0';
58 return(c);
59}
60
61static int find_cpuinfo_line(int fd, char *key, char *scratch, int len)
62{
63 int n;
64 char c;
65
66 scratch[len - 1] = '\0';
67 while(1){
68 c = token(fd, scratch, len - 1, ':');
69 if(c <= 0)
70 return(0);
71 else if(c != ':'){
72 printk("Failed to find ':' in /proc/cpuinfo\n");
73 return(0);
74 }
75
76 if(!strncmp(scratch, key, strlen(key)))
77 return(1);
78
79 do {
80 n = os_read_file(fd, &c, sizeof(c));
81 if(n != sizeof(c)){
82 printk("Failed to find newline in "
83 "/proc/cpuinfo, err = %d\n", -n);
84 return(0);
85 }
86 } while(c != '\n');
87 }
88 return(0);
89}
90
91int cpu_feature(char *what, char *buf, int len)
92{
93 int fd, ret = 0;
94
95 fd = os_open_file("/proc/cpuinfo", of_read(OPENFLAGS()), 0);
96 if(fd < 0){
97 printk("Couldn't open /proc/cpuinfo, err = %d\n", -fd);
98 return(0);
99 }
100
101 if(!find_cpuinfo_line(fd, what, buf, len)){
102 printk("Couldn't find '%s' line in /proc/cpuinfo\n", what);
103 goto out_close;
104 }
105
106 token(fd, buf, len, '\n');
107 ret = 1;
108
109 out_close:
110 os_close_file(fd);
111 return(ret);
112}
113
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
117 * of the file.
118 * ---------------------------------------------------------------------------
119 * Local variables:
120 * c-file-style: "linux"
121 * End:
122 */