mirror of
https://github.com/hakril/PythonForWindows
synced 2026-06-08 14:31:45 +00:00
Add Cpuid instruction + test in assembler
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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),)]
|
||||
|
||||
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user