如何改变这种code到ARM汇编指令? [英] How to change this code to ARM assembly instructions?

查看:143
本文介绍了如何改变这种code到ARM汇编指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何改变这种code到ARM汇编指令?
我想运行在Android中kernel.But这个code,我不知道如何使用ARM汇编指令。

How to change this code to ARM assembly instructions? I want to run this code in android kernel.But I don't know how to use ARM assembly instructions.

#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
type name(type1 arg1,type2 arg2,type3 arg3) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
       : "=a" (__res) \
       : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
                "d" ((long)(arg3))); \
__syscall_return(type,__res); \
}

非常感谢。

推荐答案

您需要的ARM什么是软件中断指令是在x86'诠释'的大致相当于:

What you need on ARM is the "software interrupt" instruction which is a rough equivalent of 'int' on x86:

swi 0  ;  0 is the interrupt vector for "syscall"

您可以在这里得到的概述: OSDev维基ARM的

You can get an overview here: OSDev Wiki on ARM

在你好,世界为ARM / Android版可以在此发现的帖子

The "hello, world" for ARM/Android can be found in this post

这篇关于如何改变这种code到ARM汇编指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆