Skip to content

Commit

Permalink
Implement SPECIAL2 instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Apr 11, 2024
1 parent 0eccf14 commit b589dcc
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cplusplus/include/generated/UniqueId_enum_class.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions include/generated/InstrDescriptor_Descriptors_array.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions include/generated/InstrId_Names_array.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions include/generated/InstrId_enum.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rabbitizer/InstrId.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rust/src/instr_id_enum.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion rust/src/registers_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ extern "C" {
pub static mut RabbitizerRegister_RspCop2Control_Names:
[[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_RspVector_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexCop3_Names:
[[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R5900VF_Names: [[*const core::ffi::c_char; 2usize]; 0usize];
pub static mut RabbitizerRegister_R5900VI_Names: [[*const core::ffi::c_char; 2usize]; 0usize];

Expand Down Expand Up @@ -62,7 +64,7 @@ extern "C" {

/* R4000ALLEGREX */

pub static mut RabbitizerRegister_R4000AllegrexCop3_Names: [RegisterDescriptor; 0usize];
pub static mut RabbitizerRegister_R4000AllegrexCop3_Descriptors: [RegisterDescriptor; 0usize];

/* R4000ALLEGREX */

Expand Down
26 changes: 24 additions & 2 deletions tables/tables/instr_id/r4000allegrex/r4000allegrex_special2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,35 @@
| = SPECIAL | | function|
------6----------------------------------------------------6-----
|--000--|--001--|--010--|--011--|--100--|--101--|--110--|--111--| lo
000 | --- | --- | --- | --- | --- | --- | --- | --- |
000 | SLEEP | --- | --- | --- | --- | --- | --- | --- |
001 | --- | --- | --- | --- | --- | --- | --- | --- |
010 | --- | --- | --- | --- | --- | --- | --- | --- |
011 | --- | --- | --- | --- | --- | --- | --- | --- |
100 | --- | --- | --- | --- | --- | --- | --- | --- |
100 | --- | --- | --- | --- | MFIE | --- | MTIE | --- |
101 | --- | --- | --- | --- | --- | --- | --- | --- |
110 | --- | --- | --- | --- | --- | --- | --- | --- |
111 | --- | --- | --- | --- | --- | --- | --- | --- |
hi |-------|-------|-------|-------|-------|-------|-------|-------|
*/

// OP

RABBITIZER_DEF_INSTR_ID(
r4000allegrex, 0x00, sleep,
.operands={0},
.instrType=RABBITIZER_INSTR_TYPE_R
)

RABBITIZER_DEF_INSTR_ID(
r4000allegrex, 0x24, mfie,
.operands={RAB_OPERAND_cpu_rt},
.instrType=RABBITIZER_INSTR_TYPE_R,
.modifiesRt=true
)

RABBITIZER_DEF_INSTR_ID(
r4000allegrex, 0x26, mtie,
.operands={RAB_OPERAND_cpu_rt},
.instrType=RABBITIZER_INSTR_TYPE_R,
.readsRt=true
)
3 changes: 2 additions & 1 deletion tests/c/instruction_checks/r4000allegrex_vfpu_disasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,6 @@ const TestEntry test_entries[] = {
TEST_ENTRY_C(0xD89E0042, NULL, "lv.q C720, 0x40($a0)"),
TEST_ENTRY_C(0xD89F0042, NULL, "lv.q C730, 0x40($a0)"),
TEST_ENTRY_C(0x48640004, NULL, "mfv $a0, S100"),
TEST_ENTRY_C(0x48640004, NULL, "mfv $a0, S100"),
TEST_ENTRY_C(0x48640080, NULL, "mfvc $a0, $128"),
TEST_ENTRY_C(0x48640084, NULL, "mfvc $a0, $132"),
TEST_ENTRY_C(0x48E40004, NULL, "mtv $a0, S100"),
Expand All @@ -1155,6 +1154,7 @@ const TestEntry test_entries[] = {
TEST_ENTRY_C(0xF4800040, NULL, "svl.q C000, 0x40($a0)"),
TEST_ENTRY_C(0xF4800042, NULL, "svr.q C000, 0x40($a0)"),

#if 0
// According to the manual, bit 1 should be zero. The compiler handles it fine, but objdump ignores this bit, so idk
TEST_ENTRY_C(0xD8800043, NULL, NULL),
TEST_ENTRY_C(0xD8810043, NULL, NULL),
Expand Down Expand Up @@ -1188,6 +1188,7 @@ const TestEntry test_entries[] = {
TEST_ENTRY_C(0xD89D0043, NULL, NULL),
TEST_ENTRY_C(0xD89E0043, NULL, NULL),
TEST_ENTRY_C(0xD89F0043, NULL, NULL),
#endif
};

size_t test_entries_len = ARRAY_COUNT(test_entries);

0 comments on commit b589dcc

Please sign in to comment.