mirror of https://github.com/xemu-project/xemu.git
testing and plugin updates:
- various fixes for binfmt_misc docker images - add hexagon check-tcg support docker image - add tricore check-tcg support - refactor ppc docker images - add missing ppc64le tests - don't use host_cc for test fallback - check-tcg configure.sh tweaks for cross compile/clang - fix some memory leaks in plugins -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmCjfMEACgkQ+9DbCVqe KkQ+aQf/QX5prjX9IW64GzwmZLdgufrc9fwdbrhyNTglcS0gN/hti6is3gBhe9dU KynWvmjvnosDT1EI53ciVkSRrwDLptpyq3bz140RjmSmPFQvUP16yF3KTThBxXuO 1BZk7iq5jzv3jVHD4j4zQPyMRatyBBToKtIboSZntljq6WTomv8gWu8+vdlWGzeG 0ubW1k9YHZNnQ0Et5xjqQBgBbjoOQvbkLYwNyyDjkOem8p4oKFIyTcRP9PYSJ9t3 cq314LuFJVjW1TMywvgHOlZEwzqRqOtdzW1RC1EbVqYR+lifAgYRI/kTEwL3Ab7j Z+hybdzlfJdUPNiJ5Q4rjDpuKI+1Nw== =FYwg -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-plugin-updates-180521-2' into staging testing and plugin updates: - various fixes for binfmt_misc docker images - add hexagon check-tcg support docker image - add tricore check-tcg support - refactor ppc docker images - add missing ppc64le tests - don't use host_cc for test fallback - check-tcg configure.sh tweaks for cross compile/clang - fix some memory leaks in plugins # gpg: Signature made Tue 18 May 2021 09:37:21 BST # gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full] # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-testing-and-plugin-updates-180521-2: (29 commits) configure: use cc, not host_cc to set cross_cc for build arch tests/tcg: don't allow clang as a cross compiler tests/tcg: fix missing return tests/tcg/ppc64le: tests for brh/brw/brd tests/docker: gcc-10 based images for ppc64{,le} tests tests/tcg/tricore: Add muls test tests/tcg/tricore: Add msub test tests/tcg/tricore: Add madd test tests/tcg/tricore: Add ftoi test tests/tcg/tricore: Add fmul test tests/tcg/tricore: Add fadd test tests/tcg/tricore: Add dvstep test tests/tcg/tricore: Add clz test tests/tcg/tricore: Add bmerge test tests/tcg/tricore: Add macros to create tests and first test 'abs' configure: Emit HOST_CC to config-host.mak tests/tcg/tricore: Add build infrastructure hw/tricore: Add testdevice for tests in tests/tcg/ tests/tcg: Run timeout cmds using --foreground tests/tcg: Add docker_as and docker_ld cmds ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
fea2ad71c3
|
@ -144,19 +144,12 @@ mipsel-debian-cross-container:
|
||||||
variables:
|
variables:
|
||||||
NAME: debian-mipsel-cross
|
NAME: debian-mipsel-cross
|
||||||
|
|
||||||
powerpc-debian-cross-container:
|
powerpc-test-cross-container:
|
||||||
extends: .container_job_template
|
extends: .container_job_template
|
||||||
stage: containers-layer2
|
stage: containers-layer2
|
||||||
needs: ['amd64-debian10-container']
|
needs: ['amd64-debian11-container']
|
||||||
variables:
|
variables:
|
||||||
NAME: debian-powerpc-cross
|
NAME: debian-powerpc-test-cross
|
||||||
|
|
||||||
ppc64-debian-cross-container:
|
|
||||||
extends: .container_job_template
|
|
||||||
stage: containers-layer2
|
|
||||||
needs: ['amd64-debian10-container']
|
|
||||||
variables:
|
|
||||||
NAME: debian-ppc64-cross
|
|
||||||
|
|
||||||
ppc64el-debian-cross-container:
|
ppc64el-debian-cross-container:
|
||||||
extends: .container_job_template
|
extends: .container_job_template
|
||||||
|
|
|
@ -416,6 +416,17 @@ build-user-static:
|
||||||
CONFIGURE_ARGS: --disable-tools --disable-system --static
|
CONFIGURE_ARGS: --disable-tools --disable-system --static
|
||||||
MAKE_CHECK_ARGS: check-tcg
|
MAKE_CHECK_ARGS: check-tcg
|
||||||
|
|
||||||
|
# Because the hexagon cross-compiler takes so long to build we don't rely
|
||||||
|
# on the CI system to build it and hence this job has no dependency
|
||||||
|
# declared. The image is manually uploaded.
|
||||||
|
build-user-hexagon:
|
||||||
|
extends: .native_build_job_template
|
||||||
|
variables:
|
||||||
|
IMAGE: debian-hexagon-cross
|
||||||
|
TARGETS: hexagon-linux-user
|
||||||
|
CONFIGURE_ARGS: --disable-tools --disable-docs --enable-debug-tcg
|
||||||
|
MAKE_CHECK_ARGS: check-tcg
|
||||||
|
|
||||||
# Only build the softmmu targets we have check-tcg tests for
|
# Only build the softmmu targets we have check-tcg tests for
|
||||||
build-some-softmmu:
|
build-some-softmmu:
|
||||||
extends: .native_build_job_template
|
extends: .native_build_job_template
|
||||||
|
|
|
@ -197,6 +197,8 @@ F: linux-user/hexagon/
|
||||||
F: tests/tcg/hexagon/
|
F: tests/tcg/hexagon/
|
||||||
F: disas/hexagon.c
|
F: disas/hexagon.c
|
||||||
F: default-configs/targets/hexagon-linux-user.mak
|
F: default-configs/targets/hexagon-linux-user.mak
|
||||||
|
F: docker/dockerfiles/debian-hexagon-cross.docker
|
||||||
|
F: docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
|
||||||
|
|
||||||
HPPA (PA-RISC) TCG CPUs
|
HPPA (PA-RISC) TCG CPUs
|
||||||
M: Richard Henderson <richard.henderson@linaro.org>
|
M: Richard Henderson <richard.henderson@linaro.org>
|
||||||
|
@ -347,6 +349,7 @@ S: Maintained
|
||||||
F: target/tricore/
|
F: target/tricore/
|
||||||
F: hw/tricore/
|
F: hw/tricore/
|
||||||
F: include/hw/tricore/
|
F: include/hw/tricore/
|
||||||
|
F: tests/tcg/tricore/
|
||||||
|
|
||||||
Multiarch Linux User Tests
|
Multiarch Linux User Tests
|
||||||
M: Alex Bennée <alex.bennee@linaro.org>
|
M: Alex Bennée <alex.bennee@linaro.org>
|
||||||
|
|
|
@ -1651,7 +1651,7 @@ case "$cpu" in
|
||||||
# No special flags required for other host CPUs
|
# No special flags required for other host CPUs
|
||||||
esac
|
esac
|
||||||
|
|
||||||
eval "cross_cc_${cpu}=\$host_cc"
|
eval "cross_cc_${cpu}=\$cc"
|
||||||
cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
|
cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
|
||||||
QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
|
QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
|
||||||
|
|
||||||
|
@ -6164,6 +6164,7 @@ echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
|
||||||
echo "MESON=$meson" >> $config_host_mak
|
echo "MESON=$meson" >> $config_host_mak
|
||||||
echo "NINJA=$ninja" >> $config_host_mak
|
echo "NINJA=$ninja" >> $config_host_mak
|
||||||
echo "CC=$cc" >> $config_host_mak
|
echo "CC=$cc" >> $config_host_mak
|
||||||
|
echo "HOST_CC=$host_cc" >> $config_host_mak
|
||||||
if $iasl -h > /dev/null 2>&1; then
|
if $iasl -h > /dev/null 2>&1; then
|
||||||
echo "CONFIG_IASL=$iasl" >> $config_host_mak
|
echo "CONFIG_IASL=$iasl" >> $config_host_mak
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
tricore_ss = ss.source_set()
|
tricore_ss = ss.source_set()
|
||||||
tricore_ss.add(when: 'CONFIG_TRICORE', if_true: files('tricore_testboard.c'))
|
tricore_ss.add(when: 'CONFIG_TRICORE', if_true: files('tricore_testboard.c'))
|
||||||
|
tricore_ss.add(when: 'CONFIG_TRICORE', if_true: files('tricore_testdevice.c'))
|
||||||
tricore_ss.add(when: 'CONFIG_TRIBOARD', if_true: files('triboard.c'))
|
tricore_ss.add(when: 'CONFIG_TRIBOARD', if_true: files('triboard.c'))
|
||||||
tricore_ss.add(when: 'CONFIG_TC27X_SOC', if_true: files('tc27x_soc.c'))
|
tricore_ss.add(when: 'CONFIG_TC27X_SOC', if_true: files('tc27x_soc.c'))
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "hw/tricore/tricore.h"
|
#include "hw/tricore/tricore.h"
|
||||||
|
#include "hw/tricore/tricore_testdevice.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
|
||||||
{
|
{
|
||||||
TriCoreCPU *cpu;
|
TriCoreCPU *cpu;
|
||||||
CPUTriCoreState *env;
|
CPUTriCoreState *env;
|
||||||
|
TriCoreTestDeviceState *test_dev;
|
||||||
|
|
||||||
MemoryRegion *sysmem = get_system_memory();
|
MemoryRegion *sysmem = get_system_memory();
|
||||||
MemoryRegion *ext_cram = g_new(MemoryRegion, 1);
|
MemoryRegion *ext_cram = g_new(MemoryRegion, 1);
|
||||||
|
@ -87,6 +89,12 @@ static void tricore_testboard_init(MachineState *machine, int board_id)
|
||||||
memory_region_add_subregion(sysmem, 0xf0050000, pcp_data);
|
memory_region_add_subregion(sysmem, 0xf0050000, pcp_data);
|
||||||
memory_region_add_subregion(sysmem, 0xf0060000, pcp_text);
|
memory_region_add_subregion(sysmem, 0xf0060000, pcp_text);
|
||||||
|
|
||||||
|
test_dev = g_new(TriCoreTestDeviceState, 1);
|
||||||
|
object_initialize(test_dev, sizeof(TriCoreTestDeviceState),
|
||||||
|
TYPE_TRICORE_TESTDEVICE);
|
||||||
|
memory_region_add_subregion(sysmem, 0xf0000000, &test_dev->iomem);
|
||||||
|
|
||||||
|
|
||||||
tricoretb_binfo.ram_size = machine->ram_size;
|
tricoretb_binfo.ram_size = machine->ram_size;
|
||||||
tricoretb_binfo.kernel_filename = machine->kernel_filename;
|
tricoretb_binfo.kernel_filename = machine->kernel_filename;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2021 Bastian Koppelmann Paderborn University
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
|
#include "hw/sysbus.h"
|
||||||
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/tricore/tricore_testdevice.h"
|
||||||
|
|
||||||
|
static void tricore_testdevice_write(void *opaque, hwaddr offset,
|
||||||
|
uint64_t value, unsigned size)
|
||||||
|
{
|
||||||
|
exit(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint64_t tricore_testdevice_read(void *opaque, hwaddr offset,
|
||||||
|
unsigned size)
|
||||||
|
{
|
||||||
|
return 0xdeadbeef;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void tricore_testdevice_reset(DeviceState *dev)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static const MemoryRegionOps tricore_testdevice_ops = {
|
||||||
|
.read = tricore_testdevice_read,
|
||||||
|
.write = tricore_testdevice_write,
|
||||||
|
.valid = {
|
||||||
|
.min_access_size = 4,
|
||||||
|
.max_access_size = 4,
|
||||||
|
},
|
||||||
|
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void tricore_testdevice_init(Object *obj)
|
||||||
|
{
|
||||||
|
TriCoreTestDeviceState *s = TRICORE_TESTDEVICE(obj);
|
||||||
|
/* map memory */
|
||||||
|
memory_region_init_io(&s->iomem, OBJECT(s), &tricore_testdevice_ops, s,
|
||||||
|
"tricore_testdevice", 0x4);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Property tricore_testdevice_properties[] = {
|
||||||
|
DEFINE_PROP_END_OF_LIST()
|
||||||
|
};
|
||||||
|
|
||||||
|
static void tricore_testdevice_class_init(ObjectClass *klass, void *data)
|
||||||
|
{
|
||||||
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
|
device_class_set_props(dc, tricore_testdevice_properties);
|
||||||
|
dc->reset = tricore_testdevice_reset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const TypeInfo tricore_testdevice_info = {
|
||||||
|
.name = TYPE_TRICORE_TESTDEVICE,
|
||||||
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
|
.instance_size = sizeof(TriCoreTestDeviceState),
|
||||||
|
.instance_init = tricore_testdevice_init,
|
||||||
|
.class_init = tricore_testdevice_class_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void tricore_testdevice_register_types(void)
|
||||||
|
{
|
||||||
|
type_register_static(&tricore_testdevice_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
type_init(tricore_testdevice_register_types)
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2021 Bastian Koppelmann Paderborn University
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library 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
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HW_TRICORE_TESTDEV_H
|
||||||
|
#define HW_TRICORE_TESTDEV_H
|
||||||
|
|
||||||
|
#include "hw/sysbus.h"
|
||||||
|
#include "hw/hw.h"
|
||||||
|
|
||||||
|
#define TYPE_TRICORE_TESTDEVICE "tricore_testdevice"
|
||||||
|
#define TRICORE_TESTDEVICE(obj) \
|
||||||
|
OBJECT_CHECK(TriCoreTestDeviceState, (obj), TYPE_TRICORE_TESTDEVICE)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* <private> */
|
||||||
|
SysBusDevice parent_obj;
|
||||||
|
|
||||||
|
/* <public> */
|
||||||
|
MemoryRegion iomem;
|
||||||
|
|
||||||
|
} TriCoreTestDeviceState;
|
||||||
|
|
||||||
|
#endif
|
|
@ -140,25 +140,46 @@ docker-image-debian-mips-cross: docker-image-debian10
|
||||||
docker-image-debian-mips64-cross: docker-image-debian10
|
docker-image-debian-mips64-cross: docker-image-debian10
|
||||||
docker-image-debian-mips64el-cross: docker-image-debian10
|
docker-image-debian-mips64el-cross: docker-image-debian10
|
||||||
docker-image-debian-mipsel-cross: docker-image-debian10
|
docker-image-debian-mipsel-cross: docker-image-debian10
|
||||||
docker-image-debian-powerpc-cross: docker-image-debian10
|
|
||||||
docker-image-debian-ppc64-cross: docker-image-debian10
|
|
||||||
docker-image-debian-ppc64el-cross: docker-image-debian10
|
docker-image-debian-ppc64el-cross: docker-image-debian10
|
||||||
docker-image-debian-riscv64-cross: docker-image-debian10
|
docker-image-debian-riscv64-cross: docker-image-debian10
|
||||||
docker-image-debian-s390x-cross: docker-image-debian10
|
docker-image-debian-s390x-cross: docker-image-debian10
|
||||||
docker-image-debian-sh4-cross: docker-image-debian10
|
docker-image-debian-sh4-cross: docker-image-debian10
|
||||||
docker-image-debian-sparc64-cross: docker-image-debian10
|
docker-image-debian-sparc64-cross: docker-image-debian10
|
||||||
|
|
||||||
|
#
|
||||||
|
# The build rule for hexagon-cross is special in so far for most of
|
||||||
|
# the time we don't want to build it. While dockers caching does avoid
|
||||||
|
# this most of the time sometimes we want to force the issue.
|
||||||
|
#
|
||||||
|
docker-image-debian-hexagon-cross: $(DOCKER_FILES_DIR)/debian-hexagon-cross.docker
|
||||||
|
$(if $(NOCACHE), \
|
||||||
|
$(call quiet-command, \
|
||||||
|
$(DOCKER_SCRIPT) build -t qemu/debian-hexagon-cross -f $< \
|
||||||
|
$(if $V,,--quiet) --no-cache \
|
||||||
|
--registry $(DOCKER_REGISTRY) --extra-files \
|
||||||
|
$(DOCKER_FILES_DIR)/debian-hexagon-cross.docker.d/build-toolchain.sh, \
|
||||||
|
"BUILD", "debian-hexagon-cross"), \
|
||||||
|
$(call quiet-command, \
|
||||||
|
$(DOCKER_SCRIPT) fetch $(if $V,,--quiet) \
|
||||||
|
qemu/debian-hexagon-cross $(DOCKER_REGISTRY), \
|
||||||
|
"FETCH", "debian-hexagon-cross") \
|
||||||
|
$(call quiet-command, \
|
||||||
|
$(DOCKER_SCRIPT) update $(if $V,,--quiet) \
|
||||||
|
qemu/debian-hexagon-cross --add-current-user, \
|
||||||
|
"PREPARE", "debian-hexagon-cross"))
|
||||||
|
|
||||||
# Specialist build images, sometimes very limited tools
|
# Specialist build images, sometimes very limited tools
|
||||||
docker-image-debian-tricore-cross: docker-image-debian10
|
docker-image-debian-tricore-cross: docker-image-debian10
|
||||||
docker-image-debian-all-test-cross: docker-image-debian10
|
docker-image-debian-all-test-cross: docker-image-debian10
|
||||||
docker-image-debian-arm64-test-cross: docker-image-debian11
|
docker-image-debian-arm64-test-cross: docker-image-debian11
|
||||||
|
docker-image-debian-powerpc-test-cross: docker-image-debian11
|
||||||
|
|
||||||
# These images may be good enough for building tests but not for test builds
|
# These images may be good enough for building tests but not for test builds
|
||||||
DOCKER_PARTIAL_IMAGES += debian-alpha-cross
|
DOCKER_PARTIAL_IMAGES += debian-alpha-cross
|
||||||
DOCKER_PARTIAL_IMAGES += debian-arm64-test-cross
|
DOCKER_PARTIAL_IMAGES += debian-arm64-test-cross
|
||||||
|
DOCKER_PARTIAL_IMAGES += debian-powerpc-test-cross
|
||||||
DOCKER_PARTIAL_IMAGES += debian-hppa-cross
|
DOCKER_PARTIAL_IMAGES += debian-hppa-cross
|
||||||
DOCKER_PARTIAL_IMAGES += debian-m68k-cross debian-mips64-cross
|
DOCKER_PARTIAL_IMAGES += debian-m68k-cross debian-mips64-cross
|
||||||
DOCKER_PARTIAL_IMAGES += debian-powerpc-cross debian-ppc64-cross
|
|
||||||
DOCKER_PARTIAL_IMAGES += debian-riscv64-cross
|
DOCKER_PARTIAL_IMAGES += debian-riscv64-cross
|
||||||
DOCKER_PARTIAL_IMAGES += debian-sh4-cross debian-sparc64-cross
|
DOCKER_PARTIAL_IMAGES += debian-sh4-cross debian-sparc64-cross
|
||||||
DOCKER_PARTIAL_IMAGES += debian-tricore-cross
|
DOCKER_PARTIAL_IMAGES += debian-tricore-cross
|
||||||
|
@ -248,7 +269,7 @@ docker-run: docker-qemu-src
|
||||||
$(if $(EXECUTABLE), \
|
$(if $(EXECUTABLE), \
|
||||||
$(call quiet-command, \
|
$(call quiet-command, \
|
||||||
$(DOCKER_SCRIPT) update \
|
$(DOCKER_SCRIPT) update \
|
||||||
$(IMAGE) $(EXECUTABLE), \
|
$(IMAGE) --executable $(EXECUTABLE), \
|
||||||
" COPYING $(EXECUTABLE) to $(IMAGE)"))
|
" COPYING $(EXECUTABLE) to $(IMAGE)"))
|
||||||
$(call quiet-command, \
|
$(call quiet-command, \
|
||||||
$(DOCKER_SCRIPT) run \
|
$(DOCKER_SCRIPT) run \
|
||||||
|
|
|
@ -515,16 +515,36 @@ class BuildCommand(SubCommand):
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
class FetchCommand(SubCommand):
|
||||||
|
""" Fetch a docker image from the registry. Args: <tag> <registry>"""
|
||||||
|
name = "fetch"
|
||||||
|
|
||||||
|
def args(self, parser):
|
||||||
|
parser.add_argument("tag",
|
||||||
|
help="Local tag for image")
|
||||||
|
parser.add_argument("registry",
|
||||||
|
help="Docker registry")
|
||||||
|
|
||||||
|
def run(self, args, argv):
|
||||||
|
dkr = Docker()
|
||||||
|
dkr.command(cmd="pull", quiet=args.quiet,
|
||||||
|
argv=["%s/%s" % (args.registry, args.tag)])
|
||||||
|
dkr.command(cmd="tag", quiet=args.quiet,
|
||||||
|
argv=["%s/%s" % (args.registry, args.tag), args.tag])
|
||||||
|
|
||||||
|
|
||||||
class UpdateCommand(SubCommand):
|
class UpdateCommand(SubCommand):
|
||||||
""" Update a docker image with new executables. Args: <tag> <executable>"""
|
""" Update a docker image. Args: <tag> <actions>"""
|
||||||
name = "update"
|
name = "update"
|
||||||
|
|
||||||
def args(self, parser):
|
def args(self, parser):
|
||||||
parser.add_argument("tag",
|
parser.add_argument("tag",
|
||||||
help="Image Tag")
|
help="Image Tag")
|
||||||
parser.add_argument("executable",
|
parser.add_argument("--executable",
|
||||||
help="Executable to copy")
|
help="Executable to copy")
|
||||||
|
parser.add_argument("--add-current-user", "-u", dest="user",
|
||||||
|
action="store_true",
|
||||||
|
help="Add the current user to image's passwd")
|
||||||
|
|
||||||
def run(self, args, argv):
|
def run(self, args, argv):
|
||||||
# Create a temporary tarball with our whole build context and
|
# Create a temporary tarball with our whole build context and
|
||||||
|
@ -532,28 +552,44 @@ class UpdateCommand(SubCommand):
|
||||||
tmp = tempfile.NamedTemporaryFile(suffix="dckr.tar.gz")
|
tmp = tempfile.NamedTemporaryFile(suffix="dckr.tar.gz")
|
||||||
tmp_tar = TarFile(fileobj=tmp, mode='w')
|
tmp_tar = TarFile(fileobj=tmp, mode='w')
|
||||||
|
|
||||||
# Add the executable to the tarball, using the current
|
|
||||||
# configured binfmt_misc path. If we don't get a path then we
|
|
||||||
# only need the support libraries copied
|
|
||||||
ff, enabled = _check_binfmt_misc(args.executable)
|
|
||||||
|
|
||||||
if not enabled:
|
|
||||||
print("binfmt_misc not enabled, update disabled")
|
|
||||||
return 1
|
|
||||||
|
|
||||||
if ff:
|
|
||||||
tmp_tar.add(args.executable, arcname=ff)
|
|
||||||
|
|
||||||
# Add any associated libraries
|
|
||||||
libs = _get_so_libs(args.executable)
|
|
||||||
if libs:
|
|
||||||
for l in libs:
|
|
||||||
tmp_tar.add(os.path.realpath(l), arcname=l)
|
|
||||||
|
|
||||||
# Create a Docker buildfile
|
# Create a Docker buildfile
|
||||||
df = StringIO()
|
df = StringIO()
|
||||||
df.write(u"FROM %s\n" % args.tag)
|
df.write(u"FROM %s\n" % args.tag)
|
||||||
df.write(u"ADD . /\n")
|
|
||||||
|
if args.executable:
|
||||||
|
# Add the executable to the tarball, using the current
|
||||||
|
# configured binfmt_misc path. If we don't get a path then we
|
||||||
|
# only need the support libraries copied
|
||||||
|
ff, enabled = _check_binfmt_misc(args.executable)
|
||||||
|
|
||||||
|
if not enabled:
|
||||||
|
print("binfmt_misc not enabled, update disabled")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if ff:
|
||||||
|
tmp_tar.add(args.executable, arcname=ff)
|
||||||
|
|
||||||
|
# Add any associated libraries
|
||||||
|
libs = _get_so_libs(args.executable)
|
||||||
|
if libs:
|
||||||
|
for l in libs:
|
||||||
|
so_path = os.path.dirname(l)
|
||||||
|
name = os.path.basename(l)
|
||||||
|
real_l = os.path.realpath(l)
|
||||||
|
try:
|
||||||
|
tmp_tar.add(real_l, arcname="%s/%s" % (so_path, name))
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("Couldn't add %s/%s to archive" % (so_path, name))
|
||||||
|
pass
|
||||||
|
|
||||||
|
df.write(u"ADD . /\n")
|
||||||
|
|
||||||
|
if args.user:
|
||||||
|
uid = os.getuid()
|
||||||
|
uname = getpwuid(uid).pw_name
|
||||||
|
df.write("\n")
|
||||||
|
df.write("RUN id %s 2>/dev/null || useradd -u %d -U %s" %
|
||||||
|
(uname, uid, uname))
|
||||||
|
|
||||||
df_bytes = BytesIO(bytes(df.getvalue(), "UTF-8"))
|
df_bytes = BytesIO(bytes(df.getvalue(), "UTF-8"))
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ ENV PACKAGES \
|
||||||
gnutls-dev \
|
gnutls-dev \
|
||||||
gtk+3.0-dev \
|
gtk+3.0-dev \
|
||||||
libaio-dev \
|
libaio-dev \
|
||||||
|
libbpf-dev \
|
||||||
libcap-ng-dev \
|
libcap-ng-dev \
|
||||||
libjpeg-turbo-dev \
|
libjpeg-turbo-dev \
|
||||||
libnfs-dev \
|
libnfs-dev \
|
||||||
|
|
|
@ -14,6 +14,7 @@ ENV PACKAGES \
|
||||||
git \
|
git \
|
||||||
glib2-devel \
|
glib2-devel \
|
||||||
libaio-devel \
|
libaio-devel \
|
||||||
|
libbpf-devel \
|
||||||
libepoxy-devel \
|
libepoxy-devel \
|
||||||
libfdt-devel \
|
libfdt-devel \
|
||||||
libgcrypt-devel \
|
libgcrypt-devel \
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#
|
||||||
|
# Docker Hexagon cross-compiler target
|
||||||
|
#
|
||||||
|
# This docker target is used for building hexagon tests. As it also
|
||||||
|
# needs to be able to build QEMU itself in CI we include it's
|
||||||
|
# build-deps. It is also a "stand-alone" image so as not to be
|
||||||
|
# triggered by re-builds on other base images given it takes a long
|
||||||
|
# time to build.
|
||||||
|
#
|
||||||
|
FROM qemu/debian10
|
||||||
|
|
||||||
|
# Install common build utilities
|
||||||
|
RUN apt update && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||||
|
apt install -y --no-install-recommends \
|
||||||
|
bison \
|
||||||
|
cmake \
|
||||||
|
flex \
|
||||||
|
lld \
|
||||||
|
rsync \
|
||||||
|
wget
|
||||||
|
|
||||||
|
ENV TOOLCHAIN_INSTALL /usr/local
|
||||||
|
ENV ROOTFS /usr/local
|
||||||
|
|
||||||
|
ENV LLVM_URL https://github.com/llvm/llvm-project/archive/bfcd21876adc3498065e4da92799f613e730d475.tar.gz
|
||||||
|
ENV MUSL_URL https://github.com/quic/musl/archive/aff74b395fbf59cd7e93b3691905aa1af6c0778c.tar.gz
|
||||||
|
ENV LINUX_URL https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.18.tar.xz
|
||||||
|
|
||||||
|
ADD build-toolchain.sh /root/hexagon-toolchain/build-toolchain.sh
|
||||||
|
|
||||||
|
RUN cd /root/hexagon-toolchain && ./build-toolchain.sh
|
||||||
|
|
||||||
|
FROM debian:buster-slim
|
||||||
|
# Duplicate deb line as deb-src
|
||||||
|
RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
|
||||||
|
# Install QEMU build deps for use in CI
|
||||||
|
RUN apt update && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive eatmydata apt install -yy git ninja-build && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||||
|
apt build-dep -yy --arch-only qemu
|
||||||
|
COPY --from=0 /usr/local /usr/local
|
||||||
|
ENV PATH $PATH:/usr/local/bin/
|
|
@ -0,0 +1,141 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BASE=$(readlink -f ${PWD})
|
||||||
|
|
||||||
|
TOOLCHAIN_INSTALL=$(readlink -f "$TOOLCHAIN_INSTALL")
|
||||||
|
ROOTFS=$(readlink -f "$ROOTFS")
|
||||||
|
|
||||||
|
TOOLCHAIN_BIN=${TOOLCHAIN_INSTALL}/bin
|
||||||
|
HEX_SYSROOT=${TOOLCHAIN_INSTALL}/hexagon-unknown-linux-musl
|
||||||
|
HEX_TOOLS_TARGET_BASE=${HEX_SYSROOT}/usr
|
||||||
|
|
||||||
|
function cdp() {
|
||||||
|
DIR="$1"
|
||||||
|
mkdir -p "$DIR"
|
||||||
|
cd "$DIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetch() {
|
||||||
|
DIR="$1"
|
||||||
|
URL="$2"
|
||||||
|
TEMP="$(readlink -f "$PWD/tmp.tar.gz")"
|
||||||
|
wget --quiet "$URL" -O "$TEMP"
|
||||||
|
cdp "$DIR"
|
||||||
|
tar xaf "$TEMP" --strip-components=1
|
||||||
|
rm "$TEMP"
|
||||||
|
cd -
|
||||||
|
}
|
||||||
|
|
||||||
|
build_llvm_clang() {
|
||||||
|
fetch "$BASE/llvm-project" "$LLVM_URL"
|
||||||
|
cdp "$BASE/build-llvm"
|
||||||
|
|
||||||
|
cmake -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${TOOLCHAIN_INSTALL} \
|
||||||
|
-DLLVM_ENABLE_LLD=ON \
|
||||||
|
-DLLVM_TARGETS_TO_BUILD="Hexagon" \
|
||||||
|
-DLLVM_ENABLE_PROJECTS="clang;lld" \
|
||||||
|
"$BASE/llvm-project/llvm"
|
||||||
|
ninja all install
|
||||||
|
cd ${TOOLCHAIN_BIN}
|
||||||
|
ln -sf clang hexagon-unknown-linux-musl-clang
|
||||||
|
ln -sf clang++ hexagon-unknown-linux-musl-clang++
|
||||||
|
ln -sf llvm-ar hexagon-unknown-linux-musl-ar
|
||||||
|
ln -sf llvm-objdump hexagon-unknown-linux-musl-objdump
|
||||||
|
ln -sf llvm-objcopy hexagon-unknown-linux-musl-objcopy
|
||||||
|
ln -sf llvm-readelf hexagon-unknown-linux-musl-readelf
|
||||||
|
ln -sf llvm-ranlib hexagon-unknown-linux-musl-ranlib
|
||||||
|
|
||||||
|
# workaround for now:
|
||||||
|
cat <<EOF > hexagon-unknown-linux-musl.cfg
|
||||||
|
-G0 --sysroot=${HEX_SYSROOT}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
build_clang_rt() {
|
||||||
|
cdp "$BASE/build-clang_rt"
|
||||||
|
cmake -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DLLVM_CONFIG_PATH="$BASE/build-llvm/bin/llvm-config" \
|
||||||
|
-DCMAKE_ASM_FLAGS="-G0 -mlong-calls -fno-pic --target=hexagon-unknown-linux-musl " \
|
||||||
|
-DCMAKE_SYSTEM_NAME=Linux \
|
||||||
|
-DCMAKE_C_COMPILER="${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang" \
|
||||||
|
-DCMAKE_ASM_COMPILER="${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang" \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${HEX_TOOLS_TARGET_BASE} \
|
||||||
|
-DCMAKE_CROSSCOMPILING=ON \
|
||||||
|
-DCMAKE_C_COMPILER_FORCED=ON \
|
||||||
|
-DCMAKE_CXX_COMPILER_FORCED=ON \
|
||||||
|
-DCOMPILER_RT_BUILD_BUILTINS=ON \
|
||||||
|
-DCOMPILER_RT_BUILTINS_ENABLE_PIC=OFF \
|
||||||
|
-DCMAKE_SIZEOF_VOID_P=4 \
|
||||||
|
-DCOMPILER_RT_OS_DIR= \
|
||||||
|
-DCAN_TARGET_hexagon=1 \
|
||||||
|
-DCAN_TARGET_x86_64=0 \
|
||||||
|
-DCOMPILER_RT_SUPPORTED_ARCH=hexagon \
|
||||||
|
-DLLVM_ENABLE_PROJECTS="compiler-rt" \
|
||||||
|
"$BASE/llvm-project/compiler-rt"
|
||||||
|
ninja install-compiler-rt
|
||||||
|
}
|
||||||
|
|
||||||
|
build_musl_headers() {
|
||||||
|
fetch "$BASE/musl" "$MUSL_URL"
|
||||||
|
cd "$BASE/musl"
|
||||||
|
make clean
|
||||||
|
CC=${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang \
|
||||||
|
CROSS_COMPILE=hexagon-unknown-linux-musl \
|
||||||
|
LIBCC=${HEX_TOOLS_TARGET_BASE}/lib/libclang_rt.builtins-hexagon.a \
|
||||||
|
CROSS_CFLAGS="-G0 -O0 -mv65 -fno-builtin -fno-rounding-math --target=hexagon-unknown-linux-musl" \
|
||||||
|
./configure --target=hexagon --prefix=${HEX_TOOLS_TARGET_BASE}
|
||||||
|
PATH=${TOOLCHAIN_BIN}:$PATH make CROSS_COMPILE= install-headers
|
||||||
|
|
||||||
|
cd ${HEX_SYSROOT}/..
|
||||||
|
ln -sf hexagon-unknown-linux-musl hexagon
|
||||||
|
}
|
||||||
|
|
||||||
|
build_kernel_headers() {
|
||||||
|
fetch "$BASE/linux" "$LINUX_URL"
|
||||||
|
mkdir -p "$BASE/build-linux"
|
||||||
|
cd "$BASE/linux"
|
||||||
|
make O=../build-linux ARCH=hexagon \
|
||||||
|
KBUILD_CFLAGS_KERNEL="-mlong-calls" \
|
||||||
|
CC=${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang \
|
||||||
|
LD=${TOOLCHAIN_BIN}/ld.lld \
|
||||||
|
KBUILD_VERBOSE=1 comet_defconfig
|
||||||
|
make mrproper
|
||||||
|
|
||||||
|
cd "$BASE/build-linux"
|
||||||
|
make \
|
||||||
|
ARCH=hexagon \
|
||||||
|
CC=${TOOLCHAIN_BIN}/clang \
|
||||||
|
INSTALL_HDR_PATH=${HEX_TOOLS_TARGET_BASE} \
|
||||||
|
V=1 \
|
||||||
|
headers_install
|
||||||
|
}
|
||||||
|
|
||||||
|
build_musl() {
|
||||||
|
cd "$BASE/musl"
|
||||||
|
make clean
|
||||||
|
CROSS_COMPILE=hexagon-unknown-linux-musl- \
|
||||||
|
AR=llvm-ar \
|
||||||
|
RANLIB=llvm-ranlib \
|
||||||
|
STRIP=llvm-strip \
|
||||||
|
CC=clang \
|
||||||
|
LIBCC=${HEX_TOOLS_TARGET_BASE}/lib/libclang_rt.builtins-hexagon.a \
|
||||||
|
CFLAGS="-G0 -O0 -mv65 -fno-builtin -fno-rounding-math --target=hexagon-unknown-linux-musl" \
|
||||||
|
./configure --target=hexagon --prefix=${HEX_TOOLS_TARGET_BASE}
|
||||||
|
PATH=${TOOLCHAIN_BIN}/:$PATH make CROSS_COMPILE= install
|
||||||
|
cd ${HEX_TOOLS_TARGET_BASE}/lib
|
||||||
|
ln -sf libc.so ld-musl-hexagon.so
|
||||||
|
ln -sf ld-musl-hexagon.so ld-musl-hexagon.so.1
|
||||||
|
cdp ${HEX_TOOLS_TARGET_BASE}/../lib
|
||||||
|
ln -sf ../usr/lib/ld-musl-hexagon.so.1
|
||||||
|
}
|
||||||
|
|
||||||
|
build_llvm_clang
|
||||||
|
build_kernel_headers
|
||||||
|
build_musl_headers
|
||||||
|
build_clang_rt
|
||||||
|
build_musl
|
|
@ -1,12 +0,0 @@
|
||||||
#
|
|
||||||
# Docker powerpc cross-compiler target
|
|
||||||
#
|
|
||||||
# This docker target builds on the debian Buster base image.
|
|
||||||
#
|
|
||||||
FROM qemu/debian10
|
|
||||||
|
|
||||||
RUN apt update && \
|
|
||||||
DEBIAN_FRONTEND=noninteractive eatmydata \
|
|
||||||
apt install -y --no-install-recommends \
|
|
||||||
gcc-powerpc-linux-gnu \
|
|
||||||
libc6-dev-powerpc-cross
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#
|
||||||
|
# Docker powerpc/ppc64/ppc64le cross-compiler target
|
||||||
|
#
|
||||||
|
# This docker target builds on the debian Bullseye base image.
|
||||||
|
#
|
||||||
|
FROM qemu/debian11
|
||||||
|
|
||||||
|
RUN apt update && \
|
||||||
|
DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||||
|
apt install -y --no-install-recommends \
|
||||||
|
gcc-powerpc-linux-gnu \
|
||||||
|
libc6-dev-powerpc-cross \
|
||||||
|
gcc-10-powerpc64-linux-gnu \
|
||||||
|
libc6-dev-ppc64-cross \
|
||||||
|
gcc-10-powerpc64le-linux-gnu \
|
||||||
|
libc6-dev-ppc64el-cross
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
#
|
|
||||||
# Docker ppc64 cross-compiler target
|
|
||||||
#
|
|
||||||
# This docker target builds on the debian Buster base image.
|
|
||||||
FROM qemu/debian10
|
|
||||||
|
|
||||||
RUN apt update && \
|
|
||||||
DEBIAN_FRONTEND=noninteractive eatmydata \
|
|
||||||
apt install -y --no-install-recommends \
|
|
||||||
gcc-powerpc64-linux-gnu \
|
|
||||||
libc6-dev-ppc64-cross
|
|
|
@ -32,6 +32,7 @@ ENV PACKAGES \
|
||||||
libcurl-devel \
|
libcurl-devel \
|
||||||
libepoxy-devel \
|
libepoxy-devel \
|
||||||
libfdt-devel \
|
libfdt-devel \
|
||||||
|
libbpf-devel \
|
||||||
libiscsi-devel \
|
libiscsi-devel \
|
||||||
libjpeg-devel \
|
libjpeg-devel \
|
||||||
libpmem-devel \
|
libpmem-devel \
|
||||||
|
|
|
@ -22,6 +22,8 @@ quiet-@ = $(if $(V),,@)
|
||||||
quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
|
quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
|
||||||
|
|
||||||
CROSS_CC_GUEST:=
|
CROSS_CC_GUEST:=
|
||||||
|
CROSS_AS_GUEST:=
|
||||||
|
CROSS_LD_GUEST:=
|
||||||
DOCKER_IMAGE:=
|
DOCKER_IMAGE:=
|
||||||
|
|
||||||
-include tests/tcg/config-$(TARGET).mak
|
-include tests/tcg/config-$(TARGET).mak
|
||||||
|
@ -42,6 +44,8 @@ cross-build-guest-tests:
|
||||||
$(call quiet-command, \
|
$(call quiet-command, \
|
||||||
(mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
|
(mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
|
||||||
$(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC="$(CROSS_CC_GUEST)" \
|
$(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC="$(CROSS_CC_GUEST)" \
|
||||||
|
$(if $(CROSS_AS_GUEST),AS="$(CROSS_AS_GUEST)") \
|
||||||
|
$(if $(CROSS_LD_GUEST),LD="$(CROSS_LD_GUEST)") \
|
||||||
SRC_PATH="$(SRC_PATH)" BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \
|
SRC_PATH="$(SRC_PATH)" BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \
|
||||||
EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
|
EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
|
||||||
"BUILD","$(TARGET) guest-tests with $(CROSS_CC_GUEST)")
|
"BUILD","$(TARGET) guest-tests with $(CROSS_CC_GUEST)")
|
||||||
|
@ -59,11 +63,24 @@ DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc \
|
||||||
-i qemu/$(DOCKER_IMAGE) \
|
-i qemu/$(DOCKER_IMAGE) \
|
||||||
-s $(SRC_PATH) -- "
|
-s $(SRC_PATH) -- "
|
||||||
|
|
||||||
|
DOCKER_AS_CMD=$(if $(DOCKER_CROSS_AS_GUEST),"$(DOCKER_SCRIPT) cc \
|
||||||
|
--cc $(DOCKER_CROSS_AS_GUEST) \
|
||||||
|
-i qemu/$(DOCKER_IMAGE) \
|
||||||
|
-s $(SRC_PATH) -- ")
|
||||||
|
|
||||||
|
DOCKER_LD_CMD=$(if $(DOCKER_CROSS_LD_GUEST),"$(DOCKER_SCRIPT) cc \
|
||||||
|
--cc $(DOCKER_CROSS_LD_GUEST) \
|
||||||
|
-i qemu/$(DOCKER_IMAGE) \
|
||||||
|
-s $(SRC_PATH) -- ")
|
||||||
|
|
||||||
|
|
||||||
.PHONY: docker-build-guest-tests
|
.PHONY: docker-build-guest-tests
|
||||||
docker-build-guest-tests: docker-image-$(DOCKER_IMAGE)
|
docker-build-guest-tests: docker-image-$(DOCKER_IMAGE)
|
||||||
$(call quiet-command, \
|
$(call quiet-command, \
|
||||||
(mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
|
(mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
|
||||||
$(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC=$(DOCKER_COMPILE_CMD) \
|
$(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC=$(DOCKER_COMPILE_CMD) \
|
||||||
|
$(if $(DOCKER_AS_CMD),AS=$(DOCKER_AS_CMD)) \
|
||||||
|
$(if $(DOCKER_LD_CMD),LD=$(DOCKER_LD_CMD)) \
|
||||||
SRC_PATH="$(SRC_PATH)" BUILD_STATIC=y \
|
SRC_PATH="$(SRC_PATH)" BUILD_STATIC=y \
|
||||||
EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
|
EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
|
||||||
"BUILD","$(TARGET) guest-tests with docker qemu/$(DOCKER_IMAGE)")
|
"BUILD","$(TARGET) guest-tests with docker qemu/$(DOCKER_IMAGE)")
|
||||||
|
|
|
@ -43,9 +43,10 @@ quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
|
||||||
|
|
||||||
# $1 = test name, $2 = cmd, $3 = desc
|
# $1 = test name, $2 = cmd, $3 = desc
|
||||||
ifdef CONFIG_USER_ONLY
|
ifdef CONFIG_USER_ONLY
|
||||||
run-test = $(call quiet-command, timeout $(TIMEOUT) $2 > $1.out,"TEST",$3)
|
run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2 > $1.out, \
|
||||||
|
"TEST",$3)
|
||||||
else
|
else
|
||||||
run-test = $(call quiet-command, timeout $(TIMEOUT) $2,"TEST",$3)
|
run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2,"TEST",$3)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# $1 = test name, $2 = reference
|
# $1 = test name, $2 = reference
|
||||||
|
|
|
@ -74,37 +74,17 @@ fi
|
||||||
|
|
||||||
for target in $target_list; do
|
for target in $target_list; do
|
||||||
arch=${target%%-*}
|
arch=${target%%-*}
|
||||||
case $arch in
|
|
||||||
arm|armeb)
|
|
||||||
arches=arm
|
|
||||||
;;
|
|
||||||
aarch64|aarch64_be)
|
|
||||||
arches="aarch64 arm"
|
|
||||||
;;
|
|
||||||
mips*)
|
|
||||||
arches=mips
|
|
||||||
;;
|
|
||||||
ppc*)
|
|
||||||
arches=ppc
|
|
||||||
;;
|
|
||||||
sh4|sh4eb)
|
|
||||||
arches=sh4
|
|
||||||
;;
|
|
||||||
x86_64)
|
|
||||||
arches="x86_64 i386"
|
|
||||||
;;
|
|
||||||
xtensa|xtensaeb)
|
|
||||||
arches=xtensa
|
|
||||||
;;
|
|
||||||
alpha|cris|hexagon|hppa|i386|microblaze|microblazeel|m68k|openrisc|riscv64|s390x|sh4|sparc64)
|
|
||||||
arches=$target
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
# reset all container fields
|
||||||
container_image=
|
container_image=
|
||||||
|
container_hosts=
|
||||||
|
container_cross_cc=
|
||||||
|
container_cross_as=
|
||||||
|
container_cross_ld=
|
||||||
|
|
||||||
|
# suppress clang
|
||||||
|
supress_clang=
|
||||||
|
|
||||||
case $target in
|
case $target in
|
||||||
aarch64-*)
|
aarch64-*)
|
||||||
# We don't have any bigendian build tools so we only use this for AArch64
|
# We don't have any bigendian build tools so we only use this for AArch64
|
||||||
|
@ -128,6 +108,11 @@ for target in $target_list; do
|
||||||
container_image=fedora-cris-cross
|
container_image=fedora-cris-cross
|
||||||
container_cross_cc=cris-linux-gnu-gcc
|
container_cross_cc=cris-linux-gnu-gcc
|
||||||
;;
|
;;
|
||||||
|
hexagon-*)
|
||||||
|
container_hosts=x86_64
|
||||||
|
container_image=debian-hexagon-cross
|
||||||
|
container_cross_cc=hexagon-unknown-linux-musl-clang
|
||||||
|
;;
|
||||||
hppa-*)
|
hppa-*)
|
||||||
container_hosts=x86_64
|
container_hosts=x86_64
|
||||||
container_image=debian-hppa-cross
|
container_image=debian-hppa-cross
|
||||||
|
@ -137,6 +122,7 @@ for target in $target_list; do
|
||||||
container_hosts=x86_64
|
container_hosts=x86_64
|
||||||
container_image=fedora-i386-cross
|
container_image=fedora-i386-cross
|
||||||
container_cross_cc=gcc
|
container_cross_cc=gcc
|
||||||
|
supress_clang=yes
|
||||||
;;
|
;;
|
||||||
m68k-*)
|
m68k-*)
|
||||||
container_hosts=x86_64
|
container_hosts=x86_64
|
||||||
|
@ -165,18 +151,14 @@ for target in $target_list; do
|
||||||
;;
|
;;
|
||||||
ppc-*|ppc64abi32-*)
|
ppc-*|ppc64abi32-*)
|
||||||
container_hosts=x86_64
|
container_hosts=x86_64
|
||||||
container_image=debian-powerpc-cross
|
container_image=debian-powerpc-test-cross
|
||||||
container_cross_cc=powerpc-linux-gnu-gcc
|
container_cross_cc=powerpc-linux-gnu-gcc-10
|
||||||
;;
|
;;
|
||||||
ppc64-*)
|
ppc64-*|ppc64le-*)
|
||||||
container_hosts=x86_64
|
container_hosts=x86_64
|
||||||
container_image=debian-ppc64-cross
|
container_image=debian-powerpc-test-cross
|
||||||
container_cross_cc=powerpc64-linux-gnu-gcc
|
container_cross_cc=${target%%-*}-linux-gnu-gcc-10
|
||||||
;;
|
container_cross_cc=powerpc${container_cross_cc#ppc}
|
||||||
ppc64le-*)
|
|
||||||
container_hosts=x86_64
|
|
||||||
container_image=debian-ppc64el-cross
|
|
||||||
container_cross_cc=powerpc64le-linux-gnu-gcc
|
|
||||||
;;
|
;;
|
||||||
riscv64-*)
|
riscv64-*)
|
||||||
container_hosts=x86_64
|
container_hosts=x86_64
|
||||||
|
@ -198,10 +180,17 @@ for target in $target_list; do
|
||||||
container_image=debian-sparc64-cross
|
container_image=debian-sparc64-cross
|
||||||
container_cross_cc=sparc64-linux-gnu-gcc
|
container_cross_cc=sparc64-linux-gnu-gcc
|
||||||
;;
|
;;
|
||||||
|
tricore-softmmu)
|
||||||
|
container_hosts=x86_64
|
||||||
|
container_image=debian-tricore-cross
|
||||||
|
container_cross_as=tricore-as
|
||||||
|
container_cross_ld=tricore-ld
|
||||||
|
;;
|
||||||
x86_64-*)
|
x86_64-*)
|
||||||
container_hosts="aarch64 ppc64el x86_64"
|
container_hosts="aarch64 ppc64el x86_64"
|
||||||
container_image=debian-amd64-cross
|
container_image=debian-amd64-cross
|
||||||
container_cross_cc=x86_64-linux-gnu-gcc
|
container_cross_cc=x86_64-linux-gnu-gcc
|
||||||
|
supress_clang=yes
|
||||||
;;
|
;;
|
||||||
xtensa*-softmmu)
|
xtensa*-softmmu)
|
||||||
container_hosts=x86_64
|
container_hosts=x86_64
|
||||||
|
@ -216,6 +205,7 @@ for target in $target_list; do
|
||||||
|
|
||||||
echo "# Automatically generated by configure - do not modify" > $config_target_mak
|
echo "# Automatically generated by configure - do not modify" > $config_target_mak
|
||||||
echo "TARGET_NAME=$arch" >> $config_target_mak
|
echo "TARGET_NAME=$arch" >> $config_target_mak
|
||||||
|
echo "target=$target" >> $config_target_mak
|
||||||
case $target in
|
case $target in
|
||||||
*-linux-user | *-bsd-user)
|
*-linux-user | *-bsd-user)
|
||||||
echo "CONFIG_USER_ONLY=y" >> $config_target_mak
|
echo "CONFIG_USER_ONLY=y" >> $config_target_mak
|
||||||
|
@ -231,74 +221,91 @@ for target in $target_list; do
|
||||||
echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak
|
echo "CROSS_CC_GUEST_CFLAGS=$target_compiler_cflags" >> $config_target_mak
|
||||||
|
|
||||||
got_cross_cc=no
|
got_cross_cc=no
|
||||||
for i in $arch $arches; do
|
|
||||||
if eval test "x\${cross_cc_$i+yes}" != xyes; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
eval "target_compiler=\${cross_cc_$i}"
|
if eval test "x\${cross_cc_$arch}" != xyes; then
|
||||||
if ! has $target_compiler; then
|
eval "target_compiler=\${cross_cc_$arch}"
|
||||||
continue
|
|
||||||
fi
|
if has "$target_compiler"; then
|
||||||
write_c_skeleton
|
if test "$supress_clang" = yes &&
|
||||||
if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC -static ; then
|
$target_compiler --version | grep -qi "clang"; then
|
||||||
# For host systems we might get away with building without -static
|
got_cross_cc=no
|
||||||
if ! do_compiler "$target_compiler" $target_compiler_cflags -o $TMPE $TMPC ; then
|
else
|
||||||
continue
|
write_c_skeleton
|
||||||
|
if ! do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
|
-o $TMPE $TMPC -static ; then
|
||||||
|
# For host systems we might get away with building without -static
|
||||||
|
if do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
|
-o $TMPE $TMPC ; then
|
||||||
|
got_cross_cc=yes
|
||||||
|
echo "CROSS_CC_GUEST_STATIC=y" >> $config_target_mak
|
||||||
|
echo "CROSS_CC_GUEST=$target_compiler" >> $config_target_mak
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
got_cross_cc=yes
|
||||||
|
echo "CROSS_CC_GUEST_STATIC=y" >> $config_target_mak
|
||||||
|
echo "CROSS_CC_GUEST=$target_compiler" >> $config_target_mak
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
echo "CROSS_CC_GUEST_STATIC=y" >> $config_target_mak
|
fi
|
||||||
else
|
|
||||||
echo "CROSS_CC_GUEST_STATIC=y" >> $config_target_mak
|
|
||||||
fi
|
|
||||||
echo "CROSS_CC_GUEST=$target_compiler" >> $config_target_mak
|
|
||||||
|
|
||||||
# Test for compiler features for optional tests. We only do this
|
if test $got_cross_cc = yes; then
|
||||||
# for cross compilers because ensuring the docker containers based
|
# Test for compiler features for optional tests. We only do this
|
||||||
# compilers is a requirememt for adding a new test that needs a
|
# for cross compilers because ensuring the docker containers based
|
||||||
# compiler feature.
|
# compilers is a requirememt for adding a new test that needs a
|
||||||
case $target in
|
# compiler feature.
|
||||||
aarch64-*)
|
|
||||||
if do_compiler "$target_compiler" $target_compiler_cflags \
|
|
||||||
-march=armv8.1-a+sve -o $TMPE $TMPC; then
|
|
||||||
echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak
|
|
||||||
fi
|
|
||||||
if do_compiler "$target_compiler" $target_compiler_cflags \
|
|
||||||
-march=armv8.3-a -o $TMPE $TMPC; then
|
|
||||||
echo "CROSS_CC_HAS_ARMV8_3=y" >> $config_target_mak
|
|
||||||
fi
|
|
||||||
if do_compiler "$target_compiler" $target_compiler_cflags \
|
|
||||||
-mbranch-protection=standard -o $TMPE $TMPC; then
|
|
||||||
echo "CROSS_CC_HAS_ARMV8_BTI=y" >> $config_target_mak
|
|
||||||
fi
|
|
||||||
if do_compiler "$target_compiler" $target_compiler_cflags \
|
|
||||||
-march=armv8.5-a+memtag -o $TMPE $TMPC; then
|
|
||||||
echo "CROSS_CC_HAS_ARMV8_MTE=y" >> $config_target_mak
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
ppc*)
|
|
||||||
if do_compiler "$target_compiler" $target_compiler_cflags \
|
|
||||||
-mpower8-vector -o $TMPE $TMPC; then
|
|
||||||
echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
i386-linux-user)
|
|
||||||
if do_compiler "$target_compiler" $target_compiler_cflags \
|
|
||||||
-Werror -fno-pie -o $TMPE $TMPC; then
|
|
||||||
echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
enabled_cross_compilers="$enabled_cross_compilers $target_compiler"
|
case $target in
|
||||||
got_cross_cc=yes
|
aarch64-*)
|
||||||
break
|
if do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
done
|
-march=armv8.1-a+sve -o $TMPE $TMPC; then
|
||||||
|
echo "CROSS_CC_HAS_SVE=y" >> $config_target_mak
|
||||||
if test $got_cross_cc = no && test "$container" != no && test -n "$container_image"; then
|
fi
|
||||||
|
if do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
|
-march=armv8.3-a -o $TMPE $TMPC; then
|
||||||
|
echo "CROSS_CC_HAS_ARMV8_3=y" >> $config_target_mak
|
||||||
|
fi
|
||||||
|
if do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
|
-mbranch-protection=standard -o $TMPE $TMPC; then
|
||||||
|
echo "CROSS_CC_HAS_ARMV8_BTI=y" >> $config_target_mak
|
||||||
|
fi
|
||||||
|
if do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
|
-march=armv8.5-a+memtag -o $TMPE $TMPC; then
|
||||||
|
echo "CROSS_CC_HAS_ARMV8_MTE=y" >> $config_target_mak
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
ppc*)
|
||||||
|
if do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
|
-mpower8-vector -o $TMPE $TMPC; then
|
||||||
|
echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> $config_target_mak
|
||||||
|
fi
|
||||||
|
if do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
|
-mpower10 -o $TMPE $TMPC; then
|
||||||
|
echo "CROSS_CC_HAS_POWER10=y" >> $config_target_mak
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
i386-linux-user)
|
||||||
|
if do_compiler "$target_compiler" $target_compiler_cflags \
|
||||||
|
-Werror -fno-pie -o $TMPE $TMPC; then
|
||||||
|
echo "CROSS_CC_HAS_I386_NOPIE=y" >> $config_target_mak
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
elif test $got_cross_cc = no && test "$container" != no && \
|
||||||
|
test -n "$container_image"; then
|
||||||
for host in $container_hosts; do
|
for host in $container_hosts; do
|
||||||
if test "$host" = "$ARCH"; then
|
if test "$host" = "$ARCH"; then
|
||||||
echo "DOCKER_IMAGE=$container_image" >> $config_target_mak
|
echo "DOCKER_IMAGE=$container_image" >> $config_target_mak
|
||||||
echo "DOCKER_CROSS_CC_GUEST=$container_cross_cc" >> $config_target_mak
|
echo "DOCKER_CROSS_CC_GUEST=$container_cross_cc" >> \
|
||||||
|
$config_target_mak
|
||||||
|
if test -n "$container_cross_as"; then
|
||||||
|
echo "DOCKER_CROSS_AS_GUEST=$container_cross_as" >> \
|
||||||
|
$config_target_mak
|
||||||
|
fi
|
||||||
|
if test -n "$container_cross_ld"; then
|
||||||
|
echo "DOCKER_CROSS_LD_GUEST=$container_cross_ld" >> \
|
||||||
|
$config_target_mak
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -326,6 +326,7 @@ static bool do_unsigned_test(init_ufn fn)
|
||||||
fn(i);
|
fn(i);
|
||||||
ok = do_unsigned_reads(i);
|
ok = do_unsigned_reads(i);
|
||||||
}
|
}
|
||||||
|
return ok;
|
||||||
#else
|
#else
|
||||||
fn(0);
|
fn(0);
|
||||||
return do_unsigned_reads(0);
|
return do_unsigned_reads(0);
|
||||||
|
|
|
@ -10,4 +10,17 @@ PPC64_TESTS=bcdsub
|
||||||
endif
|
endif
|
||||||
bcdsub: CFLAGS += -mpower8-vector
|
bcdsub: CFLAGS += -mpower8-vector
|
||||||
|
|
||||||
|
PPC64_TESTS += byte_reverse
|
||||||
|
ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
|
||||||
|
run-byte_reverse: QEMU_OPTS+=-cpu POWER10
|
||||||
|
run-plugin-byte_reverse-with-%: QEMU_OPTS+=-cpu POWER10
|
||||||
|
else
|
||||||
|
byte_reverse:
|
||||||
|
$(call skip-test, "BUILD of $@", "missing compiler support")
|
||||||
|
run-byte_reverse:
|
||||||
|
$(call skip-test, "RUN of byte_reverse", "not built")
|
||||||
|
run-plugin-byte_reverse-with-%:
|
||||||
|
$(call skip-test, "RUN of byte_reverse ($*)", "not built")
|
||||||
|
endif
|
||||||
|
|
||||||
TESTS += $(PPC64_TESTS)
|
TESTS += $(PPC64_TESTS)
|
||||||
|
|
|
@ -9,4 +9,17 @@ PPC64LE_TESTS=bcdsub
|
||||||
endif
|
endif
|
||||||
bcdsub: CFLAGS += -mpower8-vector
|
bcdsub: CFLAGS += -mpower8-vector
|
||||||
|
|
||||||
|
PPC64LE_TESTS += byte_reverse
|
||||||
|
ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_POWER10),)
|
||||||
|
run-byte_reverse: QEMU_OPTS+=-cpu POWER10
|
||||||
|
run-plugin-byte_reverse-with-%: QEMU_OPTS+=-cpu POWER10
|
||||||
|
else
|
||||||
|
byte_reverse:
|
||||||
|
$(call skip-test, "BUILD of $@", "missing compiler support")
|
||||||
|
run-byte_reverse:
|
||||||
|
$(call skip-test, "RUN of byte_reverse", "not built")
|
||||||
|
run-plugin-byte_reverse-with-%:
|
||||||
|
$(call skip-test, "RUN of byte_reverse ($*)", "not built")
|
||||||
|
endif
|
||||||
|
|
||||||
TESTS += $(PPC64LE_TESTS)
|
TESTS += $(PPC64LE_TESTS)
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
unsigned long var;
|
||||||
|
|
||||||
|
var = 0xFEDCBA9876543210;
|
||||||
|
asm("brh %0, %0" : "+r"(var));
|
||||||
|
assert(var == 0xDCFE98BA54761032);
|
||||||
|
|
||||||
|
var = 0xFEDCBA9876543210;
|
||||||
|
asm("brw %0, %0" : "+r"(var));
|
||||||
|
assert(var == 0x98BADCFE10325476);
|
||||||
|
|
||||||
|
var = 0xFEDCBA9876543210;
|
||||||
|
asm("brd %0, %0" : "+r"(var));
|
||||||
|
assert(var == 0x1032547698BADCFE);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
TESTS_PATH = $(SRC_PATH)/tests/tcg/tricore
|
||||||
|
|
||||||
|
LDFLAGS = -T$(TESTS_PATH)/link.ld
|
||||||
|
ASFLAGS =
|
||||||
|
|
||||||
|
TESTS += test_abs.tst
|
||||||
|
TESTS += test_bmerge.tst
|
||||||
|
TESTS += test_clz.tst
|
||||||
|
TESTS += test_dvstep.tst
|
||||||
|
TESTS += test_fadd.tst
|
||||||
|
TESTS += test_fmul.tst
|
||||||
|
TESTS += test_ftoi.tst
|
||||||
|
TESTS += test_madd.tst
|
||||||
|
TESTS += test_msub.tst
|
||||||
|
TESTS += test_muls.tst
|
||||||
|
|
||||||
|
QEMU_OPTS += -M tricore_testboard -nographic -kernel
|
||||||
|
|
||||||
|
%.pS: $(TESTS_PATH)/%.S
|
||||||
|
$(HOST_CC) -E -o $@ $<
|
||||||
|
|
||||||
|
%.o: %.pS
|
||||||
|
$(AS) $(ASFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
%.tst: %.o
|
||||||
|
$(LD) $(LDFLAGS) $< -o $@
|
|
@ -0,0 +1,60 @@
|
||||||
|
/* Default linker script, for normal executables */
|
||||||
|
OUTPUT_FORMAT("elf32-tricore")
|
||||||
|
OUTPUT_ARCH(tricore)
|
||||||
|
ENTRY(_start)
|
||||||
|
|
||||||
|
/* the internal ram description */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
text_ram (rx!p): org = 0x80000000, len = 15K
|
||||||
|
data_ram (w!xp): org = 0xd0000000, len = 130K
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Define the sizes of the user and system stacks.
|
||||||
|
*/
|
||||||
|
__USTACK_SIZE = DEFINED (__USTACK_SIZE) ? __USTACK_SIZE : 1K ;
|
||||||
|
/*
|
||||||
|
* Define the start address and the size of the context save area.
|
||||||
|
*/
|
||||||
|
__CSA_BEGIN = 0xd0000000 ;
|
||||||
|
__CSA_SIZE = 8k ;
|
||||||
|
__CSA_END = __CSA_BEGIN + __CSA_SIZE ;
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
*(.text)
|
||||||
|
. = ALIGN(8);
|
||||||
|
} > text_ram
|
||||||
|
|
||||||
|
.rodata :
|
||||||
|
{
|
||||||
|
*(.rodata)
|
||||||
|
*(.rodata1)
|
||||||
|
} > data_ram
|
||||||
|
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
. = ALIGN(8) ;
|
||||||
|
*(.data)
|
||||||
|
*(.data.*)
|
||||||
|
. = ALIGN(8) ;
|
||||||
|
__USTACK = . + __USTACK_SIZE -768;
|
||||||
|
|
||||||
|
} > data_ram
|
||||||
|
/*
|
||||||
|
* Allocate space for BSS sections.
|
||||||
|
*/
|
||||||
|
.bss :
|
||||||
|
{
|
||||||
|
BSS_BASE = . ;
|
||||||
|
*(.bss)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(8) ;
|
||||||
|
} > data_ram
|
||||||
|
/* Make sure CSA, stack and heap addresses are properly aligned. */
|
||||||
|
_. = ASSERT ((__CSA_BEGIN & 0x3f) == 0 , "illegal CSA start address") ;
|
||||||
|
_. = ASSERT ((__CSA_SIZE & 0x3f) == 0 , "illegal CSA size") ;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
/* Helpers */
|
||||||
|
#define LI(reg, val) \
|
||||||
|
mov.u reg, lo:val; \
|
||||||
|
movh DREG_TEMP_LI, up:val; \
|
||||||
|
or reg, reg, DREG_TEMP_LI; \
|
||||||
|
|
||||||
|
/* Address definitions */
|
||||||
|
#define TESTDEV_ADDR 0xf0000000
|
||||||
|
/* Register definitions */
|
||||||
|
#define DREG_RS1 %d0
|
||||||
|
#define DREG_RS2 %d1
|
||||||
|
#define DREG_RS3 %d4
|
||||||
|
#define DREG_CALC_RESULT %d1
|
||||||
|
#define DREG_CALC_PSW %d2
|
||||||
|
#define DREG_CORRECT_PSW %d3
|
||||||
|
#define DREG_TEMP_LI %d10
|
||||||
|
#define DREG_TEMP %d11
|
||||||
|
#define DREG_TEST_NUM %d14
|
||||||
|
#define DREG_CORRECT_RESULT %d15
|
||||||
|
|
||||||
|
#define DREG_DEV_ADDR %a15
|
||||||
|
|
||||||
|
#define EREG_RS1 %e6
|
||||||
|
#define EREG_RS1_LO %d6
|
||||||
|
#define EREG_RS1_HI %d7
|
||||||
|
#define EREG_RS2 %e8
|
||||||
|
#define EREG_RS2_LO %d8
|
||||||
|
#define EREG_RS2_HI %d9
|
||||||
|
#define EREG_CALC_RESULT %e8
|
||||||
|
#define EREG_CALC_RESULT_HI %d9
|
||||||
|
#define EREG_CALC_RESULT_LO %d8
|
||||||
|
#define EREG_CORRECT_RESULT_LO %d0
|
||||||
|
#define EREG_CORRECT_RESULT_HI %d1
|
||||||
|
|
||||||
|
/* Test case wrappers */
|
||||||
|
#define TEST_CASE(num, testreg, correct, code...) \
|
||||||
|
test_ ## num: \
|
||||||
|
code; \
|
||||||
|
LI(DREG_CORRECT_RESULT, correct) \
|
||||||
|
mov DREG_TEST_NUM, num; \
|
||||||
|
jne testreg, DREG_CORRECT_RESULT, fail \
|
||||||
|
|
||||||
|
#define TEST_CASE_E(num, correct_lo, correct_hi, code...) \
|
||||||
|
test_ ## num: \
|
||||||
|
code; \
|
||||||
|
mov DREG_TEST_NUM, num; \
|
||||||
|
LI(EREG_CORRECT_RESULT_LO, correct_lo) \
|
||||||
|
jne EREG_CALC_RESULT_LO, EREG_CORRECT_RESULT_LO, fail; \
|
||||||
|
LI(EREG_CORRECT_RESULT_HI, correct_hi) \
|
||||||
|
jne EREG_CALC_RESULT_HI, EREG_CORRECT_RESULT_HI, fail;
|
||||||
|
|
||||||
|
#define TEST_CASE_PSW(num, testreg, correct, correct_psw, code...) \
|
||||||
|
test_ ## num: \
|
||||||
|
code; \
|
||||||
|
LI(DREG_CORRECT_RESULT, correct) \
|
||||||
|
mov DREG_TEST_NUM, num; \
|
||||||
|
jne testreg, DREG_CORRECT_RESULT, fail; \
|
||||||
|
mfcr DREG_CALC_PSW, $psw; \
|
||||||
|
LI(DREG_CORRECT_PSW, correct_psw) \
|
||||||
|
mov DREG_TEST_NUM, num; \
|
||||||
|
jne DREG_CALC_PSW, DREG_CORRECT_PSW, fail;
|
||||||
|
|
||||||
|
/* Actual test case type
|
||||||
|
* e.g inst %dX, %dY -> TEST_D_D
|
||||||
|
* inst %dX, %dY, %dZ -> TEST_D_DD
|
||||||
|
* inst %eX, %dY, %dZ -> TEST_E_DD
|
||||||
|
*/
|
||||||
|
#define TEST_D_D(insn, num, result, rs1) \
|
||||||
|
TEST_CASE(num, DREG_CALC_RESULT, result, \
|
||||||
|
LI(DREG_RS1, rs1); \
|
||||||
|
insn DREG_CALC_RESULT, DREG_RS1; \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define TEST_D_D_PSW(insn, num, result, psw, rs1) \
|
||||||
|
TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw, \
|
||||||
|
LI(DREG_RS1, rs1); \
|
||||||
|
rstv; \
|
||||||
|
insn DREG_CORRECT_RESULT, DREG_RS1; \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define TEST_D_DD_PSW(insn, num, result, psw, rs1, rs2) \
|
||||||
|
TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw, \
|
||||||
|
LI(DREG_RS1, rs1); \
|
||||||
|
LI(DREG_RS2, rs2); \
|
||||||
|
rstv; \
|
||||||
|
insn DREG_CALC_RESULT, DREG_RS1, DREG_RS2; \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define TEST_D_DDD_PSW(insn, num, result, psw, rs1, rs2, rs3) \
|
||||||
|
TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw, \
|
||||||
|
LI(DREG_RS1, rs1); \
|
||||||
|
LI(DREG_RS2, rs2); \
|
||||||
|
LI(DREG_RS3, rs3); \
|
||||||
|
rstv; \
|
||||||
|
insn DREG_CALC_RESULT, DREG_RS1, DREG_RS2, DREG_RS3; \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define TEST_D_DDI_PSW(insn, num, result, psw, rs1, rs2, imm) \
|
||||||
|
TEST_CASE_PSW(num, DREG_CALC_RESULT, result, psw, \
|
||||||
|
LI(DREG_RS1, rs1); \
|
||||||
|
LI(DREG_RS2, rs2); \
|
||||||
|
rstv; \
|
||||||
|
insn DREG_CALC_RESULT, DREG_RS1, DREG_RS2, imm; \
|
||||||
|
)
|
||||||
|
|
||||||
|
#define TEST_E_ED(insn, num, res_hi, res_lo, rs1_hi, rs1_lo, rs2) \
|
||||||
|
TEST_CASE_E(num, res_lo, res_hi, \
|
||||||
|
LI(EREG_RS1_LO, rs1_lo); \
|
||||||
|
LI(EREG_RS1_HI, rs1_hi); \
|
||||||
|
LI(DREG_RS2, rs2); \
|
||||||
|
insn EREG_CALC_RESULT, EREG_RS1, DREG_RS2; \
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Pass/Fail handling part */
|
||||||
|
#define TEST_PASSFAIL \
|
||||||
|
j pass; \
|
||||||
|
fail: \
|
||||||
|
LI(DREG_TEMP, TESTDEV_ADDR) \
|
||||||
|
mov.a DREG_DEV_ADDR, DREG_TEMP; \
|
||||||
|
st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\
|
||||||
|
debug; \
|
||||||
|
j fail; \
|
||||||
|
pass: \
|
||||||
|
LI(DREG_TEMP, TESTDEV_ADDR) \
|
||||||
|
mov.a DREG_DEV_ADDR, DREG_TEMP; \
|
||||||
|
mov DREG_TEST_NUM, 0; \
|
||||||
|
st.w [DREG_DEV_ADDR], DREG_TEST_NUM;\
|
||||||
|
debug; \
|
||||||
|
j pass;
|
|
@ -0,0 +1,7 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_D(abs, 1, 0, 0)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
|
@ -0,0 +1,8 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_DD_PSW(bmerge, 1, 0x555557f7, 0x00000b80, 0x0000001d, 0x0000ffff)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_D(cls.h, 1, 0x0, 0x6db17976)
|
||||||
|
TEST_D_D(cls.h, 2, 0x000f000f, 0x0)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
# Result RS1 RS2
|
||||||
|
TEST_E_ED(dvstep, 1, 0x000001ff, 0xfffe5cff, 0x00000001, 0xfffffe5c, 0x0)
|
||||||
|
TEST_E_ED(dvstep, 2, 0x00000000, 0x000000ff, 0x00000000, 0x00000000, 0x0)
|
||||||
|
TEST_E_ED(dvstep, 3, 0x0000f000, 0x000000fd, 0x010000f0, 0x00000000, 0x0)
|
||||||
|
TEST_E_ED(dvstep, 4, 0xfffff000, 0x00000000, 0x7ffffff0, 0x00000000, 0x0)
|
||||||
|
TEST_E_ED(dvstep.u, 5, 0xffffff00, 0x100008ff, 0xffffffff, 0x00100008, 0x0)
|
||||||
|
TEST_E_ED(dvstep.u, 6, 0x00000100, 0x00000000, 0x08000001, 0x00000000, \
|
||||||
|
0xffffff2d)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_DD_PSW(add.f, 1, 0x7fc00000, 0x00000b80, 0xffffff85, 0x00001234)
|
||||||
|
TEST_D_DD_PSW(add.f, 2, 0xf9c00000, 0x00000b80, 0xf9400000, 0xf9400000)
|
||||||
|
TEST_D_DD_PSW(add.f, 3, 0x8bb858ca, 0x00000b80, 0x8b3858ca, 0x8b3858ca)
|
||||||
|
TEST_D_DD_PSW(add.f, 4, 0x00000000, 0x00000b80, 0x000000ff, 0x00000000)
|
||||||
|
TEST_D_DD_PSW(add.f, 5, 0x7fc00000, 0x00000b80, 0xfffffe52, 0x0a4cf70c)
|
||||||
|
TEST_D_DD_PSW(add.f, 6, 0x9e6d5076, 0x84000b80, 0x9ded50ec, 0x9ded4fff)
|
||||||
|
TEST_D_DD_PSW(add.f, 7, 0x00000000, 0x04000b80, 0x0000e8bd, 0x00000000)
|
||||||
|
TEST_D_DD_PSW(add.f, 8, 0x7fc00000, 0xc4000b80, 0xffad546e, 0xffad546e)
|
||||||
|
TEST_D_DD_PSW(add.f, 9, 0x7fc00000, 0x04000b80, 0xfffe0000, 0x08130000)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_DD_PSW(mul.f, 1, 0x974f4f0a, 0x84000b80, 0x1a0b1980, 0xbcbec42d)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_D_PSW(ftoi, 1, 0x0, 0x84000b80, 0x05f6e605)
|
||||||
|
TEST_D_D_PSW(ftoi, 2, 0x0, 0x04000b80, 0x00012200)
|
||||||
|
TEST_D_D_PSW(ftoi, 3, 0x0, 0xc4000b80, 0xffffffff)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_DDI_PSW(madd, 1, 0x0000fffd, 0x60000b80, 0x0000ffff, 0x7fffffff,2)
|
||||||
|
TEST_D_DDI_PSW(madd, 2, 0xffff7fff, 0x60000b80, 0xffff8001, 0x7fffffff,2)
|
||||||
|
TEST_D_DDD_PSW(madds.u, 3, 0xffffffff, 0x60000b80, 0x00000000, 0x80000000, \
|
||||||
|
0x80000000)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_DDI_PSW(msub, 1, 0xd2fbe5e0, 0x00000b80,0x64003300, 0xff5420d4, -216)
|
||||||
|
TEST_D_DDI_PSW(msub, 2, 0xfffffc10, 0x00000b80,0xfffffe68, 0xfffffffd, -200)
|
||||||
|
TEST_D_DDD_PSW(msubs.u, 3, 0x0, 0x60000b80, 0x1, 0xffffffff, 0xffffffdb)
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#include "macros.h"
|
||||||
|
.text
|
||||||
|
.global _start
|
||||||
|
_start:
|
||||||
|
TEST_D_DD_PSW(muls.u, 1, 0xffffffff, 0x78000b80, 0x80000001, 0xffffffff)
|
||||||
|
TEST_D_DD_PSW(muls.u, 2, 0xffffffff, 0x60000b80, 0xfffffffe, 0xffffffff)
|
||||||
|
|
||||||
|
TEST_PASSFAIL
|
||||||
|
|
Loading…
Reference in New Issue