Log in

No account? Create an account
Previous Entry Share Next Entry
My first program on my Samsung Galaxy S

No, it is not a java program, it is in assembly, which was possible because I recently flashed Cyanogenmod on my phone. Here it is:

.global _start
	mov r7, #1
	mov r0, #42
	swi #0

The program simply returns 42 and exits. I used my own cross-built binutils (--target=armv-android-eabi) to build this and simply copied it over to my phone, chmod and executed it. You need to put it outside your sdcard environment however, since you cannot execute anything in /sdcard. A Stackoverflow thread helped figure out the right opcode for the syscall.

It took me all of 6 hours to figure this out. 5 minutes to figure out the above code and 5 hours and 55 minutes to realize and fix the last line from

swi 0
swi #0

  • 1
It seems you have a problem with the tag ( ie, there 1 tag of 3 word, and not 3 tag of 1 word ).

  • 1