calling-convention Questions

2

Solved

I have been recently doing a lot of x64 assembly programming (on Linux) for integration with my C/C++ programs. Since I am mostly concerned about efficiency I like to use as few different regs/mem...
Plaintiff asked 19/4, 2018 at 19:36

2

I am reading the IDA Pro Book. On page 86 while discussing calling conventions, the author shows an example of cdecl calling convention that eliminates the need for the caller to clean arguments of...
Hardback asked 27/3, 2018 at 13:6

1

Solved

I'm reading Intel manual about Stack Frames. It was noted that The end of the input argument area shall be aligned on a 16 (32, if __m256 is passed on stack) byte boundary. I don't quite und...

9

Solved

Why should default parameters be added last in C++ functions?
Oza asked 14/7, 2009 at 6:18

2

Solved

From Wikipedia: In computing, a red zone is a fixed-size area in a function's stack frame beyond the return address which is not preserved by that function. The callee function may use the red z...
Jackhammer asked 26/6, 2016 at 19:7

9

Solved

I've come across __stdcall a lot these days. MSDN doesn't explain very clearly what it really means, when and why should it be used, if at all. I would appreciate if someone would provide an expl...
Markman asked 20/8, 2009 at 14:3

1

Solved

There is that one question that troubles me. So ... Why in x86_32 the parameters are passed in registers that I feel are in alphabetically (eax, ecx, edx, esi) and ranked order (esi, edi, ebp) +-...
Buell asked 6/12, 2017 at 14:28

1

This question is specific to function calls, and is directed towards the trustworthiness of the Go optimizer when passing structs by value vs by pointer. If you're wondering when to use values vs...
Posting asked 8/12, 2016 at 1:58

1

Solved

Consider this code: #include <utility> #include <tuple> std::pair<int, int> f1() { return std::make_pair(0x111, 0x222); } std::tuple<int, int> f2() { return std::make_t...
Rectus asked 24/10, 2017 at 3:24

2

Each function in C must have a calling convention, but what is the calling convention for the main function (I think it is the cdecl calling convention but I am not sure)?
Sublet asked 15/8, 2017 at 16:50

6

Solved

There are different calling conventions available in C/C++: stdcall, extern, pascal, etc. How many such calling conventions are available, and what do each mean? Are there any links that describe t...
Nebo asked 4/6, 2009 at 11:0

2

Solved

For the following C code: struct _AStruct { int a; int b; float c; float d; int e; }; typedef struct _AStruct AStruct; AStruct test_callee5(); void test_caller5(); void test_caller5() { A...
Grane asked 8/2, 2011 at 9:3

2

Solved

I'm using gcc on Linux x86. My program exports a pointer to a C function to LLVM JIT functions. The calling convention is cdecl. It runs well on MingW on Windows. But strange things happens on linu...
Undine asked 20/12, 2015 at 10:22

2

Solved

Assuming the x86-64 ABI on Linux, under what conditions in C++ are structs passed to functions in registers vs. on the stack? Under what conditions are they returned in registers? And does the answ...
Colchester asked 23/2, 2017 at 9:35

1

Solved

The x86-64 SysV ABI specifies, among other things, how function parameters are passed in registers (first argument in rdi, then rsi and so on), and how integer return values are passed back (in rax...
Aggregation asked 7/11, 2016 at 22:33

2

I'd like to use a single (cross-)compiler to compile code for different ARM calling conventions: since I always want to use floating point and NEON instructions, I just want to select the hard-floa...
Cobos asked 21/3, 2014 at 14:45

1

I just started my assembly journey like recently, so obviously I'm a newbie, I've been writing fairly simple and basic programs and I just noticed something weird (to me). a program giving the cou...
Vie asked 31/10, 2016 at 14:37

4

Solved

I have a 3rd party C API that expects a __stdcall callback function. My code has an externally-provided __cdecl callback function. I cannot pass my function pointer to the C-API as they are consi...
Yokoyokohama asked 30/10, 2016 at 6:57

2

Solved

On x64, does each PUSH instruction push a multiple of 8 bytes? If not, how much does it push? Also, how much stack space does each function parameter consume?
Ponytail asked 28/10, 2016 at 13:18

1

How do the va_arg \ va_start \ va_list \ va_end macros work under the hood in x64? The calling convention in i386 passes parameters on the stack, hence the macro just increments some pointer that p...
Samaniego asked 24/10, 2016 at 10:29

1

Solved

I'm attempting to call a method from LLVM IR back to C++ code. I'm working in 64-bit Visual C++, or as LLVM describes it: Machine CPU: skylake Machine info: x86_64-pc-windows-msvc For integer ty...
Sedgewick asked 25/8, 2016 at 15:46

1

Solved

I was researching the calling convention of x86_64 that's used on OSX and was reading the section called "Aggregates and Unions" in the System V x86-64 ABI standard). It mention arrays and I figure...
Recrimination asked 6/8, 2016 at 2:33

1

Solved

I'm trying to output the same string twice in extended inline ASM in GCC, on 64-bit Linux. int main() { const char* test = "test\n"; asm( "movq %[test], %%rdi\n" // Debugger shows rdi = *addre...
Muldrow asked 28/5, 2016 at 19:5

1

Solved

We have a lot of VCL-based applications written in C++. All the VCL methods (under the __published class modifier require the __fastcall calling convention. However, for whatever reason, developers...
Mechanist asked 27/5, 2016 at 15:16

7

Solved

I'm learning about Win32 programming, and the WinMain prototype looks like: int WINAPI WinMain ( HINSTANCE instance, HINSTANCE prev_instance, PSTR cmd_line, int cmd_show ) I was confused as to w...
Frederickson asked 18/11, 2008 at 2:15

© 2022 - 2024 — McMap. All rights reserved.