Commit d8e7f201 authored by WANG Xuerui's avatar WANG Xuerui Committed by Huacai Chen
Browse files

LoongArch: Use ABI names of registers where appropriate



Some of the assembly in the LoongArch port seem to come from a
prehistoric time, when the assembler didn't even have support for the
ABI names we all come to know and love, thus used raw register numbers
which hampered readability.

The usages are found with a regex match inside arch/loongarch, then
manually adjusted for those non-definitions.

Signed-off-by: default avatarWANG Xuerui <git@xen0n.name>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent e0dccc3b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -48,9 +48,9 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
	__asm__ __volatile__(
		"sltu	%0, %1, %2\n\t"
#if (__SIZEOF_LONG__ == 4)
		"sub.w	%0, $r0, %0\n\t"
		"sub.w	%0, $zero, %0\n\t"
#elif (__SIZEOF_LONG__ == 8)
		"sub.d	%0, $r0, %0\n\t"
		"sub.d	%0, $zero, %0\n\t"
#endif
		: "=r" (mask)
		: "r" (index), "r" (size)
+2 −2
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ static inline void xconf_writel(u32 val, volatile void __iomem *addr)
{
	asm volatile (
	"	st.w	%[v], %[hw], 0	\n"
	"	ld.b	$r0, %[hw], 0	\n"
	"	ld.b	$zero, %[hw], 0	\n"
	:
	: [hw] "r" (addr), [v] "r" (val)
	);
@@ -68,7 +68,7 @@ static inline void xconf_writeq(u64 val64, volatile void __iomem *addr)
{
	asm volatile (
	"	st.d	%[v], %[hw], 0	\n"
	"	ld.b	$r0, %[hw], 0	\n"
	"	ld.b	$zero, %[hw], 0	\n"
	:
	: [hw] "r" (addr),  [v] "r" (val64)
	);
+6 −6
Original line number Diff line number Diff line
@@ -23,13 +23,13 @@
static __always_inline void prepare_frametrace(struct pt_regs *regs)
{
	__asm__ __volatile__(
		/* Save $r1 */
		/* Save $ra */
		STORE_ONE_REG(1)
		/* Use $r1 to save PC */
		"pcaddi	$r1, 0\n\t"
		STR_LONG_S " $r1, %0\n\t"
		/* Restore $r1 */
		STR_LONG_L " $r1, %1, "STR_LONGSIZE"\n\t"
		/* Use $ra to save PC */
		"pcaddi	$ra, 0\n\t"
		STR_LONG_S " $ra, %0\n\t"
		/* Restore $ra */
		STR_LONG_L " $ra, %1, "STR_LONGSIZE"\n\t"
		STORE_ONE_REG(2)
		STORE_ONE_REG(3)
		STORE_ONE_REG(4)
+2 −2
Original line number Diff line number Diff line
@@ -44,14 +44,14 @@ struct thread_info {
}

/* How to get the thread information struct from C. */
register struct thread_info *__current_thread_info __asm__("$r2");
register struct thread_info *__current_thread_info __asm__("$tp");

static inline struct thread_info *current_thread_info(void)
{
	return __current_thread_info;
}

register unsigned long current_stack_pointer __asm__("$r3");
register unsigned long current_stack_pointer __asm__("$sp");

#endif /* !__ASSEMBLY__ */

+1 −1
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ do { \
	"2:							\n"	\
	"	.section .fixup,\"ax\"				\n"	\
	"3:	li.w	%0, %3					\n"	\
	"	or	%1, $r0, $r0				\n"	\
	"	or	%1, $zero, $zero			\n"	\
	"	b	2b					\n"	\
	"	.previous					\n"	\
	"	.section __ex_table,\"a\"			\n"	\
Loading