Commit Graph

15 Commits

Author SHA1 Message Date
Lephenixnoir 29cd2815ec
refactor disassembly infrastructure and passes 2022-03-28 20:59:30 +01:00
Lephenixnoir e90ef447fc
more refactoring, still less exceptions: os 2022-03-27 17:39:42 +01:00
Lephenixnoir a9660da767
get rid of exceptions in the library, use explicit errors 2022-03-27 13:59:49 +01:00
Lephenixnoir 36fe7fcff4
refactor library utils 2022-03-27 12:12:53 +01:00
Lephenixnoir 3b684389e9
replace CLI with WIP shell (huge commit) 2022-03-04 11:29:33 +00:00
Lephenixnoir ca1217af1b
lib/load-asm: greatly improve loading time with less strings 2021-03-16 13:40:36 +01:00
Lephenixnoir c8b28b447f
masive improvements to memory use by compacting core objects
* Store CpuRegister on a single byte
* Store operation sizes (0, 1, 2, 4) on a single byte
* Share the (disp) and (imm) fields of instruction arguments
* Store instructions as char[12] instead of std::string (>32B)
* Store instruction args in Argument[2], not std::vector (>24B)

Size changes:
  CpuRegister:    4B ->  1B
  Argument:      24B ->  8B
  Instruction:  >64B -> 32B

This reduced the malloc size from 3.3M to 177k after a standard 40-line
disassembly (this excludes OS files mapped to memory), and improved the
loading time for the SH3 instruction table by about 30% (100 ms -> 65
ms).
2021-03-16 13:37:55 +01:00
Lephenixnoir 4c9b738247
(cosmetics) 2021-03-16 12:29:39 +01:00
Lephenixnoir c1c1be2d2c
support for mova, and more responsible OS creation 2020-02-29 11:25:03 +01:00
Lephenixnoir 5178a489be
add disassembly from arbitrary file
Also changes the naked pointer of the Buffer object to a shared_ptr.
Still learning how to use this thing, but I'll manage eventually.
2020-02-16 21:45:16 +01:00
Lephenixnoir 6ca3bc1f03
add the library command for a bit of introspection
The library commands lists the targets and instruction sets that have
been loaded from fxos data files.
2020-02-16 21:23:10 +01:00
Lephenixnoir 4d9edecad9
start with the analysis passes
-> The cfg pass loads the function into memory, annotates leaders and
   jumps, and resolves delay slots.
-> The pcrel pass currently computes locations for pc-relative moves and
   jumps, but does not yet compute the pc-relative moved data.
-> The print pass displays the results of analysis with various layout
   and formatting options.
2020-02-12 07:53:00 +01:00
Lephenixnoir 468495856d
implement more of the meat of the tool
* Separate OS and Target conceptually; now an OS is created on an
  existing target which must have ROM bound.
* Add a configuration file with a data library and description files
  which are automatically loaded at startup.
* As a first application, implement target descriptions. It is now
  possible (given the proper library) to type [fxos info fx@3.10] to get
  information on the fx OS version 3.10.
* Set up the pass infrastructure and the first few easy passes. This
  is still a Work In Progress and not yet called from the command-line.
* Improve the copy/move behavior of classes (C++ concerns).
* Add instruction metadata, which will make it easier to write actual
  useful analysis passes.
2019-12-28 17:18:13 +01:00
Lephenixnoir c9ecb855de
finish the base interfaces
* switch from File to Buffer to manage file contents
* boilerplate for a proprer command-line interface, and complete help
* add a notion of Addressable to avoid losing the source address of very
  information provided by the OS type
* use addressables in the AbstractMemory interface
* fully parse the header and footer of OSes
* bring [fxos info] to the level of the previous implementation
* make most of the OS attributes public
* use char* instead of void* for translation, since void* arithmetic
  triggers a hell of warnings in C++
2019-12-15 18:40:05 +01:00
Lephenixnoir d78f7bca10 initial system: instruction load, target creation
Contains basic stuff to start working:

* Loading files and assembly instruction descriptions
* Create a 64k-entry assembly decoding table
* Standard memory regions and information
* Create targets where files can be mapped at any addresses
* Load OSes and detect a few basic things
2019-12-14 22:33:57 +01:00