#
# Push instructions
#
+add_group("push",
+ def_opersize_64=64,
+ opcode=[0x50],
+ operands=[Operand(type="Reg", size="BITS", dest="Op0Add")])
add_group("push",
suffix="w",
opersize=16,
operands=[Operand(type="Reg", size=32, dest="Op0Add")])
add_group("push",
suffix="q",
+ only64=True,
def_opersize_64=64,
opcode=[0x50],
operands=[Operand(type="Reg", size=64, dest="Op0Add")])
+
+add_group("push",
+ def_opersize_64=64,
+ opcode=[0xFF],
+ spare=6,
+ operands=[Operand(type="RM", size="BITS", dest="EA")])
add_group("push",
suffix="w",
opersize=16,
operands=[Operand(type="RM", size=32, dest="EA")])
add_group("push",
suffix="q",
+ only64=True,
def_opersize_64=64,
opcode=[0xFF],
spare=6,
operands=[Operand(type="RM", size=64, dest="EA")])
+
add_group("push",
cpu=["186"],
parsers=["nasm"],
#
# Pop instructions
#
+add_group("pop",
+ def_opersize_64=64,
+ opcode=[0x58],
+ operands=[Operand(type="Reg", size="BITS", dest="Op0Add")])
add_group("pop",
suffix="w",
opersize=16,
operands=[Operand(type="Reg", size=32, dest="Op0Add")])
add_group("pop",
suffix="q",
+ only64=True,
def_opersize_64=64,
opcode=[0x58],
operands=[Operand(type="Reg", size=64, dest="Op0Add")])
+
+add_group("pop",
+ def_opersize_64=64,
+ opcode=[0x8F],
+ operands=[Operand(type="RM", size="BITS", dest="EA")])
add_group("pop",
suffix="w",
opersize=16,
operands=[Operand(type="RM", size=32, dest="EA")])
add_group("pop",
suffix="q",
+ only64=True,
def_opersize_64=64,
opcode=[0x8F],
operands=[Operand(type="RM", size=64, dest="EA")])
+
# POP CS is debateably valid on the 8086, if obsolete and undocumented.
# We don't include it because it's VERY unlikely it will ever be used
# anywhere. If someone really wants it they can db 0x0F it.
EXTRA_DIST += modules/arch/x86/tests/gas32/gas-movdq32.hex
EXTRA_DIST += modules/arch/x86/tests/gas32/gas-movsd.asm
EXTRA_DIST += modules/arch/x86/tests/gas32/gas-movsd.hex
+EXTRA_DIST += modules/arch/x86/tests/gas32/gas-pop.asm
+EXTRA_DIST += modules/arch/x86/tests/gas32/gas-pop.hex
EXTRA_DIST += modules/arch/x86/tests/gas32/gas32-jmpcall.asm
EXTRA_DIST += modules/arch/x86/tests/gas32/gas32-jmpcall.hex
--- /dev/null
+.code64
+push %cx # out: 66 51
+pop %cx # out: 66 59
+push %rcx # out: 51
+pop %rcx # out: 59
+pushw %cx # out: 66 51
+popw %cx # out: 66 59
+pushq %rcx # out: 51
+popq %rcx # out: 59
+
+push -24(%rcx) # out: ff 71 e8
+pop -24(%rcx) # out: 8f 41 e8
+pushw -24(%rcx) # out: 66 ff 71 e8
+popw -24(%rcx) # out: 66 8f 41 e8
+pushq -24(%rcx) # out: ff 71 e8
+popq -24(%rcx) # out: 8f 41 e8
+
+.code32
+push %cx # out: 66 51
+pop %cx # out: 66 59
+push %ecx # out: 51
+pop %ecx # out: 59
+pushw %cx # out: 66 51
+popw %cx # out: 66 59
+pushl %ecx # out: 51
+popl %ecx # out: 59
+
+push -24(%ecx) # out: ff 71 e8
+pop -24(%ecx) # out: 8f 41 e8
+pushw -24(%ecx) # out: 66 ff 71 e8
+popw -24(%ecx) # out: 66 8f 41 e8
+pushl -24(%ecx) # out: ff 71 e8
+popl -24(%ecx) # out: 8f 41 e8
+
+.code16
+push %cx # out: 51
+pop %cx # out: 59
+push %ecx # out: 66 51
+pop %ecx # out: 66 59
+pushw %cx # out: 51
+popw %cx # out: 59
+pushl %ecx # out: 66 51
+popl %ecx # out: 66 59
+
+push -24(%bp) # out: ff 76 e8
+pop -24(%bp) # out: 8f 46 e8
+pushw -24(%bp) # out: ff 76 e8
+popw -24(%bp) # out: 8f 46 e8
+pushl -24(%bp) # out: 66 ff 76 e8
+popl -24(%bp) # out: 66 8f 46 e8