qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 21/26] Implement TCE translation for sPAPR V


From: Anthony Liguori
Subject: Re: [Qemu-devel] Re: [PATCH 21/26] Implement TCE translation for sPAPR VIO
Date: Wed, 16 Mar 2011 15:21:31 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8

On 03/16/2011 03:05 PM, Benjamin Herrenschmidt wrote:
On Wed, 2011-03-16 at 17:03 +0100, Alexander Graf wrote:
+int spapr_tce_dma_zero(VIOsPAPRDevice *dev, uint64_t taddr,
uint32_t size)
+{
+    uint8_t *zeroes;
+
+#ifdef DEBUG_TCE
+    fprintf(stderr, "spapr_tce_dma_zero taddr=0x%llx size=0x%x\n",
+            (unsigned long long)taddr, size);
+#endif
+
+    /* FIXME: do this better... */
+    zeroes = alloca(size);
+    memset(zeroes, 0, size);
You sure that zeroes is still alive during the call? If I were a
compiler, I'd probably optimize the return away so that it'd end up
being a simple branch to spapr_tce_dma_write - coincidentally
invalidating the stack that zeroes is on.
Ugh ? How would this ever be legal for a compiler to do that ?

Yeah, the compiler can't do that. The return of alloca() is valid as long as the stack frame is valid. Inlining doesn't change that.
Regards,

Anthony Liguori

Ben.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]