Domanda

Va bene, quindi ho a che fare con il seguente frammento di codice:

push   %ebp
mov    %esp,%ebp   
push   %ebx
mov    0x8(%ebp),%eax 
movzwl %ax,%edx

Quindi, questo si comporta come previsto quando si tratta di valori positivi. Il valore copiato in% edx è il trascinamento 16 bit di% eax (o% ax).

Tuttavia, se si mette un numero negativo in, tutto comincia a diventare strano e non sembra essere comportarsi come previsto.

Ad esempio, se il valore di% eax -67.043.552, allora il valore copiato in% edx è 65312.

Sono abbastanza nuovo per il montaggio, mi dispiace se questo è un errore di interpretazione evidente da parte mia. Qualsiasi aiuto sarebbe molto apprezzato.

È stato utile?

Soluzione

Remember that movzwl copies only the bits in %ax into %edx filling in the high 16 bits of %edx with zeros.

So %edx always ends up with a positive number less than or equal to 65535.

In detail: -67043552 in hex is fc00ff20. So if that is in %eax, then %ax contains ff20. If you move that into %edx with zero-extension, then %edx gets 0000ff20. That's 65312.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top