Closed db7 closed 5 years ago
Adding a ret
as last instruction solved the issue.
We should add some documentation to the help page in any case, including (if it's not already there) the compiler flags to make a standalone binary.
On Fri, 11 Oct 2019 at 12:59, Diogo Behrens notifications@github.com wrote:
Adding a ret as last instruction solved the issue.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rems-project/rmem/issues/5?email_source=notifications&email_token=ABFMZZQNAWXDC47JLZ2BJI3QOBTDFA5CNFSM4I7XX5D2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA7YRVY#issuecomment-541034711, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFMZZQ3TMIYZQTKI5I7E5DQOBTDFANCNFSM4I7XX5DQ .
That would be very helpful. Also how to start threads. It seems I got it now with this code:
_start:
// start a second thread
ldr x0,=main
.word 0xd50bb003
// both threads get here
main:
ldr x1,=var
ldr w2,[x1]
sub w2,w2,#1
str w2,[x1]
ret
.section ".data"
var:
.word 0xDEADBEEF
.word 0x00000000
But I am not sure whether that is the right way.
We'd like to try some small ELF files with the tool, so I started with a NOP instruction.
It looks like this:
When I run that with flat or flatOpt, the tool terminates with an exception because it tries to fetch the next instruction, but there is none.
Executing in the interactive mode, I could see that the NOP instruction was executed as expected.
So, how to properly build an ELF file to run with the tool? I'm sorry if that is a very basic question, but I could not find any specific instructions to do that.