Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly 370 > Re: Assembler: ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 13 Topic 248 of 328
Post > Topic >>

Re: Assembler: alignment of machine instructions

by "Michel Castelein" <arcis@[EMAIL PROTECTED] > Jul 26, 2005 at 08:25 AM

"glen herrmannsfeldt" <gah@[EMAIL PROTECTED]
> wrote in message 
news:K6adncbiMeI98njfRVn-pA@[EMAIL PROTECTED]
> Michel Castelein wrote:
>> A DC or DS instruction with a zero duplication factor forces boundary 
>> alignment, even when the NOALIGN assembler option is in effect.
>> At the other hand, IMHO, the assembler always aligns machine
instructions 
>> on a halfword boundary.
>> So, I'm wondering why the expansion of the SAVE macro begins with a DS 
>> 0H.
>> That's redundant, isn't it?
>> Or are there some historical reasons? If yes, which ones?
>> The first one to provide me with the correct information will receive a

>> copy of my new assembler course.
> I believe my first posted answer is correct, and the later one includes 
> source from the OS/360 SAVE macro to help verify it.
> Is the offer still active?
> -- glen

I found the answer to my question.
It was actually a "psychological problem".

One assumes the SAVE macro, if used, to be always coded at the very 
beginning of a program source.
But what happens if the program starts with an eye catcher (i.e. data)!?!

Case 1:
MYPGM    CSECT
         DC    'some eye catcher'
XXX      STM   R14,R12,12(R13)
         ...
         YREGS
         END   XXX
Whether the eye catcher consists of an even or odd number of bytes,
doesn't 
matter.
The assembler automatically aligns machine instructions on 2-byte 
boundaries, so XXX is always a valid entry point.

Case 2:
MYPGM    CSECT
         B     XXX  (branch around eye catcher)
         DC    'some eye catcher'
XXX      EQU   *
         STM   R14,R12,12(R13)
         ...
         YREGS
         END
If the eye catcher consists of an odd number of bytes, boundary alignment 
will cause the assembler to insert one zero byte immediately AFTER XXX
(i.e. 
between XXX and the STM instruction).
So, in that case, XXX is NOT aligned on a halfword boundary and can 
therefore not be used as branch address!
In MVS-OS/390-z/OS, a specification exception yields a S0C6 ABEND.

Case 3:
MYPGM    CSECT
         B     XXX  (branch around eye catcher)
         DC    'some eye catcher'
XXX      DS    0H
         STM   R14,R12,12(R13)
         ...
         YREGS
         END
Now, boundary alignment may cause one zero byte to be inserted immediately

BEFORE XXX.
XXX will always represent an even address.
So this code is O.K.

Conclusion:
DS 0H is not used to align machine instructions (because that is done 
systematically), it is used to align branch addresses.

Anyhow, since you were that kind to reply, you're the one who will get a 
copy of my new assembler course.
A little bit patience, it isn't completed yet.

Kind regards,

Michel

--------------------------------------------------
Michel Castelein - Arcis Services
MVS-OS/390-z/OS system engineer & instructor
arcisATadvalvasDOTbe
http://www.geocities.com/michelcastelein/
 




 13 Posts in Topic:
Assembler: alignment of machine instructions
"Michel Castelein&qu  2005-07-13 23:13:45 
Re: Assembler: alignment of machine instructions
richgr@[EMAIL PROTECTED]   2005-07-13 21:37:48 
Re: Assembler: alignment of machine instructions
Binyamin Dissen <posti  2005-07-14 11:26:02 
Re: Assembler: alignment of machine instructions
"arargh" arargh  2005-07-13 18:00:03 
Re: Assembler: alignment of machine instructions
glen herrmannsfeldt <g  2005-07-13 21:27:03 
Re: Assembler: alignment of machine instructions
glen herrmannsfeldt <g  2005-07-19 13:43:28 
Re: Assembler: alignment of machine instructions
Binyamin Dissen <posti  2005-07-14 11:26:04 
Re: Assembler: alignment of machine instructions
"John Small" &l  2005-07-14 10:50:59 
Re: Assembler: alignment of machine instructions
glen herrmannsfeldt <g  2005-07-25 16:03:55 
Re: Assembler: alignment of machine instructions
"Michel Castelein&qu  2005-07-26 08:25:21 
Re: Assembler: alignment of machine instructions
"Sven Pran" <  2005-07-27 09:45:31 
Re: Assembler: alignment of machine instructions
beu@[EMAIL PROTECTED] (B  2005-07-27 20:50:58 
Re: Assembler: alignment of machine instructions
"Sven Pran" <  2005-07-28 00:11:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 15:15:32 CDT 2008.