diff options
Diffstat (limited to 'tools/testing/selftests/powerpc/alignment/paste_unaligned.c')
-rw-r--r-- | tools/testing/selftests/powerpc/alignment/paste_unaligned.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/alignment/paste_unaligned.c b/tools/testing/selftests/powerpc/alignment/paste_unaligned.c new file mode 100644 index 000000000000..6f982b45e4bd --- /dev/null +++ b/tools/testing/selftests/powerpc/alignment/paste_unaligned.c | |||
@@ -0,0 +1,43 @@ | |||
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 which are not 128-byte aligned should be caught | ||
10 | * and sent a SIGBUS. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <string.h> | ||
15 | #include <unistd.h> | ||
16 | #include "utils.h" | ||
17 | #include "instructions.h" | ||
18 | #include "copy_paste_unaligned_common.h" | ||
19 | |||
20 | unsigned int expected_instruction = PPC_INST_PASTE; | ||
21 | unsigned int instruction_mask = 0xfc0007fe; | ||
22 | |||
23 | int test_paste_unaligned(void) | ||
24 | { | ||
25 | /* Only run this test on a P9 or later */ | ||
26 | SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_00)); | ||
27 | |||
28 | /* Register our signal handler with SIGBUS */ | ||
29 | setup_signal_handler(); | ||
30 | |||
31 | copy(cacheline_buf); | ||
32 | |||
33 | /* +1 makes buf unaligned */ | ||
34 | paste(cacheline_buf+1); | ||
35 | |||
36 | /* We should not get here */ | ||
37 | return 1; | ||
38 | } | ||
39 | |||
40 | int main(int argc, char *argv[]) | ||
41 | { | ||
42 | return test_harness(test_paste_unaligned, "test_paste_unaligned"); | ||
43 | } | ||