Stichting-MINIX-Research-Foundation / minix

Official MINIX sources - Automatically replicated from gerrit.minix3.org
Other
2.99k stars 969 forks source link

Question regarding function cvu64 in minix3.1 #347

Open LeoHaveFun123 opened 1 year ago

LeoHaveFun123 commented 1 year ago

I am not sure if this is the correct place to ask this question, I am reading minix3 source code these days but I cannot understand the asm code of this function. The original code is as below, this function is used to covert the input 32bit unsigned value to 64 bit.

_cvu64: ! u64_t cvu64(unsigned i); _cvul64: ! u64_t cvul64(unsigned long i); mov eax, 4(esp) !this line is saving input paramter to eax, which is i mov edx, 8(esp) !this line saves something above i which is something unknown on caller stackframe? Why??? mov (eax), edx !move unknown value to address pointed by i?? mov 4(eax), 0
ret

I have added my understanding in above comments, I may have made mistakes but I dont know how. Thanks for any help in advance.