ptrace-gpr.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 GPR_1 1
  10. #define GPR_2 2
  11. #define GPR_3 3
  12. #define GPR_4 4
  13. #define FPR_1 0.001
  14. #define FPR_2 0.002
  15. #define FPR_3 0.003
  16. #define FPR_4 0.004
  17. #define FPR_1_REP 0x3f50624de0000000
  18. #define FPR_2_REP 0x3f60624de0000000
  19. #define FPR_3_REP 0x3f689374c0000000
  20. #define FPR_4_REP 0x3f70624de0000000
  21. /* Buffer must have 18 elements */
  22. int validate_gpr(unsigned long *gpr, unsigned long val)
  23. {
  24. int i, found = 1;
  25. for (i = 0; i < 18; i++) {
  26. if (gpr[i] != val) {
  27. printf("GPR[%d]: %lx Expected: %lx\n",
  28. i+14, gpr[i], val);
  29. found = 0;
  30. }
  31. }
  32. if (!found)
  33. return TEST_FAIL;
  34. return TEST_PASS;
  35. }
  36. /* Buffer must have 32 elements */
  37. int validate_fpr(unsigned long *fpr, unsigned long val)
  38. {
  39. int i, found = 1;
  40. for (i = 0; i < 32; i++) {
  41. if (fpr[i] != val) {
  42. printf("FPR[%d]: %lx Expected: %lx\n", i, fpr[i], val);
  43. found = 0;
  44. }
  45. }
  46. if (!found)
  47. return TEST_FAIL;
  48. return TEST_PASS;
  49. }
  50. /* Buffer must have 32 elements */
  51. int validate_fpr_float(float *fpr, float val)
  52. {
  53. int i, found = 1;
  54. for (i = 0; i < 32; i++) {
  55. if (fpr[i] != val) {
  56. printf("FPR[%d]: %f Expected: %f\n", i, fpr[i], val);
  57. found = 0;
  58. }
  59. }
  60. if (!found)
  61. return TEST_FAIL;
  62. return TEST_PASS;
  63. }