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

Commit 2a353506 authored by Andreas Schwab's avatar Andreas Schwab Committed by Geert Uytterhoeven
Browse files

m68k: Fix assembler constraint to prevent overeager gcc optimisation



Passing the address of a variable as an operand to an asm statement
doesn't mark the value of this variable as used, so gcc may optimize its
initialisation away.  Fix this by using the "m" constraint instead.

Signed-off-by: default avatarAndreas Schwab <schwab@linux-m68k.org>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@vger.kernel.org
parent c808d3d8
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -414,9 +414,9 @@ void __init config_atari(void)
					 * FDC val = 4 -> Supervisor only */
					 * FDC val = 4 -> Supervisor only */
		asm volatile ("\n"
		asm volatile ("\n"
			"	.chip	68030\n"
			"	.chip	68030\n"
			"	pmove	%0@,%/tt1\n"
			"	pmove	%0,%/tt1\n"
			"	.chip	68k"
			"	.chip	68k"
			: : "a" (&tt1_val));
			: : "m" (tt1_val));
	} else {
	} else {
	        asm volatile ("\n"
	        asm volatile ("\n"
			"	.chip	68040\n"
			"	.chip	68040\n"
@@ -569,10 +569,10 @@ static void atari_reset(void)
			: "d0");
			: "d0");
	} else
	} else
		asm volatile ("\n"
		asm volatile ("\n"
			"	pmove	%0@,%%tc\n"
			"	pmove	%0,%%tc\n"
			"	jmp	%1@"
			"	jmp	%1@"
			: /* no outputs */
			: /* no outputs */
			: "a" (&tc_val), "a" (reset_addr));
			: "m" (tc_val), "a" (reset_addr));
}
}




+2 −2
Original line number Original line Diff line number Diff line
@@ -189,8 +189,8 @@ void flush_thread(void)
	current->thread.fs = __USER_DS;
	current->thread.fs = __USER_DS;
	if (!FPU_IS_EMU)
	if (!FPU_IS_EMU)
		asm volatile (".chip 68k/68881\n\t"
		asm volatile (".chip 68k/68881\n\t"
			      "frestore %0@\n\t"
			      "frestore %0\n\t"
			      ".chip 68k" : : "a" (&zero));
			      ".chip 68k" : : "m" (zero));
}
}


/*
/*
+2 −2
Original line number Original line Diff line number Diff line
@@ -163,8 +163,8 @@ void flush_thread(void)
#ifdef CONFIG_FPU
#ifdef CONFIG_FPU
	if (!FPU_IS_EMU)
	if (!FPU_IS_EMU)
		asm volatile (".chip 68k/68881\n\t"
		asm volatile (".chip 68k/68881\n\t"
			      "frestore %0@\n\t"
			      "frestore %0\n\t"
			      ".chip 68k" : : "a" (&zero));
			      ".chip 68k" : : "m" (zero));
#endif
#endif
}
}


+17 −19
Original line number Original line Diff line number Diff line
@@ -552,13 +552,13 @@ static inline void bus_error030 (struct frame *fp)


#ifdef DEBUG
#ifdef DEBUG
		asm volatile ("ptestr %3,%2@,#7,%0\n\t"
		asm volatile ("ptestr %3,%2@,#7,%0\n\t"
			      "pmove %%psr,%1@"
			      "pmove %%psr,%1"
			      : "=a&" (desc)
			      : "=a&" (desc), "=m" (temp)
			      : "a" (&temp), "a" (addr), "d" (ssw));
			      : "a" (addr), "d" (ssw));
#else
#else
		asm volatile ("ptestr %2,%1@,#7\n\t"
		asm volatile ("ptestr %2,%1@,#7\n\t"
			      "pmove %%psr,%0@"
			      "pmove %%psr,%0"
			      : : "a" (&temp), "a" (addr), "d" (ssw));
			      : "=m" (temp) : "a" (addr), "d" (ssw));
#endif
#endif
		mmusr = temp;
		mmusr = temp;


@@ -605,20 +605,18 @@ static inline void bus_error030 (struct frame *fp)
			       !(ssw & RW) ? "write" : "read", addr,
			       !(ssw & RW) ? "write" : "read", addr,
			       fp->ptregs.pc, ssw);
			       fp->ptregs.pc, ssw);
			asm volatile ("ptestr #1,%1@,#0\n\t"
			asm volatile ("ptestr #1,%1@,#0\n\t"
				      "pmove %%psr,%0@"
				      "pmove %%psr,%0"
				      : /* no outputs */
				      : "=m" (temp)
				      : "a" (&temp), "a" (addr));
				      : "a" (addr));
			mmusr = temp;
			mmusr = temp;


			printk ("level 0 mmusr is %#x\n", mmusr);
			printk ("level 0 mmusr is %#x\n", mmusr);
#if 0
#if 0
			asm volatile ("pmove %%tt0,%0@"
			asm volatile ("pmove %%tt0,%0"
				      : /* no outputs */
				      : "=m" (tlong));
				      : "a" (&tlong));
			printk("tt0 is %#lx, ", tlong);
			printk("tt0 is %#lx, ", tlong);
			asm volatile ("pmove %%tt1,%0@"
			asm volatile ("pmove %%tt1,%0"
				      : /* no outputs */
				      : "=m" (tlong));
				      : "a" (&tlong));
			printk("tt1 is %#lx\n", tlong);
			printk("tt1 is %#lx\n", tlong);
#endif
#endif
#ifdef DEBUG
#ifdef DEBUG
@@ -668,13 +666,13 @@ static inline void bus_error030 (struct frame *fp)


#ifdef DEBUG
#ifdef DEBUG
	asm volatile ("ptestr #1,%2@,#7,%0\n\t"
	asm volatile ("ptestr #1,%2@,#7,%0\n\t"
		      "pmove %%psr,%1@"
		      "pmove %%psr,%1"
		      : "=a&" (desc)
		      : "=a&" (desc), "=m" (temp)
		      : "a" (&temp), "a" (addr));
		      : "a" (addr));
#else
#else
	asm volatile ("ptestr #1,%1@,#7\n\t"
	asm volatile ("ptestr #1,%1@,#7\n\t"
		      "pmove %%psr,%0@"
		      "pmove %%psr,%0"
		      : : "a" (&temp), "a" (addr));
		      : "=m" (temp) : "a" (addr));
#endif
#endif
	mmusr = temp;
	mmusr = temp;


+3 −3
Original line number Original line Diff line number Diff line
@@ -52,9 +52,9 @@ static unsigned long virt_to_phys_slow(unsigned long vaddr)
		unsigned long *descaddr;
		unsigned long *descaddr;


		asm volatile ("ptestr %3,%2@,#7,%0\n\t"
		asm volatile ("ptestr %3,%2@,#7,%0\n\t"
			      "pmove %%psr,%1@"
			      "pmove %%psr,%1"
			      : "=a&" (descaddr)
			      : "=a&" (descaddr), "=m" (mmusr)
			      : "a" (&mmusr), "a" (vaddr), "d" (get_fs().seg));
			      : "a" (vaddr), "d" (get_fs().seg));
		if (mmusr & (MMU_I|MMU_B|MMU_L))
		if (mmusr & (MMU_I|MMU_B|MMU_L))
			return 0;
			return 0;
		descaddr = phys_to_virt((unsigned long)descaddr);
		descaddr = phys_to_virt((unsigned long)descaddr);