xref: /linux/tools/testing/selftests/powerpc/ptrace/ptrace-tar.h (revision 48dea9a700c8728cc31a1dd44588b97578de86ee)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (C) 2015 Anshuman Khandual, IBM Corporation.
4  */
5 #define TAR_1   10
6 #define TAR_2   20
7 #define TAR_3   30
8 #define TAR_4   40
9 #define TAR_5   50
10 
11 #define DSCR_1  100
12 #define DSCR_2  200
13 #define DSCR_3  300
14 #define DSCR_4  400
15 #define DSCR_5  500
16 
17 #define PPR_1   0x4000000000000         /* or 31,31,31*/
18 #define PPR_2   0x8000000000000         /* or 1,1,1 */
19 #define PPR_3   0xc000000000000         /* or 6,6,6 */
20 #define PPR_4   0x10000000000000        /* or 2,2,2 */
21 
22 char *user_read = "[User Read (Running)]";
23 char *user_write = "[User Write (Running)]";
24 char *ptrace_read_running = "[Ptrace Read (Running)]";
25 char *ptrace_write_running = "[Ptrace Write (Running)]";
26 char *ptrace_read_ckpt = "[Ptrace Read (Checkpointed)]";
27 char *ptrace_write_ckpt = "[Ptrace Write (Checkpointed)]";
28 
29 int validate_tar_registers(unsigned long *reg, unsigned long tar,
30 				unsigned long ppr, unsigned long dscr)
31 {
32 	int match = 1;
33 
34 	if (reg[0] != tar)
35 		match = 0;
36 
37 	if (reg[1] != ppr)
38 		match = 0;
39 
40 	if (reg[2] != dscr)
41 		match = 0;
42 
43 	if (!match)
44 		return TEST_FAIL;
45 	return TEST_PASS;
46 }
47