blob: 0c9aee2afbfeae7429708e0ea040d6834da9b2e3 (
plain)
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
|
static void
forcele(void)
{
#ifdef BIGENDCHECK
union {
ulong ul;
uchar uc[sizeof(ulong)];
} u;
u.ul = 0;
coherence();
u.uc[0] = 1;
coherence();
if (u.ul == 1)
return;
emerge('?');
emerge('e');
if ((u.ul & MASK(8)) == 0) {
emerge('B');
panic("rdbaseticks: cpu%d is big-endian", m->machno);
} else {
emerge('W');
panic("rdbaseticks: cpu%d is whacked-endian", m->machno);
}
#endif
}
void
ckbigendian(char *state)
{
int wrong;
wrong = 0;
if (getpsr() & PsrBigend) {
setendlittle();
wrong++;
wave('?');
wave('e');
wave('p');
if (state == nil)
state = "running";
iprint("cpu%d: %s in big-endian mode\n", m->machno, state);
}
if (controlget() & CpCee) {
wrong++;
wave('?');
wave('e');
wave('e');
if (state == nil)
state = "running";
iprint("cpu%d: %s with big-endian exceptions\n", m->machno, state);
}
if (wrong) {
dumpstack();
delay(3000);
panic("cpu%d: big-endian", m->machno);
}
}
|