Skip to main content
Filter by
Sorted by
Tagged with
9 votes
2 answers
87 views

Why is the AL field (FP register usage count) necessary in the SysV ABI?

I was going through the System V AMD64 ABI and couldn’t find a clear explanation for why the AL field (which tracks how many floating-point registers are used) is necessary. From my understanding, ...
OODAX's user avatar
  • 149
1 vote
0 answers
57 views

RISC-V a1 register assumptions after ecall execution

As explained here it's clear to me that user-space calling conventions don't apply when dealing with kernel-space system call execution, so basically no register is clobbered after an ecall ...
SilenceDesigner's user avatar
1 vote
1 answer
114 views

What are the proper conventions for x64 assembly functions on Windows?

I've been messing around with assembly and compilers & have gotten a lot of conflicting information in how I should be using registers, the stack / spill over registers, and to what extent ...
Dak's user avatar
  • 51
1 vote
1 answer
104 views

Do RISC-V kernel-space calling conventions exist?

RISC-V user-space function calls calling conventions are clear to me. It's also clear that a0-a5 are used to pass arguments to kernel and a7 to store system call number before an ecall. What I can't ...
SilenceDesigner's user avatar
1 vote
1 answer
150 views

In a release build by GCC, i.e., without -g flag, why function frame is missed in backtrace of GDB?

It's a follow up question of In a release build by GCC, i.e., without -g flag, is register info trustable?, thanks for the answer of it, I now understand that the registers designated for function ...
PkDrew's user avatar
  • 2,657
3 votes
1 answer
144 views

Why does MSVC x64 C use 8-byte int32 parameter alignment instead of 4-byte?

I'm writing a C compiler as a hobby and would like it to be able to link against C static libraries produced by MSVC. I read the Microsoft x64 ABI, and it doesn't seem to have a strongly mandated ...
knutaf's user avatar
  • 113
2 votes
1 answer
111 views

68000 Assembly - Passing Parameters via Stack in a Sorting Routine

I'm implementing a sorting algorithm in 68000 assembly and decided to use the stack to pass parameters to a subroutine that swaps two elements in an array. I want to make sure I'm handling the stack ...
Pato's user avatar
  • 1
2 votes
1 answer
103 views

Forwarding variadic arguments in Windows x64 assembly

I have a function that itself needs two arguments and forwards the rest to another function. I'm using the fastcall convention. I have tried this: forward: push r14 # r14 and r13 will store ...
 sentientbottleofwine's user avatar
0 votes
1 answer
115 views

Is it possible to emulate a member function call context for a functor scope across dynamic libraries?

Given a simple Api object: // api.h struct Api { int foo(int c); int bar(int a, int b); }; It could be used in the following formats: // api users struct InApi : Api { int memfoo() { ...
dtech's user avatar
  • 49.4k
4 votes
1 answer
68 views

Where is the offset of the Y register from the call/stack frame in avr-gcc coming from?

On the avr-gcc website (https://gcc.gnu.org/wiki/avr-gcc#Frame_Layout) it says that the frame pointer (Y register) is off by one byte so Y+1 points to the bottom of the frame. However when I compiled ...
golden bananas's user avatar
1 vote
1 answer
87 views

How does the change in the number of member variables of a callable class map to the assembly of a function calling it?

Consider this TU: struct Foo { int operator()(int) const; }; int foo(Foo b) { return b(17); } It will compile to: foo(Foo): sub rsp, 24 mov esi, 17 lea rdi, [rsp+15] call Foo::...
Enlico's user avatar
  • 29.9k
2 votes
1 answer
143 views

Does the C runtime clear the home slots of args prior to function calls?

When you call a function from C/C++, that has some params smaller than 64bits, does the runtime zero out the stack memory at the home location of those params? Or does the top of each param contain ...
Dess's user avatar
  • 2,755
8 votes
1 answer
408 views

Why modern calling conventions pass variadic arguments in registers?

If we look at a few modern calling conventions, like x86-64 SysV style or AArch64 style (document aapcs64.pdf titled "Procedure Call Standard for the Arm® 64-bit Architecture"), we see ...
Netch's user avatar
  • 4,622
1 vote
0 answers
53 views

save return value sinl function

My problem is that I don't understand what starts happening in the stack from line 27. <br(The code is compiled on godbolt.org) <br<br<br Below I will give part of the code in assembler ...
Anastasia's user avatar
1 vote
1 answer
66 views

Return values and parametery in assembly

I‘ve never had a problem with assembly itself. My only problem is that I dont understand how arguments are passed in functions and how they are returned. Let‘s say PUBLIC AddNumber AddNumber PROC ...
trapstar's user avatar

15 30 50 per page
1
2 3 4 5
74