Chinaunix
标题:
内联汇编
[打印本页]
作者:
stuman
时间:
2013-12-01 18:58
标题:
内联汇编
#define switch_to(prev,next,last) do { \
unsigned long esi,edi; \
asm volatile("pushfl\n\t" \
"pushl %%ebp\n\t" \
"movl %%esp,%0\n\t" /* save ESP */ \
"movl %5,%%esp\n\t" /* restore ESP */ \
"movl $1f,%1\n\t" /* save EIP */ \
"pushl %6\n\t" /* restore EIP */ \
"jmp __switch_to\n" \
"1:\t" \
"popl %%ebp\n\t" \
"popfl" \
:"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
"=a" (last),"=S" (esi),"=D" (edi) \
:"m" (next->thread.esp),"m" (next->thread.eip), \
"2" (prev), "d" (next)); \
} while (0)
复制代码
以上是一个内联汇编代码,有的代码后面加了\n\t,有的只有\n,有的只有\t,请问这3种分别表示什么意思呢?分别在什么场合下使用呢?
作者:
humjb_1983
时间:
2013-12-02 09:21
stuman 发表于 2013-12-01 18:58
以上是一个内联汇编代码,有的代码后面加了\n\t,有的只有\n,有的只有\t,请问这3种分别表示什么意思呢?分 ...
应该是转义字符吧,\n表示回车,\t表示tab
作者:
openspace
时间:
2013-12-02 10:44
感觉都是格式化用的
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2