calling-convention

ARM assembly - access parameter vs return value?

谁说我不能喝 提交于 2019-12-11 16:35:08
问题 I have a function prototype int Palindrome(const char *c_style_string); In ARM v8 assembly, I believe that the parameter is stored in register w0. However, isn't this also the register that ret outputs the value of? If so, what do I need to do so that values do not get overwritten? I was thinking something like mov w0, w1 at the beginning of my code so that I refer to c_style_string as w1 whenever I parse through it, and then edit w0 to store an int...would this be right? Thank you! 回答1: You

Are rdi and rsi caller saved or callee saved registers?

不打扰是莪最后的温柔 提交于 2019-12-11 12:53:00
问题 From the wikipedia x86 calling convention, it says that for the Microsoft x64 calling convention: The registers RBX, RBP, RDI, RSI , RSP, R12, R13, R14, and R15 are considered nonvolatile (callee-saved). But for System V AMD64 ABI: If the callee wishes to use registers RBX, RBP, and R12–R15, it must restore their original values before returning control to the caller. It did not mention anything about rdi and rsi. I also read that %rax, %rcx, %rdx, %rdi, %rsi , %rsp, and %r8-r11 are

How do function calls work in x86 32-bit assembly on Linux?

a 夏天 提交于 2019-12-11 05:52:22
问题 I am learning GNU assembly from Jonathan Bartlett's "Programming from ground up" book. While going through the topic of a function call and stack, I'm unable to understand its working. Below is what's written in the book: Before executing a function, a program pushes all of the parameters for the function onto the stack in the reverse order that they are documented. Then the program issues a call instruction indicating which function it wishes to start. The call instruction does two things.

How C structures get passed to function in assembly?

左心房为你撑大大i 提交于 2019-12-11 03:05:03
问题 1)How C structures get passed to function in assembly. I mean pass by value, not pass by reference. 2)By the way, how callees return structure to its callers? I'm so sorry for the poor expression since I'm not a native English speaker. I wrote a simple program to testify how C structures get passed to function. But the result was quite surpirsed. Some value was passed by register, but some value was passed by pushing them into stack. Here is the code. source code #include <stdio.h> typedef

What is the Windows RT on ARM native code calling convention?

我们两清 提交于 2019-12-10 17:27:34
问题 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

Pass a Delphi class to a C++ function/method that expects a class with __thiscall methods

删除回忆录丶 提交于 2019-12-10 13:26:06
问题 I have some MSVC++ compiled DLL's for which I have created COM-like (lite) interfaces (abstract Delphi classes). Some of those classes have methods that need pointers to objects. These C++ methods are declared with the __thiscall calling convention (which I cannot change ), which is just like __stdcall, except a this pointer is passed on the ECX register. I create the class instance in Delphi, then pass it on to the C++ method. I can set breakpoints in Delphi and see it hitting the exposed _

Why are the temporary registers split in the MIPS ISA? [closed]

时间秒杀一切 提交于 2019-12-10 10:23:17
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last month . I'm currently taking a class that covers the MIPS ISA and one thing that I noticed is the split in temporary registers: Temporary registers $t0 to $t7 are stored in $8 to $15 , but $t8 and $t9 are stored in $24 and $25 . Why is this? Why not make the temporary registers

__cdecl and __declspec calling conventions confusion

送分小仙女□ 提交于 2019-12-09 17:29:47
问题 I am writing a DLL for a third party application. The main software engineer mentions that the application uses the __cdecl (/Gd) calling convention. That I need to make sure that I use that. Additionally, the third party has provided to me a C++ DLL skeleton which exports the functions as follows: #ifdef _EXPORTING #define DECLSPEC __declspec(dllexport) #else #define DECLSPEC __declspec(dllimport) #endif #ifdef __cplusplus extern "C" { #endif DECLSPEC int ICD_Create(char* id); .... .... I am

What are custom calling conventions?

喜你入骨 提交于 2019-12-08 19:30:09
问题 What are these? And how am I affected by these as a developer? Related: What are the different calling conventions in C/C++ and what do each mean? 回答1: A calling convention describes how something may call another function. This requires parameters and state to be passed to the other function, so that it can execute and return control correctly. The way in which this is done has to be standardized and specified, so that the compiler knows how to order parameters for consumption by the remote

What are the differences between C, and C++ calling conventions?

耗尽温柔 提交于 2019-12-08 17:24:19
问题 As I know, the calling convention is compiler and architecture dependent. But are there any clear differences between C and C++ calling conventions? 回答1: But are there any clear differences between C and C++ calling conventions? In general, there’s none. C++ was intentionally designed to be as much as possible compatible with C, and in particular it uses the C application binary interface on all systems. But the C ABI doesn’t cater for a lot of features that C++ needs (in particular,