Andes Workshop
http://forum.andestech.com/

jump current location
http://forum.andestech.com/viewtopic.php?f=25&t=895
Page 1 of 1

Author:  cindy [ Wed Oct 15, 2014 6:17 am ]
Post subject:  jump current location

The x86 instruction "jmp $" is to jump current location.
The character ‘$’ in jump instructions indicates current location.
In Andes assembly, we recommend you use the statement:
Code:
1:  b   1b


But the instruction "j 0" also works.
Code:
Attachment:
1.gif
1.gif [ 10.35 KiB | Viewed 14695 times ]

Objdump:
Attachment:
2.gif
2.gif [ 11.9 KiB | Viewed 14695 times ]


There is a warning just remind you that absolute address is dangerous.
Code:
nds32le-elf-gcc -D__ASSEMBLY__ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/crt0.d" -MT"src/crt0.d" -o "src/crt0.o" "../src/crt0.S"
../src/crt0.S: Assembler messages:
../src/crt0.S:215: Warning: Branch instruction 'j 0' with absolute offset is dangerous.
Finished building: ../src/crt0.S

Attachment:
3.gif
3.gif [ 9.09 KiB | Viewed 14695 times ]


Sample code:
Attachment:
demo-int-j.zip [141.41 KiB]
Downloaded 1182 times

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/