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); } }