社区
C语言
帖子详情
IA32中有一个指令movl,我的问题是:“movl"中的"l"是何意?(不耻上问)
nail63547188
2004-07-14 01:52:19
mov 指令的作用是在寄存器,内存,I/O端口间移动数据,“movl"中的"l"是何意呢?“l"是什么单词的首字母呢?恭候您的答复,谢谢
...全文
1574
9
打赏
收藏
IA32中有一个指令movl,我的问题是:“movl"中的"l"是何意?(不耻上问)
mov 指令的作用是在寄存器,内存,I/O端口间移动数据,“movl"中的"l"是何意呢?“l"是什么单词的首字母呢?恭候您的答复,谢谢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
nail63547188
2004-07-14
打赏
举报
回复
to 中指兄:
不好意思,刚才有冒犯的地方,还请多多原谅,谢谢你对我的帮助
lbaby
2004-07-14
打赏
举报
回复
AT&T汇编是UNIX下惯用的汇编格式
l ,w,b是AT&T汇编中用来表示操作属性的限定符
l是长字(4字节),
w是双字
b是一个字节
加在指令的后边
相当于intel中的
dword ptr
word ptr
byte ptr
比如:
subl $8, %esp
leal -792(%ebp), %eax
pushl %eax
movl -796(%ebp), %eax
sall $8, %eax
addl 12(%ebp), %eax
pushl %eax
call _strcpy
addl $16, %esp
在intel 汇编中就相当于:
sub esp,8
lea eax,dword ptr [ebp-792]
push eax
mov eax,dword ptr [ebp- 796]
...
AT&T格式的汇编和intel编的差别可以参看有关AT&T汇编的书
lbaby
2004-07-14
打赏
举报
回复
我晕
就是AT&T格式的汇编,跟intel格式不一样
比如:
.file "t1.c"
.globl _label_str
.text
LC0:
.ascii "id\0"
LC1:
.ascii "u_sub\0"
LC2:
.ascii "dlvrd\0"
LC3:
.ascii "submit_date\0"
LC4:
.ascii "done_date\0"
LC5:
.ascii "stat\0"
LC6:
.ascii "err\0"
LC7:
.ascii "txt\0"
.data
.align 32
_label_str:
.long LC0
.long LC1
.long LC2
.long LC3
.long LC4
.long LC5
.long LC6
.long LC7
.globl _fmt
.text
LC8:
.ascii "%255[^:]:%255[^ ^:]\0"
.data
.align 4
_fmt:
.long LC8
.text
LC9:
.ascii "%[^ ]\0"
.align 2
.globl _no_sp
.def _no_sp; .scl 2; .type 32; .endef
_no_sp:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl 12(%ebp), %eax
movl %eax, -4(%ebp)
L7:
movl -4(%ebp), %eax
cmpb $32, (%eax)
je L9
jmp L8
L9:
leal -4(%ebp), %eax
incl (%eax)
jmp L7
L8:
subl $4, %esp
pushl 8(%ebp)
pushl $LC9
pushl -4(%ebp)
call _sscanf
addl $16, %esp
movl 8(%ebp), %eax
leave
ret
.align 2
.globl _get_content
.def _get_content; .scl 2; .type 32; .endef
_get_content:
pushl %ebp
movl %esp, %ebp
pushl %ebx
subl $804, %esp
movl $0, -796(%ebp)
movl 8(%ebp), %eax
movl %eax, -12(%ebp)
L11:
movl -12(%ebp), %eax
cmpb $0, (%eax)
jne L14
jmp L10
L14:
leal -792(%ebp), %eax
pushl %eax
leal -280(%ebp), %eax
pushl %eax
pushl _fmt
pushl -12(%ebp)
call _sscanf
addl $16, %esp
subl $8, %esp
leal -280(%ebp), %eax
pushl %eax
leal -536(%ebp), %eax
pushl %eax
call _no_sp
addl $16, %esp
movl $0, -804(%ebp)
L15:
cmpl $7, -804(%ebp)
jle L18
jmp L16
L18:
subl $8, %esp
movl -804(%ebp), %eax
pushl _label_str(,%eax,4)
leal -536(%ebp), %eax
pushl %eax
call _strcmp
addl $16, %esp
testl %eax, %eax
jne L17
movl -804(%ebp), %eax
movl %eax, -796(%ebp)
jmp L16
L17:
leal -804(%ebp), %eax
incl (%eax)
jmp L15
L16:
cmpl $8, -804(%ebp)
jne L20
jmp L13
L20:
subl $8, %esp
leal -792(%ebp), %eax
pushl %eax
movl -796(%ebp), %eax
sall $8, %eax
addl 12(%ebp), %eax
pushl %eax
call _strcpy
addl $16, %esp
L13:
subl $12, %esp
leal -280(%ebp), %eax
pushl %eax
call _strlen
addl $16, %esp
movl %eax, %ebx
subl $12, %esp
leal -792(%ebp), %eax
pushl %eax
call _strlen
addl $16, %esp
leal (%eax,%ebx), %eax
addl -12(%ebp), %eax
incl %eax
movl %eax, -12(%ebp)
jmp L11
L10:
movl -4(%ebp), %ebx
leave
ret
.def ___main; .scl 2; .type 32; .endef
.align 32
LC10:
.ascii "id:1 u_sub:2 dlvrd:3 submit_date:4 done_date:5 stat:6 err:7 txt:8 ok:88\0"
.align 32
LC11:
.ascii " done_date:0407081236 stat:DELIVRD err:000 txt:062\320\351\310\331\243\254\266\324\261\310\260\256\307\351\265\304 id:7% u_sub:001 dlvrd:001 submit_date:0407081236\0"
LC12:
.ascii "%20s %20s\12\0"
.align 32
LC13:
.ascii "-----------------------------------------------------------\0"
.align 2
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
movl $4152, %eax
call __alloca
andl $-16, %esp
movl $0, %eax
movl %eax, -4144(%ebp)
movl -4144(%ebp), %eax
call __alloca
call ___main
movl $LC10, -12(%ebp)
movl $LC11, -2076(%ebp)
subl $8, %esp
leal -2072(%ebp), %eax
pushl %eax
pushl -12(%ebp)
call _get_content
addl $16, %esp
subl $8, %esp
leal -4136(%ebp), %eax
pushl %eax
pushl -2076(%ebp)
call _get_content
addl $16, %esp
movl $0, -4140(%ebp)
L22:
cmpl $7, -4140(%ebp)
jle L25
jmp L23
L25:
subl $4, %esp
leal -2072(%ebp), %edx
movl -4140(%ebp), %eax
sall $8, %eax
leal (%eax,%edx), %eax
pushl %eax
movl -4140(%ebp), %eax
pushl _label_str(,%eax,4)
pushl $LC12
call _printf
addl $16, %esp
leal -4140(%ebp), %eax
incl (%eax)
jmp L22
L23:
subl $12, %esp
pushl $LC13
call _puts
addl $16, %esp
movl $0, -4140(%ebp)
L26:
cmpl $7, -4140(%ebp)
jle L29
jmp L27
L29:
subl $4, %esp
leal -4136(%ebp), %edx
movl -4140(%ebp), %eax
sall $8, %eax
leal (%eax,%edx), %eax
pushl %eax
movl -4140(%ebp), %eax
pushl _label_str(,%eax,4)
pushl $LC12
call _printf
addl $16, %esp
leal -4140(%ebp), %eax
incl (%eax)
jmp L26
L27:
movl $0, %eax
leave
ret
.def _puts; .scl 2; .type 32; .endef
.def _printf; .scl 2; .type 32; .endef
.def _strcpy; .scl 2; .type 32; .endef
.def _strcmp; .scl 2; .type 32; .endef
.def _strlen; .scl 2; .type 32; .endef
.def _sscanf; .scl 2; .type 32; .endef
riitso
2004-07-14
打赏
举报
回复
根据操作数是字节 (byte)、字 (word) 还是长型 (long),指令的后缀可以是 b、w 或 l,movb,movw,movl
longword就是32位数据类型
nail63547188
2004-07-14
打赏
举报
回复
to 中指兄:
麻烦您说的详细一些,好吗?您的等级都是红五星了,你这种回答问题的方式,不太严谨吧,话说的有点重,还请原谅
xzygod
2004-07-14
打赏
举报
回复
ia32里面有吗
lbaby
2004-07-14
打赏
举报
回复
呵呵,AT&T格式的汇编
nail63547188
2004-07-14
打赏
举报
回复
to riitso兄:
麻烦您解释一下可以吗?什么是长字(longword)?
riitso
2004-07-14
打赏
举报
回复
Longword move
IA
-32传送
指令
执行
IA
-32常用传送
指令
–通用数据传送
指令
MOV:一般传送,包括movb、movw和
movl
等 MOVS:符号扩展传送,如movsbw、movswl等 MOVZ:零扩展传送,如movzwl、movzbl等 XCHG:数据交换
6.1
IA
-32
指令
类型(一)
IA
-32
中
的主要
指令
类型 (1)传送
指令
通用数据传送
指令
MOV: 一般传送,包括movb、movw和
movl
等 MOVS: 符号扩展传送,如movsbw、movswl等 MOVZ: 零扩展传送,如movzwl、movzbl等 XCHG: 数据交换 PUSH/POP: 入栈/出栈,如pushl,pushw,popl,popw等 地址传送
指令
LE...
IA
-32常用
指令
类型
1.传送
指令
-通用数据传送
指令
MOV:一般传送,movb、movw、
movl
等(b是8位,w是16位,l是32位)。 MOVS:符号扩展传送,movsbw(比如把char型赋值给int型,高8位就用char型变量第一位的符号进行扩展)、movswl。 MOVZ:零扩展传送,movzwl、movzbl等。 XCHG:数据交换 PUSH...
第六章
IA
-32
指令
类型
IA
-32
指令
类型1、传送
指令
1.2、常用传送
指令
1.3、传送
指令
执行过程2、定点算术运算
指令
2.1、常用定点运算
指令
2.2、加法运算的底层实现举例2.3、加法
指令
和乘法
指令
举例3、按位运算
指令
3.1、逻辑运算和移位运算3.2、按位运算
指令
举例4、控制转移
指令
4.1、条件转移
指令
举例4.2、条件设置
指令
举例5、x87浮点处理
指令
5.1、x87 FPU常用
指令
5.2、x87浮点处理
指令
举例6、MMX及SSE
指令
集6.1、MMX及SSE
指令
集 1、传送
指令
1.2、常用传送
指令
1.3、传送
指令
执行过程 2、定
5.
IA
-32
指令
系统概述
5.1 程序转换概述 1.“
指令
”的概念 (1) 计算机
中
的
指令
有微
指令
、机器
指令
和伪(宏)
指令
之分 机器
指令
处于硬件和软件的交界面 (相当于一个菜谱指定的一个完整做菜过程) 微
指令
是微程序级命令,属于硬件范畴 (相当于洗、切、煮、炒等做菜“微过程“ ) 伪
指令
是由若干机器
指令
组成的
指令
序列,属于软件范畴 (相当于由多个菜谱合成一个”大菜“的过程) 汇编
指令
是机器指...
C语言
69,382
社区成员
243,073
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章