Thread (26 messages) flat view 26 messages, 5 authors, 2021-08-12

Re: [PATCH v2 5/9] powerpc/microwatt: Use standard 16550 UART for console

From: Segher Boessenkool <hidden>
Date: 2021-08-12 16:11:31

On Thu, Aug 12, 2021 at 03:14:44PM +0200, Christophe Leroy wrote:
Le 18/06/2021 à 05:46, Paul Mackerras a écrit :
quoted
+static u8 udbg_uart_in_isa300_rm(unsigned int reg)
+{
+	uint64_t msr = mfmsr();
+	uint8_t  c;
+
+	mtmsr(msr & ~(MSR_EE|MSR_DR));
+	isync();
+	eieio();
+	c = __raw_rm_readb(UDBG_UART_MW_ADDR + (reg << 2));
+	mtmsr(msr);
+	isync();
+	return c;
+}
How do you make sure that GCC won't emit any access to the stack between 
the two mtmsr() ?
The mtmsr are asm with a memory clobber so nothing will be moved between
these, and it is very unlikely anything will sprout up here out of
nothing.  But yes, this whole thing should be written as real asm (or as
one huge inline asm, but ugh).


Segher
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help