ARM - Registers values during program execution

Thread Starter

Ab Abrams

Joined Apr 27, 2017
Hi guys,

I wrote a C program that includes some inline assembly commands that reads the values of the General purpose registers as well the CPSR ( I am speaking for ARM CPU architecture).
I noticed that I take different register's values when I am executing the program as a "linux user", then as a "root" and finally, when I am running by typing "run" command into the GNU Debugger.

Can someone tell me why this is happening? Does anyone knows what affects those changes?
Is this because of the privilege level and CPU mode or something else?
When I am into GNU Debugger, in which CPU mode the program is running?

Same code, same program , but different outputs based on how I am executing. Any thoughts?