Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe2a1bb1 authored by Michael Ellerman's avatar Michael Ellerman
Browse files

selftests/powerpc: Add test of load_unaligned_zero_pad()



It is a rarely exercised case, so we want to have a test to ensure it
works as required.

Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent de5946c0
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -116,6 +116,15 @@ static inline unsigned long prep_zero_mask(unsigned long a, unsigned long bits,

#endif

/*
 * We use load_unaligned_zero() in a selftest, which builds a userspace
 * program. Some linker scripts seem to discard the .fixup section, so allow
 * the test code to use a different section name.
 */
#ifndef FIXUP_SECTION
#define FIXUP_SECTION ".fixup"
#endif

static inline unsigned long load_unaligned_zeropad(const void *addr)
{
	unsigned long ret, offset, tmp;
@@ -123,7 +132,7 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
	asm(
	"1:	" PPC_LL "%[ret], 0(%[addr])\n"
	"2:\n"
	".section .fixup,\"ax\"\n"
	".section " FIXUP_SECTION ",\"ax\"\n"
	"3:	"
#ifdef __powerpc64__
	"clrrdi		%[tmp], %[addr], 3\n\t"
@@ -156,4 +165,6 @@ static inline unsigned long load_unaligned_zeropad(const void *addr)
	return ret;
}

#undef FIXUP_SECTION

#endif /* _ASM_WORD_AT_A_TIME_H */
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ CFLAGS := -Wall -O2 -flto -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CUR

export CC CFLAGS

TARGETS = pmu copyloops mm tm
TARGETS = pmu copyloops mm tm primitives

endif

+17 −0
Original line number Diff line number Diff line
CFLAGS += -I$(CURDIR)

PROGS := load_unaligned_zeropad

all: $(PROGS)

$(PROGS): ../harness.c

run_tests: all
	@-for PROG in $(PROGS); do \
		./$$PROG; \
	done;

clean:
	rm -f $(PROGS) *.o

.PHONY: all run_tests clean
+1 −0
Original line number Diff line number Diff line
../.././../../../../arch/powerpc/include/asm/asm-compat.h
 No newline at end of file
+0 −0

Empty file added.

Loading