This does two things so I'll split them.
(1) Add function intern_constant() which adds a constant to the
constants array and returns the index.
The assembly for this function is beautiful. Only one load and store on
a successfull path.
Dump of assembler code for function intern_constant:
0x0000000000010ee0 <+0>: ldr w8, [x4]
0x0000000000010ee4 <+4>: cbnz w8, 0x10f08 <intern_constant+40>
0x0000000000010ee8 <+8>: ldrh w8, [x2]
0x0000000000010eec <+12>: cmp x3, x8
0x0000000000010ef0 <+16>: b.ls 0x10f10 <intern_constant+48> // b.plast
0x0000000000010ef4 <+20>: str w0, [x1, x8, lsl #2]
0x0000000000010ef8 <+24>: add w9, w8, #0x1
0x0000000000010efc <+28>: orr w0, w8, #0x10000
0x0000000000010f00 <+32>: strh w9, [x2]
0x0000000000010f04 <+36>: ret
0x0000000000010f08 <+40>: mov w0, #0x10000 // #65536
0x0000000000010f0c <+44>: ret
0x0000000000010f10 <+48>: mov w8, #0xffffff9c // #-100
0x0000000000010f14 <+52>: mov w0, #0x10000 // #65536
0x0000000000010f18 <+56>: str w8, [x4]
0x0000000000010f1c <+60>: ret
End of assembler dump.
(2) I've decided that the entire translation code will fit in
bal_engine.c so the bal_ir_immiter and bal_translator files are not
needed anymore. I moved their preprocessor definitions into bal_engine.c
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>
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>
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>
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>
The decoder API is now suitable to be made public. decoder.h is the sole
entry point for the decoder and it has been moved to `include/`
Signed-off-by: Ronald Caesar <github43132@proton.me>
This program takes a 32-bit hexidecimal representing an ARM instruction
and prints its corresponding mnemonic. This program will be used in
tandem with a python fuzzing script to verify the decoder table
generated by tools/generate_a64_table.py.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Apperantly -Wall does exactly what it says it does on Windows and enables
every single warning. This is why the build fails on Windows and not on
Linux or MacOS.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This is just to test if the decoder even works. Ii will implement a
fuzzer to test the decoder against 10,000 randomly generated
instructions.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Adds a python script, tools/generate_a64_table.py, to parse ARM's
machine readable XML. The script generates a static C lookup table
containing instruction mnemonics, masks, and values.
Signed-off-by: Ronald Caesar <github43132@proton.me>