Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_unix/sys/src/9/teg2/notes/byte-order – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
static void
2
forcele(void)
3
{
4
#ifdef BIGENDCHECK
5
	union {
6
		ulong 	ul;
7
		uchar	uc[sizeof(ulong)];
8
	} u;
9
 
10
	u.ul = 0;
11
	coherence();
12
	u.uc[0] = 1;
13
	coherence();
14
	if (u.ul == 1)
15
		return;
16
 
17
	emerge('?');
18
	emerge('e');
19
	if ((u.ul & MASK(8)) == 0) {
20
		emerge('B');
21
		panic("rdbaseticks: cpu%d is big-endian", m->machno);
22
	} else {
23
		emerge('W');
24
		panic("rdbaseticks: cpu%d is whacked-endian", m->machno);
25
	}
26
#endif
27
}
28
 
29
void
30
ckbigendian(char *state)
31
{
32
	int wrong;
33
 
34
	wrong = 0;
35
	if (getpsr() & PsrBigend) {
36
		setendlittle();
37
		wrong++;
38
		wave('?');
39
		wave('e');
40
		wave('p');
41
		if (state == nil)
42
			state = "running";
43
		iprint("cpu%d: %s in big-endian mode\n", m->machno, state);
44
	}
45
	if (controlget() & CpCee) {
46
		wrong++;
47
		wave('?');
48
		wave('e');
49
		wave('e');
50
		if (state == nil)
51
			state = "running";
52
		iprint("cpu%d: %s with big-endian exceptions\n", m->machno, state);
53
	}
54
	if (wrong) {
55
		dumpstack();
56
		delay(3000);
57
		panic("cpu%d: big-endian", m->machno);
58
	}
59
}