In preparation for building versions of the load programs for fp-stress that run as KVM guests move the functions that perform syscalls out of the shared code assembly code in asm-utils.S into a new Linux specific file asm-utils-linux.S.
No functional change. Signed-off-by: Mark Brown <[email protected]> --- tools/testing/selftests/arm64/fp/Makefile | 17 +++++---- tools/testing/selftests/arm64/fp/asm-utils-linux.S | 43 ++++++++++++++++++++++ tools/testing/selftests/arm64/fp/asm-utils.S | 36 ------------------ 3 files changed, 53 insertions(+), 43 deletions(-) diff --git a/tools/testing/selftests/arm64/fp/Makefile b/tools/testing/selftests/arm64/fp/Makefile index d171021e4cdd..183e9d319b65 100644 --- a/tools/testing/selftests/arm64/fp/Makefile +++ b/tools/testing/selftests/arm64/fp/Makefile @@ -22,21 +22,24 @@ TEST_GEN_PROGS_EXTENDED := fp-pidbench fpsimd-test \ vlset TEST_PROGS_EXTENDED := fpsimd-stress sve-stress ssve-stress za-stress -EXTRA_CLEAN += $(OUTPUT)/asm-utils.o $(OUTPUT)/rdvl.o $(OUTPUT)/za-fork-asm.o +EXTRA_CLEAN += $(OUTPUT)/asm-utils.o $(OUTPUT)/asm-utils-linux.o \ + $(OUTPUT)/rdvl.o $(OUTPUT)/za-fork-asm.o + +ASM_UTILS := $(OUTPUT)/asm-utils.o $(OUTPUT)/asm-utils-linux.o # Build with nolibc to avoid effects due to libc's clone() support -$(OUTPUT)/fp-pidbench: fp-pidbench.S $(OUTPUT)/asm-utils.o +$(OUTPUT)/fp-pidbench: fp-pidbench.S $(ASM_UTILS) $(CC) -nostdlib $^ -o $@ $(OUTPUT)/fp-ptrace: fp-ptrace.c fp-ptrace-asm.S -$(OUTPUT)/fpsimd-test: fpsimd-test.S $(OUTPUT)/asm-utils.o +$(OUTPUT)/fpsimd-test: fpsimd-test.S $(ASM_UTILS) $(CC) -nostdlib $^ -o $@ $(OUTPUT)/rdvl-sve: rdvl-sve.c $(OUTPUT)/rdvl.o $(OUTPUT)/rdvl-sme: rdvl-sme.c $(OUTPUT)/rdvl.o $(OUTPUT)/sve-ptrace: sve-ptrace.c $(OUTPUT)/sve-probe-vls: sve-probe-vls.c $(OUTPUT)/rdvl.o -$(OUTPUT)/sve-test: sve-test.S $(OUTPUT)/asm-utils.o +$(OUTPUT)/sve-test: sve-test.S $(ASM_UTILS) $(CC) -nostdlib $^ -o $@ -$(OUTPUT)/ssve-test: sve-test.S $(OUTPUT)/asm-utils.o +$(OUTPUT)/ssve-test: sve-test.S $(ASM_UTILS) $(CC) -DSSVE -nostdlib $^ -o $@ $(OUTPUT)/vec-syscfg: vec-syscfg.c $(OUTPUT)/rdvl.o $(OUTPUT)/vlset: vlset.c @@ -45,10 +48,10 @@ $(OUTPUT)/za-fork: za-fork.c $(OUTPUT)/za-fork-asm.o -include ../../../../include/nolibc/nolibc.h -I../..\ -static -ffreestanding -Wall $^ -o $@ $(OUTPUT)/za-ptrace: za-ptrace.c -$(OUTPUT)/za-test: za-test.S $(OUTPUT)/asm-utils.o +$(OUTPUT)/za-test: za-test.S $(ASM_UTILS) $(CC) -nostdlib $^ -o $@ $(OUTPUT)/zt-ptrace: zt-ptrace.c -$(OUTPUT)/zt-test: zt-test.S $(OUTPUT)/asm-utils.o +$(OUTPUT)/zt-test: zt-test.S $(ASM_UTILS) $(CC) -nostdlib $^ -o $@ include ../../lib.mk diff --git a/tools/testing/selftests/arm64/fp/asm-utils-linux.S b/tools/testing/selftests/arm64/fp/asm-utils-linux.S new file mode 100644 index 000000000000..e6c22b41dc5e --- /dev/null +++ b/tools/testing/selftests/arm64/fp/asm-utils-linux.S @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (C) 2015-2021 ARM Limited. +// Original author: Dave Martin <[email protected]> +// +// Utility functions for assembly code which use Linux syscalls. + +#include <asm/unistd.h> +#include "assembler.h" + +// Print a single character x0 to stdout +// Clobbers x0-x2,x8 +function putc + str x0, [sp, #-16]! + + mov x0, #1 // STDOUT_FILENO + mov x1, sp + mov x2, #1 + mov x8, #__NR_write + svc #0 + + add sp, sp, #16 + ret +endfunction +.globl putc + +// Print a NUL-terminated string starting at address x0 to stdout +// Clobbers x0-x3,x8 +function puts + mov x1, x0 + + mov x2, #0 +0: ldrb w3, [x0], #1 + cbz w3, 1f + add x2, x2, #1 + b 0b + +1: mov w0, #1 // STDOUT_FILENO + mov x8, #__NR_write + svc #0 + + ret +endfunction +.globl puts diff --git a/tools/testing/selftests/arm64/fp/asm-utils.S b/tools/testing/selftests/arm64/fp/asm-utils.S index 4b9728efc18d..6d43eb10e01f 100644 --- a/tools/testing/selftests/arm64/fp/asm-utils.S +++ b/tools/testing/selftests/arm64/fp/asm-utils.S @@ -4,44 +4,8 @@ // // Utility functions for assembly code. -#include <asm/unistd.h> #include "assembler.h" -// Print a single character x0 to stdout -// Clobbers x0-x2,x8 -function putc - str x0, [sp, #-16]! - - mov x0, #1 // STDOUT_FILENO - mov x1, sp - mov x2, #1 - mov x8, #__NR_write - svc #0 - - add sp, sp, #16 - ret -endfunction -.globl putc - -// Print a NUL-terminated string starting at address x0 to stdout -// Clobbers x0-x3,x8 -function puts - mov x1, x0 - - mov x2, #0 -0: ldrb w3, [x0], #1 - cbz w3, 1f - add x2, x2, #1 - b 0b - -1: mov w0, #1 // STDOUT_FILENO - mov x8, #__NR_write - svc #0 - - ret -endfunction -.globl puts - // Print an unsigned decimal number x0 to stdout // Clobbers x0-x4,x8 function putdec -- 2.47.3

