Hi,
At the char string array declaration as suggested above, the program crashes. The disassembly shows that the processor is trying to work through TOC and proceed to copy value from string array one-by-one into the memory and retain it back. And in the process, when R9 gets zero address value it crashes. We have setup TOC per instruction as mentioned below however I would like to know your opinion. If you can provide your inputs on the same, it would be helpful. The stack creation is done correctly and so is TOC declaration, prior to branching to MAIN.. PFA the TOC assembly code used by us: toc_Initialization:
//base_toc => TOC address
lis gpr2, (base_toc)@highest
ori gpr2, gpr2, (base_toc)@higher
rldicr gpr2, gpr2, 32, 31
oris gpr2, gpr2, (base_toc)@h
ori gpr2, gpr2, (base_toc)@l
addi gpr2, gpr2, 0x4000
addi gpr2, gpr2, 0x4000
R2 Register is the dedicated register for TOC as per IBM instructions given in (https://www.ibm.com/docs/en/aix/7.1?topic=overview-register-usage-conventions)).
TOC details are in: https://www.ibm.com/docs/en/aix/7.2?topic=program-understanding-programming-toc
Regards,
Christina