什么是Windows RT ARM的原生code调用约定? [英] What is the Windows RT on ARM native code calling convention?
问题描述
我找不到ARM的调用约定由Visual Studio C ++使用的Windows RT的任何文件。微软是采用ARM的 AAPCS ?
如果微软正在使用AAPCS / EABI为Windows RT ARM的,是它也采用的 ARM的C ++ ABI (这是从安腾C ++ ABI派生)?也许连 ARM的异常处理ABI 的<? / p>
在是否使用ARM的Windows RT的调用约定从所使用的不同其他(嵌入式)ARM的Windows变种?
有通过predefined编译宏来检测ARM的Windows RT的可靠途径?
的更新:增加了关于C ++ ABI的问题的
与Windows CE(使用原来的APCS 的老又名ABI)时,Windows RT上使用ARM EABI。更具体地说,它采用浮点变体寄存器来传递浮点数据和8字节堆栈/论点对准
如果我采取以下功能:
INT克(浮X){
返回X;
}
和与VS2012的ARM编译器编译它,我得到以下组件:
| G | PROC
vcvt.s32.f32 S0,S0
VMOV R0,S0
BX LR
ENDP; | G |
您可以看到,它使用 S0
,而不是 R0
的参数。
从VS2008(可用于针对老版本的Windows CE版本)的一家生产这样的:
海峡LR,[SP,# - 4]!
LDR R3,= __ imp___stoi
LDR R3,[R3]
MOV LR,PC
BX R3
LDR PC,[SP],#4
这code是调用一个辅助函数来执行转换。
Windows CE的编译器随Windows Compact 7的支持旧的调用约定(由MS称为CDECL)和EABI。见<一href=\"http://download.microsoft.com/download/2/4/A/24A36661-A629-4CE6-A615-6B2910A1367A/What%27s%20New%20in%20Platform%20Builder.pdf\">What's在新的平台生成器7 。
修改:刚才注意到你添加一个问题关于C ++。 Microsoft不会使用安腾风格的C ++ ABI,因为其实施predates它。你可以阅读有关微软在我OpenRCE执行的文章( 1 ,的2 )和后续侦察presentation 一>。又见从设计师扬灰原介绍: PDF
I couldn't find any documentation on the Windows RT on ARM calling convention used by Visual Studio C++. Is Microsoft using ARM's AAPCS?
If Microsoft is using the AAPCS/EABI for Windows RT on ARM, is it also using ARM's C++ ABI (which is derived from the Itanium C++ ABI)? Maybe even the ARM exception handling ABI?
Does the calling convention used by Windows RT on ARM differ from that used by other (embedded) ARM Windows variants?
Is there a reliable way to detect Windows RT on ARM through predefined compiler macros?
Update: Added the question regarding the C++ ABI.
Unlike Windows CE (which uses original APCS aka Old ABI), Windows RT on ARM uses EABI. More specifically, the variant which uses floating-point registers to pass floating-point data and 8-byte stack/argument alignment.
If I take the following function:
int g(float x) {
return x;
}
and compile it with VS2012's ARM compiler, I get the following assembly:
|g| PROC
vcvt.s32.f32 s0,s0
vmov r0,s0
bx lr
ENDP ; |g|
You can see that it's using S0
and not R0
for the argument.
The one from VS2008 (which can be used to target older Windows CE versions) produces this:
str lr, [sp,#-4]!
ldr r3, =__imp___stoi
ldr r3, [r3]
mov lr, pc
bx r3
ldr pc, [sp],#4
This code is calling a helper function to perform the conversion.
The Windows CE compiler shipped with Windows Compact 7 supports both the old calling convention (called "cdecl" by MS) and EABI. See What's New in Platform Builder 7.
EDIT: just now noticed you added a question about C++. Microsoft does not use Itanium-style C++ ABI, since their implementation predates it. You can read about Microsoft's implementation in my OpenRCE articles (1, 2) and the follow-up Recon presentation. See also the original description from the designer Jan Gray: PDF.
这篇关于什么是Windows RT ARM的原生code调用约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!