Linux MIPS Architecture development
 help / color / mirror / Atom feed
* inconsistent asm macro
@ 2005-03-30  1:45 Ed Martini
  2006-01-16 15:59 ` Martin Michlmayr
  0 siblings, 1 reply; 2+ messages in thread
From: Ed Martini @ 2005-03-30  1:45 UTC (permalink / raw)
  To: linux-mips

In include/asm-mips/interrupt.h, the definition for local_irq_restore is 
inconsistent in its use of .reorder/.noreorder assembler directives.  
Other asm macros in interrupt.h are wrapped with '.set push' and '.set pop'.

It doesn't seem to be a problem with the 2.96 mipsel-linux- assembler, 
but it caused me a problem with my 4.0-based toolchain.  (As it was the 
local_irq_restore left the assembler in 'reorder' mode and a stack 
pointer post-inc was reordered out of the return delay slot where it 
belonged.)  Luckily we have a sharp compiler guy who figured it out.  
Thanks.

As usual, there may be a reason for this, but it took me a whole day to 
find it, and I thought I'd point it out.

Ed Martini

$ diff -uN interrupt.h interrupt-new.h
--- interrupt.h 2005-03-29 17:35:02.922362384 -0800
+++ interrupt-new.h     2005-03-29 17:33:26.350770293 -0800
@@ -100,6 +100,7 @@

 __asm__ (
        ".macro\tlocal_irq_restore flags\n\t"
+       ".set\tpush\n\t"
        ".set\tnoreorder\n\t"
        ".set\tnoat\n\t"
        "mfc0\t$1, $12\n\t"
@@ -109,8 +110,7 @@
        "or\t\\flags, $1\n\t"
        "mtc0\t\\flags, $12\n\t"
        "irq_disable_hazard\n\t"
-       ".set\tat\n\t"
-       ".set\treorder\n\t"
+       ".set\tpop\n\t"
        ".endm");

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

* Re: inconsistent asm macro
  2005-03-30  1:45 inconsistent asm macro Ed Martini
@ 2006-01-16 15:59 ` Martin Michlmayr
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Michlmayr @ 2006-01-16 15:59 UTC (permalink / raw)
  To: Ed Martini; +Cc: linux-mips, macro

* Ed Martini <martini@c2micro.com> [2005-03-29 17:45]:
> In include/asm-mips/interrupt.h, the definition for local_irq_restore is 
> inconsistent in its use of .reorder/.noreorder assembler directives.  
> Other asm macros in interrupt.h are wrapped with '.set push' and '.set pop'.
> 
> It doesn't seem to be a problem with the 2.96 mipsel-linux- assembler, 
> but it caused me a problem with my 4.0-based toolchain.  (As it was the 
> local_irq_restore left the assembler in 'reorder' mode and a stack 
> pointer post-inc was reordered out of the return delay slot where it 
> belonged.)  Luckily we have a sharp compiler guy who figured it out.  
> Thanks.
> 
> As usual, there may be a reason for this, but it took me a whole day to 
> find it, and I thought I'd point it out.

Maciej, since you use gcc 4, can you please review this patch?

> Ed Martini
> 
> $ diff -uN interrupt.h interrupt-new.h
> --- interrupt.h 2005-03-29 17:35:02.922362384 -0800
> +++ interrupt-new.h     2005-03-29 17:33:26.350770293 -0800
> @@ -100,6 +100,7 @@
> 
> __asm__ (
>        ".macro\tlocal_irq_restore flags\n\t"
> +       ".set\tpush\n\t"
>        ".set\tnoreorder\n\t"
>        ".set\tnoat\n\t"
>        "mfc0\t$1, $12\n\t"
> @@ -109,8 +110,7 @@
>        "or\t\\flags, $1\n\t"
>        "mtc0\t\\flags, $12\n\t"
>        "irq_disable_hazard\n\t"
> -       ".set\tat\n\t"
> -       ".set\treorder\n\t"
> +       ".set\tpop\n\t"
>        ".endm");
> 
> 
> 

-- 
Martin Michlmayr
http://www.cyrius.com/

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

end of thread, other threads:[~2006-01-16 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-30  1:45 inconsistent asm macro Ed Martini
2006-01-16 15:59 ` Martin Michlmayr

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