Posted: Sun Jul 17, 2005 5:58 pm Post subject: Protection Exception in assembler
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..
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.
Joined: 10 Dec 2004 Posts: 110 Topics: 8 Location: Colorado USA
Posted: Wed Jul 20, 2005 9:06 am Post subject:
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.
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.
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.
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