Advertising
- Something
- Friday, June 29th, 2012 at 2:14:00am MDT
- [user@localhost return_42_code]$ cat return_42.asm
- section .text
- global _start ;must be declared for linker (ld)
- _start: ;tell linker entry point (program entry point)
- mov di,42 ;exit status
- mov ax,60 ;system call number (sys_exit)
- syscall
- ;from http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
- ;nano return_42.asm && nasm -f elf64 -l return_42.s return_42.asm && nasm -f elf64 -g -o return_42_with_debug return_42.asm && echo -e "\nnasm listfile:\n" && cat return_42.s && echo -e "\n" && ld -s -o return_42 return_42.o && echo -e "\nasm ndisasm:\n" && ndisasm -b64 return_42 && objdump -x return_42 && objdump -M intel -d return_42 && echo -e "\n\nreadelf:\n" && readelf -a return_42 && ls -al return_42* && ./return_42 ; echo "$?"
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.