[riot-commits] [RIOT-OS/RIOT] 48fabc: cpu/atmega_common: Fix return value of irq_enable

Juan I Carrano noreply at github.com
Tue Sep 10 13:39:55 CEST 2019


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 48fabca38dbb08d4e73d337c8ee9f058baf41ca2
      https://github.com/RIOT-OS/RIOT/commit/48fabca38dbb08d4e73d337c8ee9f058baf41ca2
  Author: Marian Buschsieweke <marian.buschsieweke at ovgu.de>
  Date:   2019-04-25 (Thu, 25 Apr 2019)

  Changed paths:
    M cpu/atmega_common/irq_arch.c

  Log Message:
  -----------
  cpu/atmega_common: Fix return value of irq_enable

Citing the doc of irq_enable():

    @return Previous value of status register. [...]

On atmega however the new value of the status register is returned, not the one
prior to enabling interrupts.


  Commit: 70cf9b34c7001390a266dcbe49292d96f6cf2200
      https://github.com/RIOT-OS/RIOT/commit/70cf9b34c7001390a266dcbe49292d96f6cf2200
  Author: Marian Buschsieweke <marian.buschsieweke at ovgu.de>
  Date:   2019-04-25 (Thu, 25 Apr 2019)

  Changed paths:
    M cpu/atmega_common/irq_arch.c

  Log Message:
  -----------
  cpu/atmega_common: Add barriers to irq_*()

To prevent reordering of accesses to the interrupt control register when link
time optimization (LTO) is enabled, memory barriers are needed. Without LTO
calls to the external functions irq_disable(), irq_restore(), irq_enable() and
irq_is_in() have the same affect as compiler barriers, as the compiler is unable
to prove that reordering of memory accesses is safe (from a single-threaded
point of view). With LTO the compiler can easily prove that reordering is safe
from a single-threaded point of view: Thus, the compiler may move memory
accesses wrapped in irq_disable(), irq_restore() across those calls.

The memory barriers will have no effect on non-LTO builds.


  Commit: abc25f07156d39ff11a61eb3e0ac34bed9f71075
      https://github.com/RIOT-OS/RIOT/commit/abc25f07156d39ff11a61eb3e0ac34bed9f71075
  Author: Juan I Carrano <j.carrano at fu-berlin.de>
  Date:   2019-09-10 (Tue, 10 Sep 2019)

  Changed paths:
    M cpu/atmega_common/irq_arch.c

  Log Message:
  -----------
  Merge pull request #11452 from maribu/atmega_irq

cpu/atmega_common: Bugfixes in irq_arch.c


Compare: https://github.com/RIOT-OS/RIOT/compare/16dc92570f2e...abc25f07156d


More information about the commits mailing list