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