0
$\begingroup$

question

answer

memory

The above is the example from section 2.12 Translating and Starting a Program from Computer Organization and Design, Fifth Edition, The Hardware/Software Interface, by David A. Patterson and John L. Hennessy.

Anyway, my questions are as follows:

1) Why does the jal 0 instruction in Procedure A at address 4 of the text segment get interpreted by the linker as pointing to Address 0 of Procedure B? I understand that jal x means set $ra = PC+4 and jump to x... Well, shouldn't jal 0 mean jump to address 0 in the ROM of the current procedure, i.e. to the address of the first instruction of procedure A?

2) Why does the jal 0 instruction in Procedure B at address 4 of the text segment get interpreted by the linker as pointing to Address 0 of Procedure A? Same confusion as in 1).

Anyway, I hope this is intelligible.

Thank you for your time!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.