Tuesday, 5 March 2013

http://www.fourtheye.org/armasm.shtml



http://www.fourtheye.org/armasm.shtml

  .section	.rodata  	.align	2  string:  	.asciz "Sum of %d and %d is %d\n"  .text  	.align	2  	.global	main  	.type	main, %function  main:  	stmfd	sp!, {r0, r1, r2, r3, lr}  	ldr	r0, =string	@ store address of start of string to r0  	mov	r1, #1		@ then each parameter to subsequent registers  	mov	r2, #41  	mov	r3, #42  	bl	printf		@ call the c function to display information  	ldmfd	sp!, {r0, r1, r2, r3 , pc}  	mov	r7, #1		@ set r7 to 1 - the syscall for exit  	swi	0		@ then invoke the syscall from linux  


No comments:

Post a Comment