Add Disassemble, fix bug in position calculation

* Disassemble structure can be used for dumping an object section
* Assembler position calculation was messing up, causing jump addresses
  to be wrong. This is fixed.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-02-10 16:31:08 -05:00
parent 6c352396fa
commit a4a37b5a27
8 changed files with 397 additions and 71 deletions

View File

@@ -7,6 +7,15 @@ macro_rules! registers {
$(
pub const $variant: Reg = $value;
)*
pub fn reg_name(reg: Reg) -> Option<&'static str> {
match reg {
$(
$value => Some(stringify!($variant)),
)*
_ => None,
}
}
};
}
@@ -91,5 +100,6 @@ registers! {
R47 = 61,
R48 = 62,
R49 = 63,
LAST_REG = R49,
}
pub const LAST_REG: Reg = R49;