Skip to contentSkip to conversation

jump instruction in delay slot

DISCUSSION Thomas Koeller 3 participants 4 messages Oct 19, 2004 1 message not in the archive MIPS

lore
Share & tools
lore
#0 lore raw

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

==============================
#1 lore raw
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

A message that is not in the archive (sent off-list or not yet received): 000901c4b5e8$70141160$10eca8c0@grendel

#3 lore raw
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 level tital_handle_int routine, 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

==============================
#4 lore raw
In reply to Thomas Koeller
Quoted 2 lines · Thomas Koeller

jal do_IRQ
j ret_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