You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a look at the [exercise]_test.c file, you'll see a function declaration at the top of the file. This is the function that you'll have to implement in assembly.
In this case it takes no parameters (void), and returns a const char *.
In assembly, function arguments are passed in registers. Which registers depend on the ABI. For this track, we use the System V ABI. The register usage can be found on page 21 in https://uclibc.org/docs/psABI-x86_64.pdf.
So, the arguments are passed in the following order: rdi, rsi, rdx, rcx, r8, and r9. And the return value is passed in the rax register.
Let's use a simple example, a function taking two integers and returning an integer: int fn(int a, int b);
If the test calls this function with fn(1, 2);, you'll find the integer 1 in the rdi register, and the integer 2 in the rsi register. To return the integer 5 you would move it into the rax register, e.g., mov rax, 5.
I hope this answers your question, let me know if anything is unclear.
i don't seem to find anyway to get the input from the tests that are taken.
The text was updated successfully, but these errors were encountered: