View previous topic :: View next topic |
Author |
Message |
rnanavaty Beginner
Joined: 12 Apr 2006 Posts: 29 Topics: 20
|
Posted: Mon Nov 02, 2009 4:19 am Post subject: Assembler: Different alignments |
|
|
Hi,
What is the difference between different type of alignments like:
MYEPPR CNOP 0,2 Halfword alignment.
NEWPARA CNOP 0,4 Fullword alignment.
MN01EP CNOP 0,8 EP on doubleword boundary.
2) What is the use of those alignments and when to usewhich one? |
|
Back to top |
|
 |
RonB Beginner
Joined: 02 Dec 2002 Posts: 93 Topics: 0 Location: Orlando, FL
|
Posted: Mon Nov 02, 2009 7:52 am Post subject: |
|
|
1) The answer to your first question is obvious from the comments following each instruction.
2) Each is used to force "slack" bytes, as needed, and if required, in order to set the current address pointer to the requested boundary alignment. This is useful, for example, when you wish to "simulate" an exec parm when passing parameters to another program ( where the requirement is that the LENGTH of the parm is contained in a halfword aligned on a halfword boundary ) _________________ A computer once beat me at chess, but it was no match for me at kick boxing. |
|
Back to top |
|
 |
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Mon Nov 02, 2009 8:50 am Post subject: |
|
|
2) many assembler instructions require that one or all operands be on a boundary.
the assembler manual will indicate for each instruction the constraints. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Mon Nov 02, 2009 3:36 pm Post subject: |
|
|
also, the executable assembler instructions themselves must be on a half word boundary, so a CNOP (which is a 0700 or branch register 0, or do nothing) can be used in cases where inline data is being branched around. as Ron said. The effect outside of executable code is basically the same as a DS 0H, DS 0F, or DS 0D if I remember right (there may be different idiosyncrasies with each idiom, like where labels point and what gets placed in the generated object code). _________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html. |
|
Back to top |
|
 |
DaveyC Moderator

Joined: 02 Dec 2002 Posts: 151 Topics: 3 Location: Perth, Western Australia
|
Posted: Tue Dec 22, 2009 8:20 am Post subject: |
|
|
Not to mention consistency. If you write mutli-tasking programs aligning data on integral boundaries ensures consistency across multiple CPUs. This is called a sequential memory model. Other hardware, such as AIX Power6 has a weakly defined architecture which requires memory barriers to ensure correct consistency or even stronger barriers such as mutexes. It's also a good idea to align data to make it easier to read in a dump. _________________ Dave Crayford |
|
Back to top |
|
 |
|
|