命令 | 数据类型 |
.ascii | 文本字符串 |
.asciz | 以空字符结尾的文本字符串 |
.byte | 字节 |
.double | 双精度浮点数 |
.float | 单精度浮点数 |
.int | 32位整数 |
.long | 32位整数(和 .int 相同) |
.octa | 16字节整数 |
.quad | 8字节整数 |
.short | 16位整数 |
.single | 单精度浮点数(和 .float 相同) |
output:
.ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n"
pi:
.float 3.14159
sizes:
.long 100,150,200,250,300
.section .data
msg:
.ascii "This is a test message"
factors:
.double 37.45, 45.33, 12.30
height:
.int 54
length:
.int 62, 35, 47
.equ factor, 3
.equ LINUX_SYS_CALL, 0x80
movl $LINUX_SYS_CALL, %eax
命令 | 描述 |
.comm | 声明未初始化的数据的通用内存区域 |
.lcomm | 声明未初始化的数据的本地通用内存区域 |
comm symbol, length
.section .bss
.lcomm buffer, 10000
# size.s - A sample program to view the executable size
.section .text
.globl _start
_start:
movl $1, %eax
movl $0, %ebx
int $0x80
$ ls -l size
-rwxr-xr-x 1 beyes beyes 460 2009-12-04 19:47 size
# size2.s - A sample program to view the executable size
.section .bss
.lcomm buffer, 10000
.section .text
.globl _start
_start:
movl $1, %eax
movl $0, %ebx
int $0x80
$ ls -l size2
-rwxr-xr-x 1 beyes beyes 575 2009-12-04 19:49 size2
# size3.s - A sample program to view the executable size
.section .data
buffer:
.fill 10000
.section .text
.globl _start
_start:
movl $1, %eax
movl $0, %ebx
int $0x80
$ ls -l size3
-rwxr-xr-x 1 beyes beyes 10575 2009-12-04 19:50 size3
.fill repeat, size, value
.section .data
buffer:
.fill 10000, 4, 8
output:
.asciz "ouput buffer %d\\n"
.section .text
.globl main
main:
pushl buffer
pushl $output
call printf
addl $8, %esp
pushl buffer+4
pushl $output
call printf
addl $8, %esp
movl $1, %eax
movl $0, %ebx
int $0x80
./size32
ouput buffer 8
ouput buffer 8
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |