Re: arm-elf-gcc : change default data alignement depending on ARM/THUMB

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

 



On Thu, Aug 21, 2003 at 09:48:47AM -0500, Bill Gatliff
wrote:
> As you've seen, structure implementations can change in
> response to changes in compiler settings and versions---
> but the hardware doesn't!

Hey. Get your hardware developer to make hardware that can
read the software's mind as it should. :-)

> Oh, and I left the "volatile" keyword out of all of the above, but you 
> absolutely, positively need it as well when you're touching hardware.  

Linus Torvalds said somewhere he didn't like volatile
because it never did what people expected. Linux people
usually use a macro as follows:

#define barrier()   __asm__ __volatile__("": : :"memory")

which invalidates all assumption on memory: it forces things
to be pushed to the hardware.

E.g:

    int i;
    i = 0;
    i = 5;

will typically compile as one memory set (and if i is used
a few lines later, no memory access at all), whereas:

    int i;
    i = 0;
    barrier();
    i = 5;

will perform garantee a write instruction will be issued
(then you hope someone switched off the cache, but that's
another story entirely).

/Y

-- 
This signature left empty.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux