【发布时间】:2022-12-02 10:12:11
【问题描述】:
global mymul
mymul:
mov rax, rdi
mul rsi
ret
#include <stdio.h>
typedef struct {
unsigned long long high;
unsigned long long low;
} resmul;
void mymul(unsigned long long, unsigned long long, resmul *res);
int main() {
resmul res;
mymul(3, 6, &res);
printf("mymul(3, 6); res.high=0x%llx, res.low=0x%llx\n", res.high, res.low);
//mymul(3, 6); res.high=0x0, res.low=0x12
return 0;
}
the goal is to multiply first arg with the second and send to result to the last arg first arg = RDI / second arg = RSI goal to send result high/low to typestruct
I dont understand why it gives 0 to both results RAX and RDX should be returned but i doesnt
【问题讨论】:
标签: assembly x86-64 nasm calling-convention int128