public inbox for ecos-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
@ 2011-02-16 14:30 bugzilla-daemon
  2011-02-16 14:59 ` [Bug 1001154] " bugzilla-daemon
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: bugzilla-daemon @ 2011-02-16 14:30 UTC (permalink / raw)
  To: ecos-bugs

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001154

           Summary: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
           Product: eCos
           Version: CVS
          Platform: Other (please specify)
        OS/Version: Cortex-M
            Status: UNCONFIRMED
          Severity: major
          Priority: low
         Component: HAL
        AssignedTo: unassigned@bugs.ecos.sourceware.org
        ReportedBy: stano@meduna.org
                CC: ecos-bugs@ecos.sourceware.org
             Class: Advice Request


the arm-eabi-gcc from the eCos distribution sometimes miscompiles
HAL_DISABLE_INTERRUPTS macro for Cortex-M3:

Macro:

# define HAL_DISABLE_INTERRUPTS(__old)          \
    __asm__ volatile (                          \
        "mrs    %0, basepri             \n"     \
        "mov    r1,%1                   \n"     \
        "msr    basepri,r1              \n"     \
        : "=r" (__old)                          \
        :  "r" (CYGNUM_HAL_CORTEXM_PRIORITY_MAX)\
        : "r1"                                  \
        );

Code:

60133e26:    f04f 0320     mov.w    r3, #32
60133e2a:    f3ef 8311     mrs    r3, BASEPRI
60133e2e:    4619          mov    r1, r3
60133e30:    f381 8811     msr    BASEPRI, r1
60133e34:    613b          str    r3, [r7, #16]

That results in HAL_DISABLE_INTERRUPTS effectively being a nop with all kinds
of subsequent crashes.

The problem is that the output (%0) is clobbered before using the input (%1). 

Either
       :  "I" (CYGNUM_HAL_CORTEXM_PRIORITY_MAX)\
or
        : "=&r" (__old)                          \
fix the problem.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug 1001154] HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
  2011-02-16 14:30 [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3 bugzilla-daemon
@ 2011-02-16 14:59 ` bugzilla-daemon
  2011-02-16 15:09 ` bugzilla-daemon
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: bugzilla-daemon @ 2011-02-16 14:59 UTC (permalink / raw)
  To: ecos-bugs

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001154

John Dallaway <john@dallaway.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uholeschak@bihl-wiedemann.d
                   |                            |e

--- Comment #1 from John Dallaway <john@dallaway.org.uk> 2011-02-16 14:59:38 GMT ---
*** Bug 1001153 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug 1001154] HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
  2011-02-16 14:30 [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3 bugzilla-daemon
  2011-02-16 14:59 ` [Bug 1001154] " bugzilla-daemon
@ 2011-02-16 15:09 ` bugzilla-daemon
  2011-02-16 15:18 ` bugzilla-daemon
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: bugzilla-daemon @ 2011-02-16 15:09 UTC (permalink / raw)
  To: ecos-bugs

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001154

John Dallaway <john@dallaway.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john@dallaway.org.uk

--- Comment #2 from John Dallaway <john@dallaway.org.uk> 2011-02-16 15:09:42 GMT ---
Stano, thank you for the bug report.

(In reply to comment #0)

> Either
>        :  "I" (CYGNUM_HAL_CORTEXM_PRIORITY_MAX)\
> or
>         : "=&r" (__old)                          \
> fix the problem.

Marking the operand as an earlyclobber operand using "=&r" seems to be the most
elegant solution in that it documents the original issue.

Any other comments?

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug 1001154] HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
  2011-02-16 14:30 [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3 bugzilla-daemon
  2011-02-16 14:59 ` [Bug 1001154] " bugzilla-daemon
  2011-02-16 15:09 ` bugzilla-daemon
@ 2011-02-16 15:18 ` bugzilla-daemon
  2011-02-17 13:43 ` bugzilla-daemon
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: bugzilla-daemon @ 2011-02-16 15:18 UTC (permalink / raw)
  To: ecos-bugs

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001154

--- Comment #3 from Stanislav Meduna <stano@meduna.org> 2011-02-16 15:18:23 GMT ---
No other comment, I'm fine with this solution. Two independent reports of the
same issue in less than an hour - in fact between I checked and reported - is
an interesting synchronicity ;)

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug 1001154] HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
  2011-02-16 14:30 [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3 bugzilla-daemon
                   ` (2 preceding siblings ...)
  2011-02-16 15:18 ` bugzilla-daemon
@ 2011-02-17 13:43 ` bugzilla-daemon
  2011-02-17 13:44 ` bugzilla-daemon
  2011-03-04 13:06 ` bugzilla-daemon
  5 siblings, 0 replies; 8+ messages in thread
From: bugzilla-daemon @ 2011-02-17 13:43 UTC (permalink / raw)
  To: ecos-bugs

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001154

John Dallaway <john@dallaway.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
         AssignedTo|unassigned@bugs.ecos.source |john@dallaway.org.uk
                   |ware.org                    |
     Ever Confirmed|0                           |1

--- Comment #4 from John Dallaway <john@dallaway.org.uk> 2011-02-17 13:43:10 GMT ---
Created an attachment (id=1133)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1133)
cortexm-intr-110217.patch

This patch marks the HAL_DISABLE_INTERRUPTS() operand as an earlyclobber
operand.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug 1001154] HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
  2011-02-16 14:30 [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3 bugzilla-daemon
                   ` (3 preceding siblings ...)
  2011-02-17 13:43 ` bugzilla-daemon
@ 2011-02-17 13:44 ` bugzilla-daemon
  2011-03-04 13:06 ` bugzilla-daemon
  5 siblings, 0 replies; 8+ messages in thread
From: bugzilla-daemon @ 2011-02-17 13:44 UTC (permalink / raw)
  To: ecos-bugs

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001154

John Dallaway <john@dallaway.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |CURRENTRELEASE

--- Comment #5 from John Dallaway <john@dallaway.org.uk> 2011-02-17 13:44:26 GMT ---
Patch checked-in.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug 1001154] HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
  2011-02-16 14:30 [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3 bugzilla-daemon
                   ` (4 preceding siblings ...)
  2011-02-17 13:44 ` bugzilla-daemon
@ 2011-03-04 13:06 ` bugzilla-daemon
  5 siblings, 0 replies; 8+ messages in thread
From: bugzilla-daemon @ 2011-03-04 13:06 UTC (permalink / raw)
  To: ecos-bugs

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001154

John Dallaway <john@dallaway.org.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cyrillkuenzle@gmail.com

--- Comment #6 from John Dallaway <john@dallaway.org.uk> 2011-03-04 13:06:36 GMT ---
*** Bug 1001143 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
@ 2011-02-16 14:30 bugzilla-daemon
  0 siblings, 0 replies; 8+ messages in thread
From: bugzilla-daemon @ 2011-02-16 14:30 UTC (permalink / raw)
  To: unassigned

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001154

           Summary: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3
           Product: eCos
           Version: CVS
          Platform: Other (please specify)
        OS/Version: Cortex-M
            Status: UNCONFIRMED
          Severity: major
          Priority: low
         Component: HAL
        AssignedTo: unassigned@bugs.ecos.sourceware.org
        ReportedBy: stano@meduna.org
                CC: ecos-bugs@ecos.sourceware.org
             Class: Advice Request


the arm-eabi-gcc from the eCos distribution sometimes miscompiles
HAL_DISABLE_INTERRUPTS macro for Cortex-M3:

Macro:

# define HAL_DISABLE_INTERRUPTS(__old)          \
    __asm__ volatile (                          \
        "mrs    %0, basepri             \n"     \
        "mov    r1,%1                   \n"     \
        "msr    basepri,r1              \n"     \
        : "=r" (__old)                          \
        :  "r" (CYGNUM_HAL_CORTEXM_PRIORITY_MAX)\
        : "r1"                                  \
        );

Code:

60133e26:    f04f 0320     mov.w    r3, #32
60133e2a:    f3ef 8311     mrs    r3, BASEPRI
60133e2e:    4619          mov    r1, r3
60133e30:    f381 8811     msr    BASEPRI, r1
60133e34:    613b          str    r3, [r7, #16]

That results in HAL_DISABLE_INTERRUPTS effectively being a nop with all kinds
of subsequent crashes.

The problem is that the output (%0) is clobbered before using the input (%1). 

Either
       :  "I" (CYGNUM_HAL_CORTEXM_PRIORITY_MAX)\
or
        : "=&r" (__old)                          \
fix the problem.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


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

end of thread, other threads:[~2011-03-04 13:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-16 14:30 [Bug 1001154] New: HAL_DISABLE_INTERRUPTS miscompile on Cortex-M3 bugzilla-daemon
2011-02-16 14:59 ` [Bug 1001154] " bugzilla-daemon
2011-02-16 15:09 ` bugzilla-daemon
2011-02-16 15:18 ` bugzilla-daemon
2011-02-17 13:43 ` bugzilla-daemon
2011-02-17 13:44 ` bugzilla-daemon
2011-03-04 13:06 ` bugzilla-daemon
2011-02-16 14:30 [Bug 1001154] New: " bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).