_format 文字列で printf を呼び出そうとしていますが、両方の文字列を出力する代わりにエラーが発生します。_printStr 関数を追加する前にプログラムを動作させることができたので、両方が出力されない理由が本当にわかりません。各文字列を個別に出力することもでき、問題なく動作します (12(%ebp) と 16(%ebp) を使用)。これは私が持っているコードです:
.text
.globl _main
_string: .ascii "Hello\0"
_string2: .ascii " World\0"
_format: .ascii "%s %s\0"
_main: // push params, call fn, clear params, return
pushl $_string2
pushl $_string
call _printStr
addl $8, %esp
ret
//function to print a string passed to it on the stack
_printStr:
push %ebp # save old frame ptr
movl %esp, %ebp # set frame ptr
pushl 8(%ebp)
pushl 12(%ebp)
pushl _format
call _printf
addl $12, %esp # clear params from stack
leave
ret
お時間をいただきありがとうございます。