mirror of
https://github.com/pkivolowitz/asm_book.git
synced 2026-06-21 02:26:59 +08:00
changed tabs to spaces in nine_args.s
This commit is contained in:
parent
73bad628b4
commit
f1dd2bea49
1 changed files with 28 additions and 28 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
.text
|
.text
|
||||||
.global main
|
.global main
|
||||||
|
|
||||||
/* Demonstration of using more than 8 arguments to a function. This
|
/* Demonstration of using more than 8 arguments to a function. This
|
||||||
demo is LINUX only as APPLE will put all arguments beyond the first
|
demo is LINUX only as APPLE will put all arguments beyond the first
|
||||||
|
|
@ -11,35 +11,35 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SillyFunction:
|
SillyFunction:
|
||||||
stp x29, x30, [sp, -16]! // Changes sp.
|
stp x29, x30, [sp, -16]! // Changes sp.
|
||||||
mov x29, sp
|
mov x29, sp
|
||||||
ldr x0, =fmt
|
ldr x0, =fmt
|
||||||
mov x1, x7
|
mov x1, x7
|
||||||
ldr x2, [sp, 16] // This does not alter the sp.
|
ldr x2, [sp, 16] // This does not alter the sp.
|
||||||
bl printf
|
bl printf
|
||||||
ldp x29, x30, [sp], 16 // Undoes change to sp.
|
ldp x29, x30, [sp], 16 // Undoes change to sp.
|
||||||
ret
|
ret
|
||||||
|
|
||||||
main:
|
main:
|
||||||
stp x29, x30, [sp, -16]! // sp down total of 16.
|
stp x29, x30, [sp, -16]! // sp down total of 16.
|
||||||
mov x29, sp
|
mov x29, sp
|
||||||
mov x0, 9
|
mov x0, 9
|
||||||
str x0, [sp, -16]! // sp down total of 32.
|
str x0, [sp, -16]! // sp down total of 32.
|
||||||
mov x0, 1
|
mov x0, 1
|
||||||
mov x1, 2
|
mov x1, 2
|
||||||
mov x2, 3
|
mov x2, 3
|
||||||
mov x3, 4
|
mov x3, 4
|
||||||
mov x4, 5
|
mov x4, 5
|
||||||
mov x5, 6
|
mov x5, 6
|
||||||
mov x6, 7
|
mov x6, 7
|
||||||
mov x7, 8
|
mov x7, 8
|
||||||
bl SillyFunction
|
bl SillyFunction
|
||||||
add sp, sp, 16 // undoes change of sp by 16 due
|
add sp, sp, 16 // undoes change of sp by 16 due
|
||||||
// to function call.
|
// to function call.
|
||||||
ldp x29, x30, [sp], 16 // undoes change to sp of 16.
|
ldp x29, x30, [sp], 16 // undoes change to sp of 16.
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.data
|
.data
|
||||||
fmt: .asciz "This example hurts my brain: %ld %ld\n"
|
fmt: .asciz "This example hurts my brain: %ld %ld\n"
|
||||||
|
|
||||||
.end
|
.end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue