EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: C strict aliasing rules
From: Kay-Uwe Kasemir <[email protected]>
To: Core talk list <[email protected]>
Date: Tue, 28 Nov 2006 09:33:40 -0500
Hi:

Do I understand correctly that the most likely impact for EPICS might be this type of code:

struct xyz_regs
{
    Word control;
    Word status;
    ...
}

void xyz_operate(char *vme_base)
{
    struct xyz_regs *xyz = (struct xyz_regs *) vme_base;

    xyz->control = 0x1234;
    if (xyz->status & 0x8000)
      ....
}

The mapping of C structures to hardware registers?
In that case, the compiler optimization of aliased pointers
isn't the only problem. There's also the structure padding,
memory alignment, and byte order that causes portability issues.

Isn't that best handled by performing register access
via routines like the vxWorks sysInByte(), sysInWord(), sysInLong(), sysPciInLong(), ... ?

-Kay

Replies:
Re: C strict aliasing rules Eric Norum
Re: C strict aliasing rules Marty Kraimer
References:
C strict aliasing rules Eric Norum
Re: C strict aliasing rules Benjamin Franksen
Re: C strict aliasing rules Eric Norum
Re: C strict aliasing rules Benjamin Franksen

Navigate by Date:
Prev: Re: C strict aliasing rules Benjamin Franksen
Next: Re: C strict aliasing rules Eric Norum
Index: 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: C strict aliasing rules Benjamin Franksen
Next: Re: C strict aliasing rules Eric Norum
Index: 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·