1#include "common.h"
2
3/*
4 * Checks that registers contain what we expect, ie. they were not clobbered by
5 * the syscall.
6 *
7 * r15: pattern to check registers against.
8 *
9 * At the end r3 == 0 if everything's OK.
10 */
11	nop			# guaranteed to be illegal in reverse-endian
12	mr	r9,r15
13	cmpd    r9,r3		# check r3
14	bne     1f
15	addi    r9,r15,4	# check r4
16	cmpd    r9,r4
17	bne     1f
18	lis     r9,0x00FF	# check CR
19	ori     r9,r9,0xF000
20	mfcr    r10
21	and     r10,r10,r9
22	cmpw    r9,r10
23	addi    r9,r15,34
24	bne     1f
25	addi    r9,r15,32	# check LR
26	mflr    r10
27	cmpd    r9,r10
28	bne     1f
29	addi    r9,r15,5	# check r5
30	cmpd    r9,r5
31	bne     1f
32	addi    r9,r15,6	# check r6
33	cmpd    r9,r6
34	bne     1f
35	addi    r9,r15,7	# check r7
36	cmpd    r9,r7
37	bne     1f
38	addi    r9,r15,8	# check r8
39	cmpd    r9,r8
40	bne     1f
41	addi    r9,r15,13	# check r13
42	cmpd    r9,r13
43	bne     1f
44	addi    r9,r15,14	# check r14
45	cmpd    r9,r14
46	bne     1f
47	addi    r9,r15,16	# check r16
48	cmpd    r9,r16
49	bne     1f
50	addi    r9,r15,17	# check r17
51	cmpd    r9,r17
52	bne     1f
53	addi    r9,r15,18	# check r18
54	cmpd    r9,r18
55	bne     1f
56	addi    r9,r15,19	# check r19
57	cmpd    r9,r19
58	bne     1f
59	addi    r9,r15,20	# check r20
60	cmpd    r9,r20
61	bne     1f
62	addi    r9,r15,21	# check r21
63	cmpd    r9,r21
64	bne     1f
65	addi    r9,r15,22	# check r22
66	cmpd    r9,r22
67	bne     1f
68	addi    r9,r15,23	# check r23
69	cmpd    r9,r23
70	bne     1f
71	addi    r9,r15,24	# check r24
72	cmpd    r9,r24
73	bne     1f
74	addi    r9,r15,25	# check r25
75	cmpd    r9,r25
76	bne     1f
77	addi    r9,r15,26	# check r26
78	cmpd    r9,r26
79	bne     1f
80	addi    r9,r15,27	# check r27
81	cmpd    r9,r27
82	bne     1f
83	addi    r9,r15,28	# check r28
84	cmpd    r9,r28
85	bne     1f
86	addi    r9,r15,29	# check r29
87	cmpd    r9,r29
88	bne     1f
89	addi    r9,r15,30	# check r30
90	cmpd    r9,r30
91	bne     1f
92	addi    r9,r15,31	# check r31
93	cmpd    r9,r31
94	bne     1f
95	b	2f
961:	mr	r3, r9
97	li	r0, __NR_exit
98	sc
992:	li	r0, __NR_switch_endian
100	nop
101