mirror of
https://github.com/qilingframework/qiling.git
synced 2026-10-12 02:21:40 +00:00
@@ -184,6 +184,7 @@ class QlGdb(QlDebugger):
|
||||
from unicorn.arm64_const import UC_ARM64_REG_X29
|
||||
from unicorn.mips_const import UC_MIPS_REG_INVALID
|
||||
from unicorn.ppc_const import UC_PPC_REG_31
|
||||
from unicorn.riscv_const import UC_RISCV_REG_S0
|
||||
|
||||
arch_uc_bp = {
|
||||
QL_ARCH.X86 : UC_X86_REG_EBP,
|
||||
@@ -193,7 +194,9 @@ class QlGdb(QlDebugger):
|
||||
QL_ARCH.MIPS : UC_MIPS_REG_INVALID, # skipped
|
||||
QL_ARCH.A8086 : UC_X86_REG_EBP,
|
||||
QL_ARCH.CORTEX_M : UC_ARM_REG_R11,
|
||||
QL_ARCH.PPC : UC_PPC_REG_31
|
||||
QL_ARCH.PPC : UC_PPC_REG_31,
|
||||
QL_ARCH.RISCV : UC_RISCV_REG_S0,
|
||||
QL_ARCH.RISCV64 : UC_RISCV_REG_S0
|
||||
}[self.ql.arch.type]
|
||||
|
||||
def __get_reg_idx(ucreg: int) -> int:
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- Register numbers are hard-coded in order to maintain backward
|
||||
compatibility with older versions of tools that didn't use xml
|
||||
register descriptions. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.riscv.cpu">
|
||||
<reg name="zero" bitsize="32" type="int" regnum="0"/>
|
||||
<reg name="ra" bitsize="32" type="code_ptr"/>
|
||||
<reg name="sp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="gp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="tp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="t0" bitsize="32" type="int"/>
|
||||
<reg name="t1" bitsize="32" type="int"/>
|
||||
<reg name="t2" bitsize="32" type="int"/>
|
||||
<reg name="fp" bitsize="32" type="data_ptr"/>
|
||||
<reg name="s1" bitsize="32" type="int"/>
|
||||
<reg name="a0" bitsize="32" type="int"/>
|
||||
<reg name="a1" bitsize="32" type="int"/>
|
||||
<reg name="a2" bitsize="32" type="int"/>
|
||||
<reg name="a3" bitsize="32" type="int"/>
|
||||
<reg name="a4" bitsize="32" type="int"/>
|
||||
<reg name="a5" bitsize="32" type="int"/>
|
||||
<reg name="a6" bitsize="32" type="int"/>
|
||||
<reg name="a7" bitsize="32" type="int"/>
|
||||
<reg name="s2" bitsize="32" type="int"/>
|
||||
<reg name="s3" bitsize="32" type="int"/>
|
||||
<reg name="s4" bitsize="32" type="int"/>
|
||||
<reg name="s5" bitsize="32" type="int"/>
|
||||
<reg name="s6" bitsize="32" type="int"/>
|
||||
<reg name="s7" bitsize="32" type="int"/>
|
||||
<reg name="s8" bitsize="32" type="int"/>
|
||||
<reg name="s9" bitsize="32" type="int"/>
|
||||
<reg name="s10" bitsize="32" type="int"/>
|
||||
<reg name="s11" bitsize="32" type="int"/>
|
||||
<reg name="t3" bitsize="32" type="int"/>
|
||||
<reg name="t4" bitsize="32" type="int"/>
|
||||
<reg name="t5" bitsize="32" type="int"/>
|
||||
<reg name="t6" bitsize="32" type="int"/>
|
||||
<reg name="pc" bitsize="32" type="code_ptr"/>
|
||||
</feature>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- Register numbers are hard-coded in order to maintain backward
|
||||
compatibility with older versions of tools that didn't use xml
|
||||
register descriptions. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.riscv.fpu">
|
||||
|
||||
<union id="riscv_double">
|
||||
<field name="float" type="ieee_single"/>
|
||||
<field name="double" type="ieee_double"/>
|
||||
</union>
|
||||
|
||||
<reg name="ft0" bitsize="64" type="riscv_double" regnum="33"/>
|
||||
<reg name="ft1" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft2" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft3" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft4" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft5" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft6" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft7" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs0" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs1" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa0" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa1" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa2" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa3" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa4" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa5" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa6" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa7" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs2" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs3" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs4" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs5" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs6" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs7" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs8" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs9" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs10" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs11" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft8" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft9" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft10" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft11" bitsize="64" type="riscv_double"/>
|
||||
|
||||
<reg name="fcsr" bitsize="32" type="int" regnum="68"/>
|
||||
</feature>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<target xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<architecture>riscv:rv32</architecture>
|
||||
<osabi>GNU/Linux</osabi>
|
||||
|
||||
<xi:include href="riscv-core.xml"/>
|
||||
<xi:include href="riscv-fpu.xml"/>
|
||||
</target>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- Register numbers are hard-coded in order to maintain backward
|
||||
compatibility with older versions of tools that didn't use xml
|
||||
register descriptions. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.riscv.cpu">
|
||||
<reg name="zero" bitsize="64" type="int" regnum="0"/>
|
||||
<reg name="ra" bitsize="64" type="code_ptr"/>
|
||||
<reg name="sp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="gp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="tp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="t0" bitsize="64" type="int"/>
|
||||
<reg name="t1" bitsize="64" type="int"/>
|
||||
<reg name="t2" bitsize="64" type="int"/>
|
||||
<reg name="fp" bitsize="64" type="data_ptr"/>
|
||||
<reg name="s1" bitsize="64" type="int"/>
|
||||
<reg name="a0" bitsize="64" type="int"/>
|
||||
<reg name="a1" bitsize="64" type="int"/>
|
||||
<reg name="a2" bitsize="64" type="int"/>
|
||||
<reg name="a3" bitsize="64" type="int"/>
|
||||
<reg name="a4" bitsize="64" type="int"/>
|
||||
<reg name="a5" bitsize="64" type="int"/>
|
||||
<reg name="a6" bitsize="64" type="int"/>
|
||||
<reg name="a7" bitsize="64" type="int"/>
|
||||
<reg name="s2" bitsize="64" type="int"/>
|
||||
<reg name="s3" bitsize="64" type="int"/>
|
||||
<reg name="s4" bitsize="64" type="int"/>
|
||||
<reg name="s5" bitsize="64" type="int"/>
|
||||
<reg name="s6" bitsize="64" type="int"/>
|
||||
<reg name="s7" bitsize="64" type="int"/>
|
||||
<reg name="s8" bitsize="64" type="int"/>
|
||||
<reg name="s9" bitsize="64" type="int"/>
|
||||
<reg name="s10" bitsize="64" type="int"/>
|
||||
<reg name="s11" bitsize="64" type="int"/>
|
||||
<reg name="t3" bitsize="64" type="int"/>
|
||||
<reg name="t4" bitsize="64" type="int"/>
|
||||
<reg name="t5" bitsize="64" type="int"/>
|
||||
<reg name="t6" bitsize="64" type="int"/>
|
||||
<reg name="pc" bitsize="64" type="code_ptr"/>
|
||||
</feature>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!-- Register numbers are hard-coded in order to maintain backward
|
||||
compatibility with older versions of tools that didn't use xml
|
||||
register descriptions. -->
|
||||
|
||||
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
|
||||
<feature name="org.gnu.gdb.riscv.fpu">
|
||||
|
||||
<union id="riscv_double">
|
||||
<field name="float" type="ieee_single"/>
|
||||
<field name="double" type="ieee_double"/>
|
||||
</union>
|
||||
|
||||
<reg name="ft0" bitsize="64" type="riscv_double" regnum="33"/>
|
||||
<reg name="ft1" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft2" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft3" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft4" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft5" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft6" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft7" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs0" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs1" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa0" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa1" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa2" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa3" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa4" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa5" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa6" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fa7" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs2" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs3" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs4" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs5" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs6" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs7" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs8" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs9" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs10" bitsize="64" type="riscv_double"/>
|
||||
<reg name="fs11" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft8" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft9" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft10" bitsize="64" type="riscv_double"/>
|
||||
<reg name="ft11" bitsize="64" type="riscv_double"/>
|
||||
|
||||
<reg name="fcsr" bitsize="32" type="int" regnum="68"/>
|
||||
</feature>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Copyright (C) 2018-2025 Free Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. -->
|
||||
|
||||
<!DOCTYPE target SYSTEM "gdb-target.dtd">
|
||||
<target xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<architecture>riscv:rv64</architecture>
|
||||
<osabi>GNU/Linux</osabi>
|
||||
|
||||
<xi:include href="riscv64-core.xml"/>
|
||||
<xi:include href="riscv64-fpu.xml"/>
|
||||
</target>
|
||||
@@ -42,6 +42,12 @@ from qiling.arch.ppc_const import (
|
||||
reg_map as ppc_regs
|
||||
)
|
||||
|
||||
from qiling.arch.riscv_const import (
|
||||
reg_csr_map as riscv_regs_csr,
|
||||
reg_float_map as riscv_regs_float,
|
||||
reg_map as riscv_regs
|
||||
)
|
||||
|
||||
from qiling.const import QL_ARCH, QL_OS
|
||||
|
||||
RegEntry = Tuple[Optional[int], int, int]
|
||||
@@ -147,7 +153,9 @@ class QlGdbFeatures:
|
||||
QL_ARCH.CORTEX_M: dict(**cortex_m_regs),
|
||||
QL_ARCH.ARM64: dict(**arm64_regs, **arm64_regs_v, **arm64_reg_map_fp),
|
||||
QL_ARCH.MIPS: dict(**mips_regs_gpr),
|
||||
QL_ARCH.PPC: dict(**ppc_regs)
|
||||
QL_ARCH.PPC: dict(**ppc_regs),
|
||||
QL_ARCH.RISCV: dict(**riscv_regs, **riscv_regs_float, **riscv_regs_csr),
|
||||
QL_ARCH.RISCV64: dict(**riscv_regs, **riscv_regs_float, **riscv_regs_csr)
|
||||
}[archtype]
|
||||
|
||||
regsinfo = sorted(QlGdbFeatures.__walk_xml_regs(xmltree))
|
||||
|
||||
Reference in New Issue
Block a user