2 * Copyright(c) 2021-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
19 * Test the VLIW semantics of two stores in a packet
21 * When a packet has 2 stores, either both commit or neither commit.
22 * We test this with a packet that does stores to both NULL and a global
23 * variable, "should_not_change". After the SIGSEGV is caught, we check
24 * that the "should_not_change" value is the same.
32 #include <sys/types.h>
43 #define SHOULD_NOT_CHANGE_VAL 5
44 int32_t should_not_change
= SHOULD_NOT_CHANGE_VAL
;
47 uint8_t buf
[BUF_SIZE
];
50 static void sig_segv(int sig
, siginfo_t
*info
, void *puc
)
52 check32(sig
, SIGSEGV
);
62 act
.sa_sigaction
= sig_segv
;
63 sigemptyset(&act
.sa_mask
);
64 act
.sa_flags
= SA_SIGINFO
;
65 chk_error(sigaction(SIGSEGV
, &act
, NULL
));
66 if (setjmp(jmp_env
) == 0) {
67 asm volatile("r18 = ##should_not_change\n\t"
73 : : : "r18", "r19", "memory");
76 act
.sa_handler
= SIG_DFL
;
77 sigemptyset(&act
.sa_mask
);
79 chk_error(sigaction(SIGSEGV
, &act
, NULL
));
81 check32(segv_caught
, true);
82 check32(should_not_change
, SHOULD_NOT_CHANGE_VAL
);
84 puts(err
? "FAIL" : "PASS");
85 return err
? EXIT_FAILURE
: EXIT_SUCCESS
;