我试图理解这段代码,以便将其转换为 y86 程序集。有人可以回答括号里写的问题吗?
/* This function copy_block - Copy src to dest and return xor checksum of src */
long copy_block(long *src, long *dest, long len) //(first two input arguments will be stored in %RDI and %RSI where will the be third argument stored?)
{
long result = 0;
while (len > 0) {
long val = *src++; //(is this dereferencing first and then adding or opposite?)
*dest++ = val; //(what is this line doing?)
result ^= val; //(what is checksum and why are we XORing val with sum of previous XORed values?)
len--;
}
return result;
}
样本输入
.align 8
# Source block
src:
.quad 0x00a
.quad 0x0b0
.quad 0xc00
# Destination block
dest:
.quad 0x111 #(why are there three sources and just one dest?)