你的职能对我来说是很困难的。 www.un.org/Depts/DGACM/index_spanish.htm
_mydiv:
xor %rdx, %rdx ; clear high bits of dividend
mov %rdi, %rax ; copy dividend argument into rax
idiv %rsi ; divide by divisor argument
ret ; return (quotient is in rax)
Translated into NASM syntax and to the windows ABI, I think that would be something like:
_mydiv:
mov r8, rdx ; copy divisor argument to scratch register
xor rdx, rdx ; clear high bits of dividend
mov rax, rcx ; copy dividend argument into rax
idiv r8 ; divide by divisor in scratch register
ret ; return (quotient is in rax)
您的参数是否一致,如何混淆一些东西?
Edit: looking at your code, it occurs to me that it might not be written as a proper function at all. The important steps are:
- Put dividend in RDX:RAX - for you that probably means clearing out RDX and putting the input dividend in RAX.
- Put divisor in some other register - you chose RCX, that should be fine.
- Divide -
idiv rcx
.
- Result will be in RAX.
You should pay particular attention to step 1 - make sure that RDX:RAX has sane contents! Why you re getting a floating point exception I can t guess from the code you ve shown.