VxWorks 5.4 上的 Hello World、MPC 8280 (powerPC) 除外
__asm__(".data\n\t"
"msg:\n\t"
".string \"Hello, world!\\n\"\n\t"
"len = . - msg\n\t"
".text \n\t"
"li 0,4\n\t"
"li 3,1\n\t"
"lis 4,msg@ha\n\t"
"addi 4,4,msg@l\n\t"
"li 5,len\n\t"
"sc \n\t"
----> "li 0,1\n\t"
"li 3,1\n\t"
"sc"
:
:
: "cr0","cr3","cr1","cr5","memory"
);
我正在尝试打印 Hello World!与上面的代码。但代码给了我一个 'sc' 之后的指令处出现异常,即标有“---->”的行。这是我正在尝试做的 在 vxWorks-5.4 上的处理器 MPC 8280 (PowerPC) 上。关于咨询一些医生。在网上查了一下,我才知道sc是个例外。有人可以建议我做什么来完成这项工作吗?只是为了确认,x86 中的类似代码在其 int 0x80 处完美工作,它完成 sc 的工作并触发系统调用,但由于某种原因,它似乎在 PPC 上不起作用。
这是我第一次尝试使用汇编代码。
__asm__(".data\n\t"
"msg:\n\t"
".string \"Hello, world!\\n\"\n\t"
"len = . - msg\n\t"
".text \n\t"
"li 0,4\n\t"
"li 3,1\n\t"
"lis 4,msg@ha\n\t"
"addi 4,4,msg@l\n\t"
"li 5,len\n\t"
"sc \n\t"
----> "li 0,1\n\t"
"li 3,1\n\t"
"sc"
:
:
: "cr0","cr3","cr1","cr5","memory"
);
I am trying to print Hello World! with the above code. But the code gives me an
exception at instruction after 'sc' i.e line marked with "---->". This I am trying to do
on processor MPC 8280 (PowerPC) on vxWorks-5.4. On consulting some doc. found on internet, I came to know that sc is an exception. Can anybody please suggest me what can I do to accomplish this job. just for the sake of confirmation, the analogous code in x86 works perfectly there its int 0x80, that does the job of sc and triggers the system call, but for some reason it doesn't seem to work on PPC, here.
This is the first time that i have tried with assembly code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论