The array sizes, such as instructions_size, contains the size of the
array in bytes. This is wrong and should the max element count of the
array.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Fixes CDoc ordering the sidebar and main page types in alphabetical
order. Only the sidebar should be sorted and the main page should
be rendered the way its header file was parsed, top to bottom.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Windows does not support the doc target, which causes the CI to fail.
Marking the doc target as ALL should fix this.
Signed-off-by: Ronald Caesar <github43132@proton.me>
- Add Lint job to reject bad code.
- Add Address Sanatizers.
- Add Test Suite verification.
- Add Static Analysis
Signed-off-by: Ronald Caesar <github43132@proton.me>
While I do not like the Rust Language as a whole, their documentation
generator is the best I've ever seen. in any language. I want to
implement something like it for Ballistic.
Like I said in the README, I have absolutely zero motivation to create
a documentation generator so `cdoc.c` is made completely with AI. The
code is messy but the generated HTML files look beautiful.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This was tricky one to add to bal_engine_t because the struct was
already pretty packed. The struct only had 12 bytes to spare but to add
the constants array and its size required 16 bytes. I determined that
ssa_bit_widths_size was not required since ssa_bit_widths[] and
instructions[] will be parallel to each other, so one variable can keep
track of both arrays.
Signed-off-by: Ronald Caesar <github43132@proton.me>
I do not want compiler attributes like __clang__ or __linux__ scattered
everywhere to detect the platform Ballistic is running on, so I added
preprocessor directives to make things a lot cleaner.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Also remove bal_translate_block() body. It will need to be redesigned
to be used by bal_engine_run().
Signed-off-by: Ronald Caesar <github43132@proton.me>
Everything has been setup except for the main translation loop which
have to be done another day. Its after midnight for me right now :(
Signed-off-by: Ronald Caesar <github43132@proton.me>
Instead of using strcmp() on each decoded intruction's mnemonic to
translate it, we embedd an IR opcode into the struct. This is a very
barebones implementation and does not cover the entire ARM instruction
set. ARM instructions that does not have an IR opcode equivalent will be
marked with `OPCODE_TRAP` and should be implemented in the future.
Signed-off-by: Ronald Caesar <github43132@proton.me>
At first I wondered how will we know the bitfield of the ssa variable
we're creating? Should we hardcode the bit width in the opcode and
create a large switch statement or hash table? To keep things simple
I just added a new bit width parameter to emit_instruction() and it
will be the frontend's responsibility to find the correct bitwidth.
This should better for x86 lowering.
Signed-off-by: Ronald Caesar <github43132@proton.me>
A simple program that prints to stdout the top 20 most common
instructions in an ARM64 binary file.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This function only responsibility is writing opcodes and operands to a
bal_instruction_t and adding it to the instruction stream.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Also added the size of each array to bal_engine_t to make finding the
end of the array in memory simple and easy.
Signed-off-by: Ronald Caesar <github43132@proton.me>
I want users of Ballistic to design their own memory allocators. Their memory
allocation requirements will most likely be different from ours, so providing
users the API to write their own allocators gives them a lot of freedom
to do whatever they feel is best. This idea was inspired in part by the Zig
programming language.
Signed-off-by: Ronald Caesar <github43132@proton.me>