Skip to content

Commit

Permalink
A significant rework of the ASM parser.
Browse files Browse the repository at this point in the history
The ASM parser will now select instructions by a type of fuzzy analysis with their argument types. If you have an instruction of the format: ins 0xaa, 0xaa and another ins 0xdeadbeef, 0xdeadbeef the parser will select the option that takes the least amount of space to store based on the arguments presented.

Where needed specific alternative names will be added to allow the parser to specifically target an instruction with a smaller instruction size.
  • Loading branch information
sciguyryan committed Jan 20, 2024
1 parent 8dc7081 commit 79d24a5
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 201 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ default-members = ["redox-terminal", "redox-core", "redox-parser"]
bitflags = "2.4.2"
float-cmp = "0.9.0"
hashbrown = "0.14.3"
itertools = "0.12.0"
num-traits = "0.2.17"
num-derive = "0.4.1"
prettytable = "0.10.0"
Expand Down
10 changes: 5 additions & 5 deletions redox-core/src/ins/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,19 @@ impl Display for Instruction {
format!("out.i32 0x{value:08x}, 0x{port:02x}")
}
OutU32Reg(reg, port) => {
format!("out.ir32 {reg}, 0x{port:02x}")
format!("out.r32 {reg}, 0x{port:02x}")
}
OutU8Imm(value, port) => {
format!("out.i8 0x{value:02x}, 0x{port:02x}")
}
InU8Reg(port, reg) => {
format!("in.ir8 0x{port:02x}, {reg}")
format!("in.r8 0x{port:02x}, {reg}")
}
InU32Reg(port, reg) => {
format!("in.ir32 0x{port:02x}, {reg}")
format!("in.r32 0x{port:02x}, {reg}")
}
InF32Reg(port, reg) => {
format!("in.fr32 0x{port:02x}, {reg}")
format!("in.rf32 0x{port:02x}, {reg}")
}
InU8Mem(port, addr) => {
format!("in.m8 0x{port:02x}, &0x{addr:08x}")
Expand All @@ -426,7 +426,7 @@ impl Display for Instruction {
format!("in.m32 0x{port:02x}, &0x{addr:08x}")
}
InF32Mem(port, addr) => {
format!("in.fm32 0x{port:02x}, &0x{addr:08x}")
format!("in.mf32 0x{port:02x}, &0x{addr:08x}")
}

/******** [Logic Instructions] ********/
Expand Down
1 change: 1 addition & 0 deletions redox-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ homepage = "https://github.com/sciguyryan/Redox"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
itertools.workspace = true
strum.workspace = true
strum_macros.workspace = true
redox_core = { path = "../redox-core" }
Expand Down
Loading

0 comments on commit 79d24a5

Please sign in to comment.