So I'm trying to get the time using ARM assembly and am having trouble doing so. This is the code that I have:
.data
.balign 4
time:
.word 0
.text
.global _start
_start:
ldr r0, =time
mov r7, #0xd
svc #0
mov r7, #1
svc #0
However, when using GDB, the value at the address of the variable time is always 0. The return value in r0 after the first system call is always 0xffffffda. It never changes and I can assume that it isn't the time since epoch.
The information that I gathered this from is: https://w3challs.com/syscalls/?arch=arm_strong
I am trying to call the system call "time."
Note that I am programming on a Raspberry Pi 2 model B. The link links to arm_strong architecture and the architecture I am working with is an ARMv7. But essentially replacing the 9 with a 0 in the r7 requirement gets me the system call I want. So for "time" I use 0xd instead of 0x90000d.
What am I doing wrong that neither the return value nor the pointer I pass into the system call is getting me the value I expect? Eventually what I want to do is take the value and print it to the console.