Add Cpuid instruction + test in assembler

This commit is contained in:
Clement Rouault
2015-09-17 11:10:01 +02:00
parent 8330027b8b
commit 8ec269bef6
4 changed files with 9 additions and 0 deletions
+3
View File
@@ -616,6 +616,9 @@ class In(Instruction):
(RawBits.from_int(16, 0x66ed), FixedRegister('AX'), FixedRegister('DX')), # Fuck-it hardcoded prefix for now
(RawBits.from_int(8, 0xed), FixedRegister('EAX'), FixedRegister('DX'))]
class Cpuid(Instruction):
encoding = [(RawBits.from_int(16, 0x0fa2),)]
class JmpImm(object):
accept_as_Ximmediat = (None)
def __init__(self, sub):
+3
View File
@@ -511,6 +511,9 @@ class Xchg(Instruction):
class Call(Instruction):
encoding = [(RawBits.from_int(8, 0xff), Slash(2))]
class Cpuid(Instruction):
encoding = [(RawBits.from_int(16, 0x0fa2),)]
class Ret(Instruction):
encoding = [(RawBits.from_int(8, 0xc3),)]
+2
View File
@@ -96,6 +96,8 @@ TestInstr(Push)(0x42)
TestInstr(Push)(-1)
TestInstr(Call)('RAX')
TestInstr(Call)(mem('[RAX + RCX * 8]'))
TestInstr(Cpuid)()
TestInstr(Xchg)('RAX', 'RSP')
assert Xchg('RAX', 'RCX').get_code() == Xchg('RCX', 'RAX').get_code()
+1
View File
@@ -82,6 +82,7 @@ TestInstr(Lea)('ECX', mem('[EDI + -0xff]'))
TestInstr(Call)('EAX')
TestInstr(Call)(mem('[EAX + ECX * 8]'))
TestInstr(Cpuid)()
TestInstr(Xchg)('EAX', 'ESP')
assert Xchg('EAX', 'ECX').get_code() == Xchg('ECX', 'EAX').get_code()