File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed
Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,14 @@ class QlArchRISCV(QlArch):
1717 def __init__ (self , ql : Qiling ):
1818 super ().__init__ (ql )
1919
20- self .ql .reg .expand_mapping (reg_map )
20+ reg_maps = (
21+ reg_map ,
22+ reg_csr_map ,
23+ reg_float_map ,
24+ )
25+
26+ for reg_maper in reg_maps :
27+ self .ql .reg .expand_mapping (reg_maper )
2128 self .ql .reg .register_sp (reg_map ["sp" ])
2229 self .ql .reg .register_pc (reg_map ["pc" ])
2330
@@ -34,3 +41,6 @@ def create_disassembler(self) -> Cs:
3441
3542 def create_assembler (self ) -> Ks :
3643 raise QlErrorNotImplemented ("Keystone does not yet support riscv" )
44+
45+ def enable_float (self ):
46+ self .ql .reg .mstatus = self .ql .reg .mstatus | MSTATUS .FS_DIRTY
Original file line number Diff line number Diff line change 88from keystone import Ks
99
1010from qiling import Qiling
11- from qiling .arch .arch import QlArch
1211from qiling .arch .riscv_const import *
1312from qiling .exception import QlErrorNotImplemented
1413
14+ from .riscv import QlArchRISCV
1515
16- class QlArchRISCV64 (QlArch ):
16+
17+ class QlArchRISCV64 (QlArchRISCV ):
1718 def __init__ (self , ql : Qiling ):
1819 super ().__init__ (ql )
1920
20- self .ql .reg .expand_mapping (reg_map )
21- self .ql .reg .register_sp (reg_map ["sp" ])
22- self .ql .reg .register_pc (reg_map ["pc" ])
23-
2421 # get initialized unicorn engine
2522 def get_init_uc (self ) -> Uc :
2623 return Uc (UC_ARCH_RISCV , UC_MODE_RISCV64 )
Original file line number Diff line number Diff line change @@ -88,10 +88,12 @@ def load(self):
8888 self .thread_class = thread .QlLinuxX8664Thread
8989
9090 elif self .ql .archtype == QL_ARCH .RISCV :
91+ self .ql .arch .enable_float ()
9192 self .ql .hook_intno (self .hook_syscall , 8 )
9293 self .thread_class = None
9394
9495 elif self .ql .archtype == QL_ARCH .RISCV64 :
96+ self .ql .arch .enable_float ()
9597 self .ql .hook_intno (self .hook_syscall , 8 )
9698 self .thread_class = None
9799
You can’t perform that action at this time.
0 commit comments