linux/tools/testing/selftests/powerpc/ptrace/ptrace-tar.h
<<
>>
Prefs
   1/*
   2 * Copyright (C) 2015 Anshuman Khandual, IBM Corporation.
   3 *
   4 * This program is free software; you can redistribute it and/or
   5 * modify it under the terms of the GNU General Public License
   6 * as published by the Free Software Foundation; either version
   7 * 2 of the License, or (at your option) any later version.
   8 */
   9#define TAR_1   10
  10#define TAR_2   20
  11#define TAR_3   30
  12#define TAR_4   40
  13#define TAR_5   50
  14
  15#define DSCR_1  100
  16#define DSCR_2  200
  17#define DSCR_3  300
  18#define DSCR_4  400
  19#define DSCR_5  500
  20
  21#define PPR_1   0x4000000000000         /* or 31,31,31*/
  22#define PPR_2   0x8000000000000         /* or 1,1,1 */
  23#define PPR_3   0xc000000000000         /* or 6,6,6 */
  24#define PPR_4   0x10000000000000        /* or 2,2,2 */
  25
  26char *user_read = "[User Read (Running)]";
  27char *user_write = "[User Write (Running)]";
  28char *ptrace_read_running = "[Ptrace Read (Running)]";
  29char *ptrace_write_running = "[Ptrace Write (Running)]";
  30char *ptrace_read_ckpt = "[Ptrace Read (Checkpointed)]";
  31char *ptrace_write_ckpt = "[Ptrace Write (Checkpointed)]";
  32
  33int validate_tar_registers(unsigned long *reg, unsigned long tar,
  34                                unsigned long ppr, unsigned long dscr)
  35{
  36        int match = 1;
  37
  38        if (reg[0] != tar)
  39                match = 0;
  40
  41        if (reg[1] != ppr)
  42                match = 0;
  43
  44        if (reg[2] != dscr)
  45                match = 0;
  46
  47        if (!match)
  48                return TEST_FAIL;
  49        return TEST_PASS;
  50}
  51