Skip to content

Commit 964fc35

Browse files
committed
Clean up
1 parent 7258e4c commit 964fc35

File tree

3 files changed

+2
-37
lines changed

3 files changed

+2
-37
lines changed

qiling/arch/arm_const.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55

66
from unicorn.arm_const import *
7-
from enum import IntEnum
87

98
reg_map = {
109
"r0": UC_ARM_REG_R0,

qiling/arch/x86.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
#
55

66
from functools import cached_property
7-
from typing import Union
87

98
from unicorn import Uc, UC_ARCH_X86, UC_MODE_16, UC_MODE_32, UC_MODE_64
109
from capstone import Cs, CS_ARCH_X86, CS_MODE_16, CS_MODE_32, CS_MODE_64
1110
from keystone import Ks, KS_ARCH_X86, KS_MODE_16, KS_MODE_32, KS_MODE_64
1211

13-
from unicorn.x86_const import UC_X86_REG_EFLAGS
14-
1512
from qiling.arch.arch import QlArch
1613
from qiling.arch.msr import QlMsrManager
1714
from qiling.arch.register import QlRegisterManager
@@ -126,33 +123,3 @@ def disassembler(self) -> Cs:
126123
@cached_property
127124
def assembler(self) -> Ks:
128125
return Ks(KS_ARCH_X86, KS_MODE_64)
129-
130-
# TODO: generalize this
131-
def __reg_bits(self, register: int) -> int:
132-
# all regs in reg_map_misc are 16 bits except of eflags
133-
if register == UC_X86_REG_EFLAGS:
134-
return 32
135-
136-
regmaps = (
137-
(x86_const.reg_map_8, 8),
138-
(x86_const.reg_map_16, 16),
139-
(x86_const.reg_map_32, 32),
140-
(x86_const.reg_map_64, 64),
141-
(x86_const.reg_map_misc, 16),
142-
(x86_const.reg_map_cr, 64), # 32 bits for x86
143-
(x86_const.reg_map_st, 32),
144-
(x86_const.reg_map_seg_base, 64), # 32 bits for x86
145-
)
146-
147-
return next((rsize for rmap, rsize in regmaps if register in rmap.values()), 0)
148-
149-
# note: this method was not generalized for all archs since it requires a bookkeeping
150-
# of all registers, while it is used only by gdb and only for x86-64
151-
def reg_bits(self, reg: Union[str, int]) -> int:
152-
"""Get register size in bits.
153-
"""
154-
155-
if type(reg) is str:
156-
reg = self.regs.register_mapping[reg]
157-
158-
return self.__reg_bits(reg)

qiling/const.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ class QL_STOP(Flag):
6060

6161
QL_ARCH_INTERPRETER = (QL_ARCH.EVM,)
6262

63-
QL_OS_NONPID = (QL_OS.DOS, QL_OS.UEFI)
64-
QL_OS_POSIX = (QL_OS.LINUX, QL_OS.FREEBSD, QL_OS.MACOS, QL_OS.QNX)
65-
QL_OS_BAREMETAL = (QL_OS.MCU,)
63+
QL_OS_POSIX = (QL_OS.LINUX, QL_OS.FREEBSD, QL_OS.MACOS, QL_OS.QNX)
64+
QL_OS_BAREMETAL = (QL_OS.MCU,)
6665

6766
QL_HOOK_BLOCK = 0b0001
6867
QL_CALL_BLOCK = 0b0010

0 commit comments

Comments
 (0)