内联汇编的问题 救命啊T_T

supergift 2007-01-11 11:39:42
#elif defined __i386 && ( defined __linux || defined __svr4__ || defined VXWORKS )
I32 family = RV_IA_CPU_UNKNOWN;
I32 model = 0, stepping = 0;
I32 has_mmx = 0, has_kni = 0, has_sse2 = 0;
cpu_info->architecture = RV_CPU_IA;

__asm__ __volatile (
"pushl %%ebx \n\t" <----241行
"pushfl \n\t"
"popl %%eax \n\t"
"movl %%eax, %%ebx \n\t"
"xorl $0x200000, %eax \n\t"
"pushl %%eax \n\t"
"popfl \n\t"
"pushfl \n\t"
"popl %%eax \n\t"
"xorl %%ebx, %%eax \n\t"
"andl $0x200000, %%eax \n\t"
"jz jumphere \n\t"
"xorl %%eax, %%eax \n\t"
"cpuid \n\t"
"or %%eax, %%eax \n\t"
"jz jumphere \n\t"
"movl $1, %%eax \n\t"
"cpuid \n\t"
"movl %%eax, %%ecx \n\t"
"andl $0xf00, %%ecx \n\t"
"shrl $8, %%ecx \n\t"
"movl %%ecx, %0 \n\t"
"movl %%eax, %%ecx \n\t"
"andl $0xf0, %%ecx \n\t"
"shrl $4, %%ecx \n\t"
"movl %%ecx, %1 \n\t"
"movl %%eax, %%ecx \n\t"
"andl $0x0f, %%ecx \n\t"
"movl %%ecx, %2 \n\t"
"movl %%edx, %%eax \n\t"
"andl $0x800000, %%eax \n\t"
"jz jumphere \n\t"
"mov $1, %%eax \n\t"
"mov %%eax, %3 \n\t"
"movl %%edx, %%eax \n\t"
"and $0x2000000, %%eax \n\t"
"mov %%eax, %4 \n\t"
"movl %%edx, %%eax \n\t"
"and $0x4000000, %%eax \n\t"
"mov %%eax, %5 \n\t"
"jumphere: \n\t"
"popl %%ebx \n\t"
:"=m" (family),"=m" (model), "=m" (stepping), "=m" (has_mmx), "=m" (has_kni), "=m" (has_sse2)
:/*no input*/
:"%eax","%ebx","%ecx","%edx");

出错信息如下:

cdeclib/rvcpu.c:241: error: PIC register `ebx' clobbered in `asm'
...全文
355 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
one7th 2007-01-17
  • 打赏
  • 举报
回复
volatile前后的__要对称吧, __volatile__
supergift 2007-01-15
  • 打赏
  • 举报
回复
没人知道什么原因么?

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧