ft: rename to i8086-rs
This commit is contained in:
20
Cargo.lock
generated
20
Cargo.lock
generated
@@ -145,6 +145,16 @@ version = "0.5.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "i8086-rs"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"env",
|
||||||
|
"env_logger",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "is_terminal_polyfill"
|
name = "is_terminal_polyfill"
|
||||||
version = "1.70.1"
|
version = "1.70.1"
|
||||||
@@ -193,16 +203,6 @@ version = "2.7.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "minix-8086-rs"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
"env",
|
|
||||||
"env_logger",
|
|
||||||
"log",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_threads"
|
name = "num_threads"
|
||||||
version = "0.1.7"
|
version = "0.1.7"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "minix-8086-rs"
|
name = "i8086-rs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -5,7 +5,7 @@
|
|||||||
It includes:
|
It includes:
|
||||||
- a.out Parser to parse legacy MINIX 1.x executables.
|
- a.out Parser to parse legacy MINIX 1.x executables.
|
||||||
- 8086 disassembler to parse the 16-bit instructions into an IR and prints them in a `objdump(1)`-style fashion.
|
- 8086 disassembler to parse the 16-bit instructions into an IR and prints them in a `objdump(1)`-style fashion.
|
||||||
- 8086 interpreter which interprets the instructions with MINIX 1.x conventions (e.g. interrupts, memory layout, ...) in mind and obeys segment register indirection, which enables the usage of the entire 20-bit memory bus.
|
- 8086 interpreter which interprets the instructions with MINIX 1.x conventions (e.g. interrupts, memory layout, ...) in mind and obeys segment register indirection, which enables the usage of the **entire 20-bit memory bus**.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -29,12 +29,15 @@ CLI Options:
|
|||||||
$ cargo run -- --help
|
$ cargo run -- --help
|
||||||
Simple program to disassemble and interpret 8086 a.out compilates, e.g. such for MINIX
|
Simple program to disassemble and interpret 8086 a.out compilates, e.g. such for MINIX
|
||||||
|
|
||||||
Usage: 8086-rs [OPTIONS] <COMMAND>
|
Usage: i8086-rs [OPTIONS] [ARGV]... <COMMAND>
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
disasm Disassemble the binary into 8086 instructions
|
disassemble Disassemble the binary into 8086 instructions [aliases: d]
|
||||||
interpret Interpret the 8086 instructions
|
interpret Interpret the 8086 instructions [aliases: i]
|
||||||
help Print this message or the help of the given subcommand(s)
|
help Print this message or the help of the given subcommand(s)
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
[ARGV]... argv passed to the program, which will be interpreted
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-p, --path <PATH> Path of the binary
|
-p, --path <PATH> Path of the binary
|
||||||
@@ -54,16 +57,18 @@ But first I want to implement all features correctly and add tests for all of th
|
|||||||
|
|
||||||
## Caveats
|
## Caveats
|
||||||
|
|
||||||
Interpreted code is disassembled into a Vector, which will also be used for execution.
|
Code is currently not fetched from memory, but from a seperate vector, stored inside the Disassembler struct, which fetches and parses the next instruction from the instruction pointer.
|
||||||
This means, that the code is not actually loaded into memory, but the `CS:IP` addressing scheme is still being used.
|
Although, the `CS:IP` addressing scheme is still being used, to allow for 20-bit access, but does currently now allow for self-modifying code.
|
||||||
|
|
||||||
|
Also the disassmbler just uses an initial sweep for disassembly, which has a high probability of not being accurate, when compared to the runtime.
|
||||||
|
E.g. maybe there is a jump to a memory address during interpretation, which was not identified as an instruction by the disassembler.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
The documentation of the project itself can be accessed by using `cargo doc`.
|
The documentation of the project itself can be accessed by using `cargo doc`.
|
||||||
```
|
```
|
||||||
$ cargo doc
|
$ cargo doc
|
||||||
$ firefox target/doc/8086_rs/index.html
|
$ firefox target/doc/i8086_rs/index.html
|
||||||
```
|
```
|
||||||
|
|
||||||
For the implementation of the disassembly, I used the Intel "8086 16-BIT HMOS MICROPROCESSOR" Spec, as well as [this](http://www.mlsite.net/8086/8086_table.txt) overview of all Opcode variants used in conjunction with [this](http://www.mlsite.net/8086/) decoding matrix.
|
For the implementation of the disassembly, I used the Intel "8086 16-BIT HMOS MICROPROCESSOR" Spec, as well as [this](http://www.mlsite.net/8086/8086_table.txt) overview of all Opcode variants used in conjunction with [this](http://www.mlsite.net/8086/) decoding matrix.
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ mod register;
|
|||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
enum Command {
|
enum Command {
|
||||||
/// Disassemble the binary into 8086 instructions
|
/// Disassemble the binary into 8086 instructions
|
||||||
Disasm,
|
#[clap(visible_alias("d"))]
|
||||||
|
Disassemble,
|
||||||
|
|
||||||
/// Interpret the 8086 instructions
|
/// Interpret the 8086 instructions
|
||||||
|
#[clap(visible_alias("i"))]
|
||||||
Interpret,
|
Interpret,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +54,7 @@ fn main() {
|
|||||||
log::debug!("{:?}", args);
|
log::debug!("{:?}", args);
|
||||||
|
|
||||||
match args.command {
|
match args.command {
|
||||||
Command::Disasm => {
|
Command::Disassemble => {
|
||||||
let mut disasm = Disassembler::new(&args);
|
let mut disasm = Disassembler::new(&args);
|
||||||
let instructions = disasm.disassemble(args.dump);
|
let instructions = disasm.disassemble(args.dump);
|
||||||
match instructions {
|
match instructions {
|
||||||
|
|||||||
Reference in New Issue
Block a user