社区
C语言
帖子详情
IA32中有一个指令movl,我的问题是:“movl"中的"l"是何意?(不耻上问)
nail63547188
2004-07-14 01:52:19
mov 指令的作用是在寄存器,内存,I/O端口间移动数据,“movl"中的"l"是何意呢?“l"是什么单词的首字母呢?恭候您的答复,谢谢
...全文
1675
9
打赏
收藏
IA32中有一个指令movl,我的问题是:“movl"中的"l"是何意?(不耻上问)
mov 指令的作用是在寄存器,内存,I/O端口间移动数据,“movl"中的"l"是何意呢?“l"是什么单词的首字母呢?恭候您的答复,谢谢
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用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
IA32
Assembly Language
IA32
Assembly Language
l-ia-pdf.pdf
Inline assembly for x86 in Linux,Putting the pieces together
at&t 部分语法大 其
中
的
一个
小块
是英文版的at&t格式的 有其
中
的一部分的讲解 是英文版的at&t格式的 有其
中
的一部分的讲解 是英文版的at&t格式的 有其
中
的一部分的讲解 是英文版的at&t格式的 有其
中
的一部分的讲解
复旦大学计算机体系结构期末考试B卷.doc
复旦大学计算机体系结构期末考试B卷.doc
2.第二周课件--异常和
中
断课件1
(1) 对于上述三条
指令
的执行,在取
指令
时是否可能发生页故障 (2) 在数据访
问
时分别会发生什么
问
题
(3) 哪些
问
题
是可恢复的 (1) 对于上述三条
指令
的执行
C语言
70,026
社区成员
243,244
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章