本文介绍了推XMM寄存器到堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有推到堆栈从XMM寄存器一个压缩双整数的方法吗?然后在需要时以后弹出回来?

完美的我正在寻找像PUSH或POP的通用寄存器,我已经检查了英特尔的手册,但我要么错过了命令或没有一个...

或将我必须解压值通用寄存器,然后把他们?



在此先感谢!

根据GJ的答案是这样的解决方案:

 子EBP,16
MOVDQU xmmword PTR [EBP],xmm6
MOVDQU XMM4,xmmword PTR [EBP]


解决方案

没有,有没有这样的下一个x86的指令汇编,但你可以这样做:

  //推XMM0
子尤,16
MOVDQU dqword [ESP],XMM0//流行XMM0
MOVDQU XMM0,dqword [ESP]
ADD ESP,16

编辑:

上code样品是直接推/流行仿真。

在您正在使用的堆栈还有其他的局部变量,比 EBP 寄存器必须在第一次的情况下正确设置,如:

 推EBP
MOV EBP,ESP
子ESP,LocaStackVariablesSize
// ...您code
MOV ESP,EBP
流行EBP
RET

在这种情况下,你也可以用丹尼尔斯的解决方案!

Is there a way of pushing a packed doubleword integer from XMM register to the stack? and then later on pop it back when needed?
Perfectly I am looking for something like PUSH or POP for general purpose registers, I have checked Intel manuals but I either missed the command or there isn't one...
Or will I have to unpack values to general registers and then push them?

Thanks in advance!

Based on GJ answer that was the solution:

sub ebp, 16
movdqu xmmword ptr [ebp], xmm6
movdqu xmm4, xmmword ptr[ebp]
解决方案

No, there is no such a asm instruction under x86, but you can do something like:

//Push xmm0
sub     esp, 16
movdqu  dqword [esp], xmm0

//Pop xmm0
movdqu  xmm0, dqword [esp]
add     esp, 16

EDIT:

Upper code sample is direct push/pop emulation.

In case that you are using on stack also other local variables, than the ebp register must be at first properly set, like:

push ebp
mov  ebp, esp
sub  esp, LocaStackVariablesSize
//... your code
mov  esp, ebp
pop  ebp
ret

In that case you can also use Daniels solution!

这篇关于推XMM寄存器到堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 16:22