我想从我的C ++ code到大会通过以上四个参数。
I am trying to pass more than four parameters from my C++ code to Assembly.
C ++函数如下:
static float armFunction(float, float, float, float, float);
我可以检索从寄存器R0-R3的前四个参数没有任何问题。
I can retrieve the first four parameters from the registers r0-r3 without any problem.
我希望我的第五个浮点参数是在栈上,我应该能够使用堆栈指针SP例如进行访问我尝试加载我的R4像第五个参数:
I expect that my fifth float argument is on the stack and i should be able to access it using the stack pointer sp e.g. I try to load my fifth argument in r4 like :
ldr r4, [sp]
甚至是:
ldr r4, [sp, #-0x4]
但是,这并不工作,并装配code立即用一些堆栈损坏输出退出。
But this doesn't work and the assembly code immediately exits with some stack corruption output.
我的完整的装配code看起来像这样在这里: http://pastie.org/3933875
My complete assembly code looks like this here: http://pastie.org/3933875
我的ASM code毫不费力地从JNI调用读第5个参数从C到ASM。这是前两行我ASM功能:
My asm code has no trouble reading the 5th parameter from a JNI call from C to asm. Here are the first 2 lines of my asm function:
stmfd sp!,{r4-r12,lr}
ldr r12,[sp,#40] @ first stack variable
在那里你不需要为preserve任何登记的情况下,第五个参数是堆栈的顶部:
In the case where you're not needing to preserve any registers, the 5th parameter is on the top of the stack:
ldr r12,[sp]
上一篇:为什么没有得到执行while循环之后的语句?语句、while
下一篇:如何让所有的BroadcastReceiver(S)注册了一个特定意图的名单?有的、意图、名单、BroadcastReceiver