sar - Assembly sarl and idivl - interpreting -


I have a problem understanding the following assembly code. It would be great if you can give me an example with numbers That's how it looks behind the scenes.

  movl $ 0,% ecx movl $ 0,% ex addl $ 1,% ex movl% eax,% $ 31,% edx idivl $ 7 movl% edx,% eax movl (% Esp,% eax, 4),% eax movl% eax, (% esp,% ecx, 4)   

I think that I can not interpret serial and move because My result does not make sense ..

Thank you very much for your help !! I am sitting in front of that code for 3 hours; ^^

I think:

ecx = 0

eax = 0

eax = 0 + 1 = 1

edx = eax = 1

now ADX Transfer = & gt; Adx = 0

Now edx: eax is divided by 7?

Why can not I just set up AdX = 0 and leave Ciral? Will not this happen?

I just edx = 0 and leave sarl outside? Will not it be like this?

Not for a signed partition, which is ivive are following two instructions that CDQ does the instructions: movl% eax,% edx sarl $ 31,% edx

is it,

" sar operated is positive and operator is negative if the setting of empty bits keeps the signal of Source Operation clear by clearing the empty bit posts. "

and

" CDQ dictates a double-value mark in the EAX register in each bit position (bit 31) The CDQ command can be used to create a quadruped dividend from a double before the double division. " / Blockquote>

Note that sarl updates some status flag while the cdq does not, this New is movl + sarl as that would not be the same cdq . It is not clear from the question why the code does not use only cdq .

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -