1

我正在尝试编写我的第一个 asm 程序。到目前为止,这是我的程序的代码;

.data
    hello: .string "Hello World!!!!\n"
    format: .string "%s\n"
.text
    .global _start
    _start:

    push hello
    push format
    call printf

    movl $1, %eax   #exit
    movl $0, %ebx
    int $0x80

分段故障。

4

1 回答 1

1

试试这个:

.att_syntax
.global main
.section .data
     txt: .asciz "Hello World"
.section .text
     mov $4, %eax
     mov $1, %ebx
     mov $txt, %ecx
     mov $11, %edx
     int $0x80
     ret
于 2013-12-22T14:26:51.757 回答