I was trying to write a register context saving/restoring when I came across a weird behaviour.
My code (sorry, tried to format tens of times, but the editor WANTS to make asm a table):
When the exception is returned from, the calling function:
msg = "returned from SVC\r\n";
serial_io.put_string(msg, util_str_len(msg)+1);
asm volatile (
);
msg = "cpsr = ";
util_word_to_hex(scratchpad, tmp1);
serial_io.put_string(scratchpad, 9);
serial_io.put_string("\r\n", 3);
outputs "returned from SVC" and "cpsr = 60000013".
Why the "00000002"? the barriers don't seem to have any effect.
Hello turboscrew,
I'm sorry and I misunderstood the program sequence.
By the way, why do the delimiters exit in the previous inline assembly ocdes?
If you put delimiter for each assembly line, dose the problem still occur?
I think
"@isb" "msr spsr_fsxc, r3" - set value
"@isb"
"msr spsr_fsxc, r3" - set value
did not change the SPSR.
Best regards,
Yasuhiko Koumoto.
The funny thing was, the CPSR was right after return, so "msr spsr_fsxc, r3" did change the value - later.
The code works even if the printed value was wrong.