请教几句汇编语言是什么意思
时间:2010-08-13
来源:互联网
0. long __res;\
1. __asm__ volatile ("int $0x80" \
2. : "=a" (__res) \
3. : "0" (__NR_##name)); \
本人汇编学习的不深,求教上述汇编语言第二行与第三行是什么意思。谢谢
1. __asm__ volatile ("int $0x80" \
2. : "=a" (__res) \
3. : "0" (__NR_##name)); \
本人汇编学习的不深,求教上述汇编语言第二行与第三行是什么意思。谢谢
作者: nathan10 发布时间: 2010-08-13
int $0x80
产生0x80中断,这个中断是做什么用的,查一下。剩下的估计就容易明白了
产生0x80中断,这个中断是做什么用的,查一下。剩下的估计就容易明白了
作者: Godbach 发布时间: 2010-08-13
a Use the %eax, %ax, or %al registers.
= The operand can only be written to.
0 signals the compiler to use the same register with output
= The operand can only be written to.
0 signals the compiler to use the same register with output
作者: liying_gg 发布时间: 2010-08-13
int80是陷入系统调用的软中段,但是你程序中没有设置寄存器,不知道陷入那个系统调用
作者: liying_gg 发布时间: 2010-08-13
回复 liying_gg
这里name的值是fork
这里name的值是fork
作者: nathan10 发布时间: 2010-08-13
上面的代码就是头文件unistd.h中的一部分
#define __NR_fork 2
....
#define _syscall0(type,name) \
type name(void) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name)); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
而init文件中的main.c中调用语句是static inline _syscall0(int,fork)
#define __NR_fork 2
....
#define _syscall0(type,name) \
type name(void) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name)); \
if (__res >= 0) \
return (type) __res; \
errno = -__res; \
return -1; \
}
而init文件中的main.c中调用语句是static inline _syscall0(int,fork)
作者: nathan10 发布时间: 2010-08-13
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28