paste_last_unaligned.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright 2016, Chris Smart, 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. * Calls to paste_last which are not 128-byte aligned should be
  10. * caught and sent a SIGBUS.
  11. *
  12. */
  13. #include <string.h>
  14. #include <unistd.h>
  15. #include "utils.h"
  16. #include "instructions.h"
  17. #include "copy_paste_unaligned_common.h"
  18. unsigned int expected_instruction = PPC_INST_PASTE_LAST;
  19. unsigned int instruction_mask = 0xfc2007ff;
  20. int test_paste_last_unaligned(void)
  21. {
  22. /* Only run this test on a P9 or later */
  23. SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_00));
  24. /* Register our signal handler with SIGBUS */
  25. setup_signal_handler();
  26. copy(cacheline_buf);
  27. /* +1 makes buf unaligned */
  28. paste_last(cacheline_buf+1);
  29. /* We should not get here */
  30. return 1;
  31. }
  32. int main(int argc, char *argv[])
  33. {
  34. return test_harness(test_paste_last_unaligned, "test_paste_last_unaligned");
  35. }