1 #include "../multiarch/noexec.c.inc"
3 static void *arch_mcontext_pc(const mcontext_t
*ctx
)
5 return (void *)ctx
->psw
.addr
;
8 static int arch_mcontext_arg(const mcontext_t
*ctx
)
13 static void arch_flush(void *p
, int len
)
17 extern char noexec_1
[];
18 extern char noexec_2
[];
19 extern char noexec_end
[];
22 " lgfi %r2,1\n" /* %r2 is 0 on entry, set 1. */
24 " lgfi %r2,2\n" /* %r2 is 0/1; set 2. */
25 " br %r14\n" /* return */
30 extern char exrl_end
[];
41 struct noexec_test noexec_tests
[] = {
43 .name
= "fallthrough",
44 .test_code
= noexec_1
,
45 .test_len
= noexec_end
- noexec_1
,
46 .page_ofs
= noexec_1
- noexec_2
,
47 .entry_ofs
= noexec_1
- noexec_2
,
54 .test_code
= noexec_1
,
55 .test_len
= noexec_end
- noexec_1
,
56 .page_ofs
= noexec_1
- noexec_2
,
65 .test_len
= exrl_end
- exrl_1
,
66 .page_ofs
= exrl_1
- exrl_2
,
67 .entry_ofs
= exrl_1
- exrl_2
,
69 .expected_pc_ofs
= exrl_1
- exrl_2
,
73 .name
= "fallthrough [cross]",
74 .test_code
= noexec_1
,
75 .test_len
= noexec_end
- noexec_1
,
76 .page_ofs
= noexec_1
- noexec_2
- 2,
77 .entry_ofs
= noexec_1
- noexec_2
- 2,
79 .expected_pc_ofs
= -2,
83 .name
= "jump [cross]",
84 .test_code
= noexec_1
,
85 .test_len
= noexec_end
- noexec_1
,
86 .page_ofs
= noexec_1
- noexec_2
- 2,
89 .expected_pc_ofs
= -2,
93 .name
= "exrl [cross]",
95 .test_len
= exrl_end
- exrl_1
,
96 .page_ofs
= exrl_1
- exrl_2
- 2,
97 .entry_ofs
= exrl_1
- exrl_2
- 2,
99 .expected_pc_ofs
= exrl_1
- exrl_2
- 2,
104 return test_noexec(noexec_tests
,
105 sizeof(noexec_tests
) / sizeof(noexec_tests
[0]));