Linux MIPS Architecture development
 help / color / mirror / Atom feed
* jump instruction in delay slot
@ 2004-10-19 14:05 Thomas Koeller
  2004-10-19 14:25 ` Thiemo Seufer
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thomas Koeller @ 2004-10-19 14:05 UTC (permalink / raw)
  To: Linux/MIPS Development; +Cc: Manish Lachwani

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

-- 
--------------------------------------------------

Thomas Koeller, Software Development
Basler Vision Technologies

thomas dot koeller at baslerweb dot com
http://www.baslerweb.com

==============================

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: jump instruction in delay slot
  2004-10-19 14:05 jump instruction in delay slot Thomas Koeller
@ 2004-10-19 14:25 ` Thiemo Seufer
       [not found] ` <000901c4b5e8$70141160$10eca8c0@grendel>
  2004-10-19 17:06 ` Ralf Baechle
  2 siblings, 0 replies; 6+ messages in thread
From: Thiemo Seufer @ 2004-10-19 14:25 UTC (permalink / raw)
  To: Thomas Koeller; +Cc: Linux/MIPS Development, Manish Lachwani

Thomas Koeller wrote:
> 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?

I guess this code has no preceeding ".set noreorder" directive.
By default, your friendly assembler handles delay slots for you. :-)


Thiemo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: jump instruction in delay slot
       [not found] ` <000901c4b5e8$70141160$10eca8c0@grendel>
@ 2004-10-19 15:48   ` Thomas Koeller
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Koeller @ 2004-10-19 15:48 UTC (permalink / raw)
  To: linux-mips; +Cc: Kevin D. Kissell

On Tuesday 19 October 2004 16:32, Kevin D. Kissell wrote:

> 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
-- 
--------------------------------------------------

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:thomas.koeller@baslerweb.com
http://www.baslerweb.com

==============================

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: jump instruction in delay slot
       [not found] <B482D8AA59BF244F99AFE7520D74BF961A5B71@server1.RightHand.righthandtech.com>
@ 2004-10-19 17:00 ` Thomas Koeller
  2004-10-19 17:02   ` Ralf Baechle
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Koeller @ 2004-10-19 17:00 UTC (permalink / raw)
  To: linux-mips; +Cc: Andrew Dyer

On Tuesday 19 October 2004 18:00, Andrew Dyer wrote:

> Also, idt has a good book online in pdf called
> IDT MIPS Microprocessor Family
> Software Reference Manual
>
> it has a good section on assembly collecting info
> from a lot of places.

That was a good hint, thanks a lot!

Thomas
-- 
--------------------------------------------------

Thomas Koeller, Software Development
Basler Vision Technologies

thomas dot koeller at baslerweb dot com
http://www.baslerweb.com

==============================

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: jump instruction in delay slot
  2004-10-19 17:00 ` Thomas Koeller
@ 2004-10-19 17:02   ` Ralf Baechle
  0 siblings, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2004-10-19 17:02 UTC (permalink / raw)
  To: Thomas Koeller; +Cc: linux-mips, Andrew Dyer

On Tue, Oct 19, 2004 at 07:00:02PM +0200, Thomas Koeller wrote:

> > Also, idt has a good book online in pdf called
> > IDT MIPS Microprocessor Family
> > Software Reference Manual
> >
> > it has a good section on assembly collecting info
> > from a lot of places.
> 
> That was a good hint, thanks a lot!

In case you have an IRIX system with documentation at hand you may check
it's documentation.  The assembler dialects differ a bit but both are
close enough and some details are only well explained in the IRIX
documentation.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: jump instruction in delay slot
  2004-10-19 14:05 jump instruction in delay slot Thomas Koeller
  2004-10-19 14:25 ` Thiemo Seufer
       [not found] ` <000901c4b5e8$70141160$10eca8c0@grendel>
@ 2004-10-19 17:06 ` Ralf Baechle
  2 siblings, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2004-10-19 17:06 UTC (permalink / raw)
  To: Thomas Koeller; +Cc: Linux/MIPS Development, Manish Lachwani

On Tue, Oct 19, 2004 at 04:05:47PM +0200, Thomas Koeller wrote:

> 		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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-10-19 17:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-19 14:05 jump instruction in delay slot Thomas Koeller
2004-10-19 14:25 ` Thiemo Seufer
     [not found] ` <000901c4b5e8$70141160$10eca8c0@grendel>
2004-10-19 15:48   ` Thomas Koeller
2004-10-19 17:06 ` Ralf Baechle
     [not found] <B482D8AA59BF244F99AFE7520D74BF961A5B71@server1.RightHand.righthandtech.com>
2004-10-19 17:00 ` Thomas Koeller
2004-10-19 17:02   ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox