LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1186|回复: 11

gcc内联at&t汇编,编译出错,请大家帮忙

[复制链接]
发表于 2004-4-7 11:16:20 | 显示全部楼层 |阅读模式
laxi@LaXi:~/testkernel$ gcc -c mykernel.c
mykernel.c:28:23: warning: multi-line string literals are deprecated
mykernel.c:39:13: warning: multi-line string literals are deprecated
mykernel.c: In function `myprintf':
mykernel.c:28: invalid `asm': operand number out of range

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2004-4-7 11:30:52 | 显示全部楼层
分成多行的指令,要分别用""包含起来

example:
asm ( "movw %%cs,%%ax \n"
      "movw %%ax,%%ds \n");
 楼主| 发表于 2004-4-7 11:33:10 | 显示全部楼层

改了一下,还是有错误

laxi@LaXi:~/testkernel$ gcc -c mykernel.c
mykernel.c: In function `myprintf':
mykernel.c:28: invalid `asm': operand number out of range

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
 楼主| 发表于 2004-4-7 11:34:13 | 显示全部楼层
谢谢_z_兄的回复,现在呢?
 楼主| 发表于 2004-4-7 16:28:54 | 显示全部楼层
up,大家再帮忙看看啊~
发表于 2004-4-7 21:54:05 | 显示全部楼层
操作数引用的格式不对?
发表于 2004-4-8 09:22:13 | 显示全部楼层
string是变量吗?
发表于 2004-4-8 09:23:38 | 显示全部楼层
“a"(string)声明的是把string变量的值放入到eax中,和前面的movw不匹配呀。
发表于 2004-4-8 09:31:07 | 显示全部楼层
asm volative ("movw %1,%%si;"::"a"(string));

====>
asm volative ("movl %0,%%esi;"::"a"(string));
发表于 2004-4-8 09:34:44 | 显示全部楼层
楼主怪怪的,想让别人回答问题又不贴程序上来,可能有什么苦衷。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表