title: How to emulate ARM unaligned memory access exceptions?
body: <p>I'm writing a cross-platform application which works on x86 machines, but crashes with "Bus error" on the actual ARM hardware (Raspberypi 2) ...</p>
  
  <pre><code>[ 4105.019037] Alignment trap: not handling instruction edd37a00 at [&lt;00014218&gt;]
  [ 4105.019059] Unhandled fault: alignment exception (0x001) at 0x0002814e
  [ 4105.028227] pgd = b736c000
  [ 4105.033347] [0002814e] *pgd=3708d835, *pte=335d075f, *ppte=335d0c7f
  </code></pre>
  
  <p>... but runs without any problems in <a href="https://www.qemu.org/" rel="nofollow noreferrer">Qemu</a>.</p>
  
  <p>I run this command to enable SIGBUS signal and notification in the kernel running under Qemu, but it doesn't seem to have any effect:</p>
  
  <p><code>echo 5 &gt; /proc/cpu/alignment</code> [<a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/mem_alignment" rel="nofollow noreferrer">2</a>]</p>
  
  <p>How do I emulate these errors in Qemu (or in another free emulator)? I would like to be able to run my automated tests inside a continuous integration environment running on a x86 machine where I'm unable to use the actual hardware. Alternatively I could rent an ARM server but I would like to avoid this.</p>
  
  <p>Later edit for further clarification: the instruction which causes this problem on the real hardware is also executed in the emulator where it seems to work without triggering any exceptions. </p>