Skip to content

Commit c2ed2ff

Browse files
committed
MIPS: minimal support for movf, movt
1 parent c75304c commit c2ed2ff

File tree

2 files changed

+112
-0
lines changed

2 files changed

+112
-0
lines changed

chb/mips/opcodes/MIPSMovF.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# ------------------------------------------------------------------------------
2+
# CodeHawk Binary Analyzer
3+
# Author: Henny Sipma
4+
# ------------------------------------------------------------------------------
5+
# The MIT License (MIT)
6+
#
7+
# Copyright (c) 2025 Aarno Labs LLC
8+
#
9+
# Permission is hereby granted, free of charge, to any person obtaining a copy
10+
# of this software and associated documentation files (the "Software"), to deal
11+
# in the Software without restriction, including without limitation the rights
12+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
# copies of the Software, and to permit persons to whom the Software is
14+
# furnished to do so, subject to the following conditions:
15+
#
16+
# The above copyright notice and this permission notice shall be included in all
17+
# copies or substantial portions of the Software.
18+
#
19+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
# SOFTWARE.
26+
# ------------------------------------------------------------------------------
27+
28+
from typing import cast, List, Sequence, TYPE_CHECKING
29+
30+
from chb.app.InstrXData import InstrXData
31+
32+
from chb.mips.MIPSDictionaryRecord import mipsregistry
33+
from chb.mips.MIPSOpcode import MIPSOpcode, simplify_result
34+
from chb.mips.MIPSOperand import MIPSOperand
35+
36+
from chb.util.IndexedTable import IndexedTableValue
37+
38+
if TYPE_CHECKING:
39+
from chb.mips.MIPSDictionary import MIPSDictionary
40+
41+
42+
@mipsregistry.register_tag("movf", MIPSOpcode)
43+
class MIPSMovF(MIPSOpcode):
44+
45+
def __init__(
46+
self,
47+
mipsd: "MIPSDictionary",
48+
ixval: IndexedTableValue) -> None:
49+
MIPSOpcode.__init__(self, mipsd, ixval)
50+
51+
@property
52+
def operands(self) -> Sequence[MIPSOperand]:
53+
return [self.mipsd.mips_operand(i) for i in self.args[1:]]
54+
55+
def annotation(self, xdata: InstrXData) -> str:
56+
return "pending"

chb/mips/opcodes/MIPSMovT.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# ------------------------------------------------------------------------------
2+
# CodeHawk Binary Analyzer
3+
# Author: Henny Sipma
4+
# ------------------------------------------------------------------------------
5+
# The MIT License (MIT)
6+
#
7+
# Copyright (c) 2025 Aarno Labs LLC
8+
#
9+
# Permission is hereby granted, free of charge, to any person obtaining a copy
10+
# of this software and associated documentation files (the "Software"), to deal
11+
# in the Software without restriction, including without limitation the rights
12+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
# copies of the Software, and to permit persons to whom the Software is
14+
# furnished to do so, subject to the following conditions:
15+
#
16+
# The above copyright notice and this permission notice shall be included in all
17+
# copies or substantial portions of the Software.
18+
#
19+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
# SOFTWARE.
26+
# ------------------------------------------------------------------------------
27+
28+
from typing import cast, List, Sequence, TYPE_CHECKING
29+
30+
from chb.app.InstrXData import InstrXData
31+
32+
from chb.mips.MIPSDictionaryRecord import mipsregistry
33+
from chb.mips.MIPSOpcode import MIPSOpcode, simplify_result
34+
from chb.mips.MIPSOperand import MIPSOperand
35+
36+
from chb.util.IndexedTable import IndexedTableValue
37+
38+
if TYPE_CHECKING:
39+
from chb.mips.MIPSDictionary import MIPSDictionary
40+
41+
42+
@mipsregistry.register_tag("movt", MIPSOpcode)
43+
class MIPSMovT(MIPSOpcode):
44+
45+
def __init__(
46+
self,
47+
mipsd: "MIPSDictionary",
48+
ixval: IndexedTableValue) -> None:
49+
MIPSOpcode.__init__(self, mipsd, ixval)
50+
51+
@property
52+
def operands(self) -> Sequence[MIPSOperand]:
53+
return [self.mipsd.mips_operand(i) for i in self.args[1:]]
54+
55+
def annotation(self, xdata: InstrXData) -> str:
56+
return "pending"

0 commit comments

Comments
 (0)