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