|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码如下,最简单的Hello world
section .text ;section declaration
global _start
_start:
mov edx,len ;third argument: message length
mov ecx,msg ;second argument: pointer to message to write
mov ebx,1 ;first argument: file handle
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov ebx,0 ;first syscall argument: exit code
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data ;section declaration
msg db "Hello, World!",0xa ;our dear string
len equ $ - msg ;length of our dear string
汇编执行都没问题,但是这样写
section .text ;section declaration
global _start
section .data ;section declaration
msg db "Hello, World!",0xa ;our dear string
len equ $ - msg ;length of our dear string
_start:
mov edx,len ;third argument: message length
mov ecx,msg ;second argument: pointer to message to write
mov ebx,1 ;first argument: file handle
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov ebx,0 ;first syscall argument: exit code
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
把data section写到start前面为啥就汇编错误呢? |
|