title: pipeline handling in arm assembly
body: <p>I am doing some assembly programming in Linux ARM and FreeBSD ARM.
  I have some questions regarding ARM pipeline and assembly programming...</p>
  
  <p>Q1. suppose there are ARM assembly instructions (ARM mode) such as</p>
  
  <pre><code>add r0, pc, #0
  mov r1, #1
  mov r1, #2
  mov r1, #3
  mov r1, #4
  </code></pre>
  
  <p>when these are executed, what is the value of r0? and why?</p>
  
  <p>Q2. suppose there are arm assembly instructions such as</p>
  
  <pre><code>sub r0, r0, r0    
  sub r1, r1, r1
  svc #?(a system call which never returns such as execve)
  mov r2, #1
  mov r3, #1
  </code></pre>
  
  <p>assuming <code>svc</code> never returns, does <code>mov r2, #1</code> executes or not?
  (executed because of pipelining...?)</p>
  
  <p>Q3. is result of Q1, Q2 are same in Thumb mode? or not? why?</p>
  
  <p>Q4, in FreeBSD, does Thumb mode svc numbering differ from ARM mode?
  <code>svc $0x3b</code> (execve) works fine in ARM mode, but it doesn't work in 
  Thumb mode. e.g.:</p>
  
  <pre><code>mov r7, $0x3b
  svc 1
  </code></pre>
  
  <p>this tells me 'bad system call'</p>