2021-02-08 08:46:21 +03:00
|
|
|
##
|
2023-03-07 05:58:24 +03:00
|
|
|
## Copyright(c) 2019-2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
|
2021-02-08 08:46:21 +03:00
|
|
|
##
|
|
|
|
## This program is free software; you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or
|
|
|
|
## (at your option) any later version.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
##
|
|
|
|
|
|
|
|
# Hexagon doesn't support gdb, so skip the EXTRA_RUNS
|
|
|
|
EXTRA_RUNS =
|
|
|
|
|
|
|
|
CFLAGS += -Wno-incompatible-pointer-types -Wno-undefined-internal
|
2021-04-09 04:07:50 +03:00
|
|
|
CFLAGS += -fno-unroll-loops
|
2021-02-08 08:46:22 +03:00
|
|
|
|
|
|
|
HEX_SRC=$(SRC_PATH)/tests/tcg/hexagon
|
|
|
|
VPATH += $(HEX_SRC)
|
|
|
|
|
2022-09-23 20:38:31 +03:00
|
|
|
%: $(HEX_SRC)/%.S $(HEX_SRC)/crt.S
|
2021-02-08 08:46:22 +03:00
|
|
|
$(CC) -static -mv67 -nostdlib $^ -o $@
|
|
|
|
|
|
|
|
HEX_TESTS = first
|
2021-09-22 18:30:46 +03:00
|
|
|
HEX_TESTS += hex_sigsegv
|
2021-02-08 08:46:22 +03:00
|
|
|
HEX_TESTS += misc
|
2022-02-10 05:15:50 +03:00
|
|
|
HEX_TESTS += usr
|
2021-02-08 08:46:22 +03:00
|
|
|
HEX_TESTS += preg_alias
|
|
|
|
HEX_TESTS += dual_stores
|
2021-04-09 04:07:45 +03:00
|
|
|
HEX_TESTS += multi_result
|
2021-02-08 08:46:22 +03:00
|
|
|
HEX_TESTS += mem_noshuf
|
2022-07-08 00:05:46 +03:00
|
|
|
HEX_TESTS += mem_noshuf_exception
|
2021-04-09 04:07:50 +03:00
|
|
|
HEX_TESTS += circ
|
2021-04-09 04:07:51 +03:00
|
|
|
HEX_TESTS += brev
|
2021-04-09 04:07:52 +03:00
|
|
|
HEX_TESTS += load_unpack
|
2021-04-09 04:07:53 +03:00
|
|
|
HEX_TESTS += load_align
|
2021-02-08 08:46:22 +03:00
|
|
|
HEX_TESTS += atomics
|
2021-02-08 08:46:23 +03:00
|
|
|
HEX_TESTS += fpstuff
|
2021-10-05 03:12:31 +03:00
|
|
|
HEX_TESTS += overflow
|
linux-user/hexagon: fix signal context save & restore
This patch fixes the issue originally reported in
this thread:
https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg01102.html
The root cause of the issue is a bug in the hexagon specific
logic for saving & restoring context during signal delivery.
The CPU state has two different representations for the
predicate registers. The current logic saves & restores only
the aliased HEX_REG_P3_O register, which is part of env->gpr[]
field in the CPU state, but not the individual byte-level
predicate registers (pO, p1, p2, p3) backed by env->pred[].
Since all predicated instructions refer only to the
indiviual registers, switching to and back from a signal handler
can clobber these registers if the signal handler writes to them
causing the normal application code to behave unpredictably when
context is restored.
In the reported issue with the 'signals' test, since the updated
hexagon toolchain had built musl with -O2, the functions called
from non_trivial_free were inlined. This meant that the code
emitted reused predicate P0 computed in the entry translation
block of the function non_trivial_free in one of the child TB
as part of an assertion. Since P0 is clobbered by the signal
handler in the signals test, the assertion in non_trivial_free
fails incorectly. Since musl for hexagon implements the 'abort'
function by deliberately writing to memory via null pointer,
this causes the test to fail with segmentation fault.
This patch modifies the signal context save & restore logic
to include the individual p0, p1, p2, p3 and excludes the
32b p3_0 register since its value is derived from the former
registers. It also adds a new test case that reliabily
reproduces the issue for all four predicate registers.
Buglink: https://github.com/quic/toolchain_for_hexagon/issues/6
Signed-off-by: Mukilan Thiyagarajan <quic_mthiyaga@quicinc.com>
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
Message-Id: <20221229092006.10709-2-quic_mthiyaga@quicinc.com>
2022-12-29 12:20:05 +03:00
|
|
|
HEX_TESTS += signal_context
|
2023-01-05 13:23:49 +03:00
|
|
|
HEX_TESTS += reg_mut
|
2023-03-07 05:58:24 +03:00
|
|
|
HEX_TESTS += vector_add_int
|
|
|
|
HEX_TESTS += scatter_gather
|
|
|
|
HEX_TESTS += hvx_misc
|
|
|
|
HEX_TESTS += hvx_histogram
|
2021-02-08 08:46:22 +03:00
|
|
|
|
2022-09-23 20:38:31 +03:00
|
|
|
HEX_TESTS += test_abs
|
|
|
|
HEX_TESTS += test_bitcnt
|
|
|
|
HEX_TESTS += test_bitsplit
|
|
|
|
HEX_TESTS += test_call
|
|
|
|
HEX_TESTS += test_clobber
|
|
|
|
HEX_TESTS += test_cmp
|
|
|
|
HEX_TESTS += test_dotnew
|
|
|
|
HEX_TESTS += test_ext
|
|
|
|
HEX_TESTS += test_fibonacci
|
|
|
|
HEX_TESTS += test_hl
|
|
|
|
HEX_TESTS += test_hwloops
|
|
|
|
HEX_TESTS += test_jmp
|
|
|
|
HEX_TESTS += test_lsr
|
|
|
|
HEX_TESTS += test_mpyi
|
|
|
|
HEX_TESTS += test_packet
|
|
|
|
HEX_TESTS += test_reorder
|
|
|
|
HEX_TESTS += test_round
|
|
|
|
HEX_TESTS += test_vavgw
|
|
|
|
HEX_TESTS += test_vcmpb
|
|
|
|
HEX_TESTS += test_vcmpw
|
|
|
|
HEX_TESTS += test_vlsrw
|
|
|
|
HEX_TESTS += test_vmaxh
|
|
|
|
HEX_TESTS += test_vminh
|
|
|
|
HEX_TESTS += test_vpmpyh
|
|
|
|
HEX_TESTS += test_vspliceb
|
|
|
|
|
2021-02-08 08:46:22 +03:00
|
|
|
TESTS += $(HEX_TESTS)
|
2022-02-10 05:15:50 +03:00
|
|
|
|
|
|
|
# This test has to be compiled for the -mv67t target
|
|
|
|
usr: usr.c
|
|
|
|
$(CC) $(CFLAGS) -mv67t -O2 -Wno-inline-asm -Wno-expansion-to-defined $< -o $@ $(LDFLAGS)
|
|
|
|
|
2023-03-07 05:58:24 +03:00
|
|
|
scatter_gather: CFLAGS += -mhvx
|
|
|
|
vector_add_int: CFLAGS += -mhvx -fvectorize
|
2023-04-06 20:42:41 +03:00
|
|
|
hvx_misc: hvx_misc.c hvx_misc.h
|
2023-03-07 05:58:24 +03:00
|
|
|
hvx_misc: CFLAGS += -mhvx
|
|
|
|
hvx_histogram: CFLAGS += -mhvx -Wno-gnu-folding-constant
|
|
|
|
|
|
|
|
hvx_histogram: hvx_histogram.c hvx_histogram_row.S
|
|
|
|
$(CC) $(CFLAGS) $(CROSS_CC_GUEST_CFLAGS) $^ -o $@ $(LDFLAGS)
|