From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sat, 3 Nov 2012 09:32:34 +0100 Subject: [U-Boot] [PATCH 01/10] arm: Compile cache_disable() with -O2 to avoid failure In-Reply-To: <1351813330-23741-1-git-send-email-sjg@chromium.org> References: <1351813330-23741-1-git-send-email-sjg@chromium.org> Message-ID: <201211030932.34943.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Simon Glass, > It is good to have these functions written in C instead of assembler, > but with -O0 the cache_disable() function doesn't return. Rather than > revert to assembler, this fix just forces this to be built with -O2. > > Signed-off-by: Simon Glass > --- > arch/arm/lib/cache-cp15.c | 10 ++++++++++ > 1 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c > index 939de10..8f8385d 100644 > --- a/arch/arm/lib/cache-cp15.c > +++ b/arch/arm/lib/cache-cp15.c > @@ -110,6 +110,16 @@ static void cache_enable(uint32_t cache_bit) > set_cr(reg | cache_bit); > } > > +/* > + * Big hack warning! > + * > + * Devs like to compile with -O0 to get a nice debugging illusion. But > this + * function does not survive that since -O0 causes the compiler to > read the + * PC back from the stack after the dcache flush. Might it be > possible to fix + * this by flushing the write buffer? > + */ > +static void cache_disable(uint32_t cache_bit) __attribute__ > ((optimize(2))); + > /* cache_bit must be either CR_I or CR_C */ > static void cache_disable(uint32_t cache_bit) > { Uh, are you sure this is right ? Best regards, Marek Vasut