MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Protection Exception in assembler

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
nihilist76
Beginner


Joined: 17 Jul 2005
Posts: 3
Topics: 2

PostPosted: Sun Jul 17, 2005 5:58 pm    Post subject: Protection Exception in assembler Reply with quote

Hi,
i have an urgent problem that i have to solve. Please help me.

i have an assembler program which i added more than 1000 lines, and it consists 8000 lines now. It generally works good, but for a specific input type for which the program enters some additional path, it abends. I'm almost sure it's because of the size of the program.

When i first met the problem, the program was abending somewhere in Label2 (L2) by giving Protection Exception.

L1
..
L2
..
L3
..


I copied L2 (BAICPGM) competely into a new procedure. It now passes the point where previously it was abending, but now the first Branch command (B, BE, BNE.. and etc) in L3, makes the program go somewhere in program totally nonsense, instead of the label it has to branch. Registers stay the same before and after the BALR. What else can i do?? Is it an addressing problem, doesnt the program fit into memory properly?

L1
..
L SUBASE,ABAICPGM
BALR GR6,SUBASE
..
L3


I know it's a long and difficult question, but i have no idea about how to solve it. Thanx for your help..
Back to top
View user's profile Send private message
anettis
Beginner


Joined: 08 Nov 2004
Posts: 15
Topics: 5

PostPosted: Tue Jul 19, 2005 4:16 pm    Post subject: Reply with quote

Without a good understanding of base/displacement addressing it is almost impossible to code in z/Architecture assembly language because so much depends on it.

Now with that being said you may have exceeded the 4095 byte limit for base/displacement addressing, although I believe this would have generated an assembly time error. My guess is that somewhere along the line you corrupted a base register.
Back to top
View user's profile Send private message
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Wed Jul 20, 2005 9:06 am    Post subject: Reply with quote

Based upon the code that you have given, I am going to assume that GR6 is Register 6, and that SUBASE is perhaps register 15. If this is true, then the question becomes how are you "returning" from this routine. Your BALR as you probably know is going to set GR6 to contain the address of the next instruction. If this is an external call to another CSECT, this would not be following normal convention since R14 should be the the register set up for this purpose.

Regardless of whether this is a CALL or not, you still have to deal with the prospect of addressing, and the name "SUBASE" seems to imply that you are going to use that register for a base register.

You are going to need to determine the instruction that is abending, and then look at what register is being used in that instruction. As Anettis said, you probably have a problem with that value. The register used in this instruction is going to be dependent upon what "USING" is in effect at the time the assembler generates the machine code. Look closely at the instruction (do you know how to disect the object code?) This will tell you which register is being used. Chances are you need to code a DROP/USING so that the branch will use the proper base register.

If you could post a bit more of your code, that would be helpful. I think we need to see the entry logic into the subroutine, and if possible the instructions leading up to the abend. If you could post the pieces of the actual listing and not just the source, that would really help.

DTF
________
Honda CB250RS history


Last edited by dtf on Tue Feb 01, 2011 1:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
dinesh_mf
Beginner


Joined: 05 Aug 2005
Posts: 1
Topics: 0
Location: India, pune

PostPosted: Fri Aug 05, 2005 10:24 am    Post subject: Reply with quote

I think it should be BAL and not BALR ...

BAL GR6,SUBASE

and one more thing..

ABAICPGM should contain the address of the entry point..
_________________
Cheers,
...And miles to go before I sleep.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
anettis
Beginner


Joined: 08 Nov 2004
Posts: 15
Topics: 5

PostPosted: Fri Aug 05, 2005 10:45 am    Post subject: Reply with quote

I am pretty sure SUBASE is an equate that represents a register. . . .so use of BAL would likely crash and burn with an operation or protection exception.

Very Happy
Back to top
View user's profile Send private message
nihilist76
Beginner


Joined: 17 Jul 2005
Posts: 3
Topics: 2

PostPosted: Tue Aug 16, 2005 5:47 am    Post subject: Reply with quote

thank u all for your attention..

i solved my problem. i forgot to write the code below, u were right, both were regs.
SUBASE EQU 5
GR6 EQU 6

my solution was quite simple: just saved my regs 5 and 6 into a save area, and restored them after branch. I couldn't understand why it had to be like that, but it worked.

ST SUBASE,SAVELOC1
ST GR6,SAVELOC2

L SUBASE,ABAICPGM
BALR GR6,SUBASE

L SUBASE,SAVELOC1
L GR6,SAVELOC2


Thanks again..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group