33# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
44
55from unicorn .x86_const import (
6- UC_X86_REG_AX , UC_X86_REG_EAX , UC_X86_REG_RAX , UC_X86_REG_RCX ,
7- UC_X86_REG_RDI , UC_X86_REG_RDX , UC_X86_REG_RSI , UC_X86_REG_R8 ,
8- UC_X86_REG_R9 , UC_X86_REG_R10
6+ UC_X86_REG_EAX , UC_X86_REG_RAX , UC_X86_REG_RCX , UC_X86_REG_RDI ,
7+ UC_X86_REG_RDX , UC_X86_REG_RSI , UC_X86_REG_R8 , UC_X86_REG_R9 ,
8+ UC_X86_REG_R10
99)
1010
11- from qiling .arch .arch import QlArch
1211from qiling .cc import QlCommonBaseCC
1312
1413class QlIntelBaseCC (QlCommonBaseCC ):
1514 """Calling convention base class for Intel-based systems.
1615 Supports arguments passing over registers and stack.
1716 """
1817
19- def __init__ (self , arch : QlArch ):
20- retreg = {
21- 16 : UC_X86_REG_AX ,
22- 32 : UC_X86_REG_EAX ,
23- 64 : UC_X86_REG_RAX
24- }[arch .bits ]
25-
26- super ().__init__ (arch , retreg )
27-
2818 def setReturnAddress (self , addr : int ) -> None :
2919 self .arch .stack_push (addr )
3020
@@ -36,6 +26,8 @@ class QlIntel64(QlIntelBaseCC):
3626 """Calling convention base class for Intel-based 64-bit systems.
3727 """
3828
29+ _retreg = UC_X86_REG_RAX
30+
3931 @staticmethod
4032 def getNumSlots (argbits : int ) -> int :
4133 return max (argbits , 64 ) // 64
@@ -44,6 +36,8 @@ class QlIntel32(QlIntelBaseCC):
4436 """Calling convention base class for Intel-based 32-bit systems.
4537 """
4638
39+ _retreg = UC_X86_REG_EAX
40+
4741 @staticmethod
4842 def getNumSlots (argbits : int ) -> int :
4943 return max (argbits , 32 ) // 32
0 commit comments