1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "io.h"
static int
identify(void)
{
m->havepge = 0;
return 0;
}
static void
intrinit(void)
{
ulong machs;
int i, ncpu;
char *cp;
char node[32];
char buf[32];
if((cp = getconf("*nomp")) != nil && strtol(cp, 0, 0) != 0)
return;
ncpu = MAX_VIRT_CPUS;
if (cp = getconf("*ncpu")) {
ncpu = strtol(cp, 0, 0);
if (ncpu < 1)
ncpu = 1;
}
machs = 1;
for (i = 1; i < ncpu; i++) {
sprint(node, "cpu/%d/availability", i);
if (xenstore_read(node, buf, sizeof buf) <= 0)
break;
print("%s: %s\n", node, buf);
if (strcmp(buf, "online") == 0) {
machs |= 1<<i;
conf.nmach++;
}
}
if (conf.nmach > 1) {
print("Sorry, SMP not supported yet: 1 of %lud CPUs startd\n", conf.nmach);
conf.nmach = 1;
}
}
static void
shutdown(void)
{
HYPERVISOR_shutdown(1);
}
int xenintrenable(Vctl *v);
int xenintrvecno(int irq);
int xenintrdisable(int irq);
void xentimerenable(void);
uvlong xentimerread(uvlong*);
void xentimerset(uvlong);
PCArch archxen = {
.id= "Xen",
.ident= identify,
.reset= shutdown,
.intrinit= intrinit,
.intrenable= xenintrenable,
.intrvecno= xenintrvecno,
.intrdisable= xenintrdisable,
.clockenable= xentimerenable,
.fastclock= xentimerread,
.timerset= xentimerset,
};
/*
* Placeholders to satisfy external references in generic devarch.c
*/
ulong getcr4(void) { return 0; }
void putcr4(ulong) {}
int inb(int) { return 0; }
ushort ins(int) { return 0; }
ulong inl(int) { return 0; }
void outb(int, int) {}
void outs(int, ushort) {}
void outl(int, ulong) {}
void i8042reset(void) {}
void i8253enable(void) {}
void i8253init(void) {}
void i8253link(void) {}
uvlong i8253read(uvlong*) { return 0; }
void i8253timerset(uvlong) {}
int i8259disable(int) { return 0; }
int i8259enable(Vctl*) { return 0; }
void i8259init(void) {}
int i8259isr(int) { return 0; }
void i8259on(void) {}
void i8259off(void) {}
int i8259vecno(int) { return 0; }
int mtrrprint(char*, long) { return 0; }
char* mtrr(uvlong, uvlong, char *) { return nil; }
void mtrrsync(void) {}
/*
* XXX until fpsave is debugged
*/
void
fpssesave(FPsave* f)
{
fpx87save(f);
}
void
fpsserestore(FPsave* f)
{
fpx87restore(f);
}
|