jump instruction in delay slot
Hi,
the following code snippet is from arch/mips/pmc-sierra/yosemite/irq-handler.S:
ll_duart_irq:
li a0, 4 move a1, sp jal do_IRQ j ret_from_irq
I wonder if this is correct. AFAIK, a jump instruction must not occupy the delay slot of another branch or jump instruction. Since the 'jal' returns to the first instruction after the delay slot, I would expect the effect of the 'j' instruction to be cancelled. Or is this some kind of trick I do not understand?
tk
Signature · 9 lines
-------------------------------------------------- Thomas Koeller, Software Development Basler Vision Technologies thomas dot koeller at baslerweb dot com http://www.baslerweb.com ==============================
Quoted 11 lines · Thomas Koeller
Hi,
the following code snippet is from
arch/mips/pmc-sierra/yosemite/irq-handler.S:
ll_duart_irq:li a0, 4 move a1, sp jal do_IRQ j ret_from_irq
Quoted 6 lines
I wonder if this is correct. AFAIK, a jump instruction must not occupy the delay slot of another branch or jump instruction. Since the 'jal' returns to the first instruction after the delay slot, I would expect the effect of the 'j' instruction to be cancelled. Or is this some kind of trick I do not understand?
I guess this code has no preceeding ".set noreorder" directive. By default, your friendly assembler handles delay slots for you. :-)
Thiemo
Quoted 9 lines · Kevin D. Kissell
By default, a MIPS assembler will automatically fill delay slots and even move instructions around to fill them. This can be inhibited by the
set .noreorder
directive, of which you'll note there is one in the top leveltital_handle_introutine, but there's a
set .reorder
at the end of that routine, so by the time it gets to the code you're interested in, things should be OK.
I see. I really wonder if there is any up-to-date documentation covering the mips-specific features of gas. Have been googling for it, no success so far.
thanks,
Thomas
Signature · 16 lines
-------------------------------------------------- Thomas Koeller, Software Development Basler Vision Technologies An der Strusbek 60-62 22926 Ahrensburg Germany Tel +49 (4102) 463-390 Fax +49 (4102) 463-46390 mailto:[email protected] http://www.baslerweb.com ==============================
Quoted 2 lines · Thomas Koeller
jal
do_IRQ
jret_from_irq
Beyond what Thiemo has said correctly ... in the cases where I've tried to debug code where a jmp or branch instruction was being executed in the delay slot of another jump or branch instruction the CPU does *really* unexpected things.
Ralf