bal_memory_destroy_flat() frees heap allocated memory AND resets
`interface` to 0, which the docs do not specify.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Code coverage tools cannot fully cover BAL_LOG_* statements because of
the numerous if statements in BAL_LOG(). We extract the code in
BAL_LOG() to bal_log_message() to fix this issue.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Adds BAL_LOG_LEVEL_NONE to to the bal_log_level_t enum. This gives users
the option to disable logging completely if BAL_LOG_LEVEL_NONE is set as
the mininum log level.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This enum is very useful for the translation loop and including the
entirety of bal_assembler.h just to get it is not a good idea. This enum
has been moved to bal_types.h.
Signed-off-by: Ronald Caesar <github43132@proton.me>
I truly dont if markdown code examples peoduce warnings, but those
warnings cannot make the build fail to compile.
Signed-off-by: Ronald Caesar <github43132@proton.me>
In the ADD Extended Register encoding, bitfield "option" Bit[13:15] was
not being detected by the python script. This commit parses this
bitfield correctly. Consequently, the size of the operands array has to
be raised from 4 to 5 to support this new operand.
Signed-off-by: Ronald Caesar <github43132@proton.me>
I recently got a new PC with Jetbrain's Clion IDE and this commit fixes
warnings generated by Clion.
Signed-off-by: Ronald Caesar <github43132@proton.me>
1. Fixes GCC warnings that do not deserve me writing an indepth
explanation on what needed to be changed.
2. The original mask calculation for OPCODE_MOV makes zero sense because
the bit width for operands[0] is always > 31. I don't know what I was
thinking when I wrote this. The mask is now set to cover 32 and 64-bit
immediate values.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This opcode represents a volotile load of a guest register. This is
needed to handle instructions reading register before it has been
written to within the current basic block.
For example, if `MOVK X0` is the first instruction in the basic block,
we have no IR variable representing X0 yet. So we emit
OPCODE_GET_REGISTER before MOVK. OPCODE_GET_REGISTER tells
the backend "load X0 from guest memory"
Signed-off-by: Ronald Caesar <github43132@proton.me>
The definition BAL_SOURCE_SIZE isnt really usefull for Ballistic. Its
mainly use to create a mask for the IR source bitfield. SoI created two
definitions to replace this: BAL_SOURCE_MASK and
BAL_SOURCE_MASK_WITH_FLAG.
Signed-off-by: Ronald Caesar <github43132@proton.me>
The engine is built for 32-bit constants which is wrong since Ballistic
is an ARM64 recompiler. Instructions like MOVZ with LSR #32 or LSR #48
would fail.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This was created to make creating instructions easier to test
Ballistic's translation loop. Documentation will be added in the
future.
Signed-off-by: Ronald Caesar <github43132@proton.me>