Unlike rz_vector_index_ptr, which is very important, there do not seem
to be any valid usages of rz_pvector_index_ptr in rizin, cutter or
rz-ghidra that could not be replaced by rz_pvector_at.
In case there will be a use-case for it in the future, it can also be
done by rz_pvector_data(...) + i.
OpenBSD/sparc64 uses 128-bit floats as long double by default while our
tests seeminly assumed either 64-bit or 80-bit, both of which produce
different results than 128 here. Since 80-bit is x86-specific, we check
only the bits we know will be identical between other architectures.
* Create `il_fp_ops.inc`, for floating-point instructions' IL ops
* Add IL implementation for `FABS`
* Also add `x86_il_{get,set}_st_reg` helper functions
* Add IL implementation for `FNINIT` and `FLDCW`
* Add IL implementations for `FNSTCW` and `FNSTSW`
* Add IL implementation for `FNCLEX`
* Add ST push and pop functions
* Fix clang formatting
* Add fucntions for updating FPSW TOP pointer
* Add `FLD` instruction lifitng, FPSW flag support, FP operand support
* Remove `x86_bool_to_bv` and use the standard `BOOL_TO_BV`
* Add implementation for `FST{P}`, and rounding mode support
* Add `FLD` variants for constants
* Fix formatting and build
* Add IL lifting for `FXCH`
* Add width checks to avoid redundant rounding
* Implement IL lifting for `FILD`, `FIST{P}`
* Add helper functions to inter-convert floating point values and
integers using the rounding mode in the control word
* FPU stack regs are 80-bit, not 64-bit
* Add RzIL lifting for `FBLD`
* Add RzIL implementation for `FBSTP`
* An invalid-arithmetic-operand (#IA) exception may occurr if the
value being converted to the BCD integer cannot fit in an 18-bit
BCD integer. For the IL's purpose, we just jump to the "int" label
(stands for interrupt) using `GOTO`.
* Remove all the `EMPTY()` ops after `GOTO()` ops
* On second thought, using `EMPTY()` ops after `GOTO()` ops is not
the best idea to indicate end of analysis. Maybe the hooks can
signal that analysis needs to be restarted.
* Also, clean up the comments of a bunch of unimplemented ops
* Moved some code around
* Rename "rmode" local variable to "_rmode"
* Add some TODOs for deffered work
* Fix failing asm tests
* Caused due to the removal of the [empty] opcode
* Implement IL lifting for `FADD` (and some other minor refactoring)
* Implement the IL lifting for `FADD`: This is not entirely correct
as of now, because we don't handle setting C1 based on rounding
up/down, but I think it should be fine for now. Need to tackle
setting the control word bits later
* Start using `RzFloatFormat` to describe the float's width instead
of using an unsigned integer. Provide and expose conversion
functions between the two
* Use a global to denote when RMode needs to be init, implement FIADD
* Other minor refactor which fixes the CI (hopefully)
* Implement `FMUL` and `FIMUL`
* Extract the common code into a C macro
* Implement RzIL for `FSUB` and `FISUB`
* Also add `x86_il_fsub_with_rmode` helper
* Implement RzIL for `FSUBR` and `FISUBR`
* Reuse the implementation of `x86_il_fsub_with_rmode` and just pass
the arguments in the opposite order
* Add RzIL implementation for `FDIV`, `FIDIV`, `FDIVR`, `FIDIVR`
* Add pop versions of floating point arithmetic instuctions
* Add a new macro `X86_ARITHMETIC_POP_IL` macro for the same
* Fix a typo
* Add a note for using `X86_INS_PFADD` for FADDP instruction on
Capstone version newer than 4
* Add RzIL implementations for `FCOM`, `FCOMP` and `FCOMPP`
* Add RzIL lifting for `FUCOM` and `FCOMI` families of instructions
* Implement RzIL lifting for `FCHS` and `FTST`
* Add RzIL implementation for `FRNDINT` and `FSQRT`
* Add RzIL implementation for `FNOP` and `FISTTP`
* Remove global variable `use_rmode` and use pass around a context instead
* Define a new `X86ILContext` struct to pass around information
whether we need to intitialize the rouding mode or not
* Remove the global variable which was previously responsible for
doing so
* Add RzIL for `FICOM` and `FICOMP`, add register bindings and fix bugs
* Make `rz-test` more robust against IL outputs with newlines in them
* Add RzIL tests in db/asm for x86 FPU instructions
* Fix the bug when using `FADDP` with Capstone version > 4
* Fix remaining db tests
* Remove tests for `FSTSW` or `FSTCW` instructions
* We already test `WAIT` (in `db/asm/x86_32`) and `FSTSW` (or
`FSTCW`) (in `db/asm/x86_64`)
* Remove the newline replacement code in `rz-test` as well, since we
wouldn't need that functionality anymore
* Add asm tests for math constant push instructions
* Add `RZ_IPI` annotation for all the functions exposed through the header
* Add `RZ_OWN`, `RZ_BORROW` and `RZ_NONNULL` annotations
* Add Doxygen doc for `ctx` argument
* Add description for the `EXEC_WITH_RMODE` macro
* Move the non-null check for `ctx` inside the valid branch
* When we pop the FPU stack we pass in a `NULL` context since no
resizing would be needed, which causes a failure if the non-null
check for the `ctx` is outside the branch
* Fixes failing tests in `db/asm`
* Minor bug fixes + make the annotations less strict than they need to be
* Minor bug fixes
* Incorrect implementation for `RET` and `CALL`
* Swapped arguments for shift right
* Fix asm tests for `JMP` and `RET` instructions
* Fix indexing error for `FXCH`
* Review changes
* Move all unimplemented instructions to the end
* Remove support for Capstone version less than 4
* Basic framework of rx implemented
* Add match and parse flow
* Add part of description for RxV1 instruction set
* Add datasheet for rxv1
* Implement stringify op for rx
* Add missing TST instruction in datasheet
* Test to div instruction and fix bugs
* Test known rxv1 instruction set
* Fix bugs in rx disasm plugin and add SPDX
* Add rz_analysis for renesas rx
* Fix rz_analysis bug for renesas rx
* Add rz_asm test and fix bug in datasheet
* Add analysis test and fix bugs for renesas rx
* Added a test in `test_float.c` for it
* It is kind of unfortunate to deal with the idiosyncrasy of 80-bit
float this way. There are cleaner ways, but they would require
more refactor, and are probably not worth it since we wouldn't be
modifying the float code that often.
* Read bytes at curr_op->fail/jump into buffer before decoding them.
* Add meta information of iCFG and CFG nodes to dot graph labels.
* Add subtype annotations to CFG and iCFG nodes.
* Test reading of buffer before node to RzAnalysisOp.jump/fail is added.
* Fix CFG tests by adding node type annotations.
* Add iCFG graph with 'alloc' annotations.
* Wrap ascii annotation symbols in brackets.
* Add doxygen to rz_str_append(f)
* Add different types of GraphNodeInfos.
This adds support for multiple graph node infos.
It removes the assumption that information of
a graph node must be some strings and an offset.
* Increase buffer for printing graph node body
* Don't hardcode maximum label size
* Add graph node info for icfg
* Add node type info to CFG.
* Access address members properly for iCFG and CFG nodes
* Update test. Function names are no longer saved.
* Fix reachable double free of label
* Split graph node type from its sub-type to make it less confusing.
* Add integration tests for iCFG nodes.
* Fix, add mising buffer read
* Recognize more calls
* Add test for iCFG generation and its node details.
* DWARF: Fix ANSI Escape Sequence Injection vulns via DWARF
* DWARF: Reduce one memory copy in rz_bin_dwarf_attr_string
* DWARF: move Doxygen of `rz_bin_dwarf_attr_string` from the header to the implementation
* Replace OpenBSD regex library with PCRE2.
PCRE2 has way better performance than the OpenBSD
library (something around 20 times faster).
The following flags are enabled for every pattern:
- PCRE2_UTF
- PCRE2_MATCH_INVALID_UTF
- PCRE2_NO_UTF_CHECK
All the others are optional.
Changes made:
- Adds PCRE2 as subproject.
- Changes the API away from POSIX to PCRE2.
- Edits many regex patterns because:
- ' ' is skipped in patterns, if the EXTENDED flag is set for matching. '\s' must be set now.
- '.' doesn't match newlines by default.
- Changes the API so matches and their groups are bundled into PVectors.
- Moves the regex component to rz_util.
* Fix cross build - add copy of PCRE2 dependecy
Meson currently doesn't support subprojects to be native and non-native at the same time.
See: https://github.com/mesonbuild/meson/issues/10947
Unfortunately, sdb depends on rz_util which in turn depends on PCRE2.
Excluding PCRE2 from the native build makes linking of rz_util not possible anymore.
Adding it, will make Meson complain that the dependencies cannot be mixed.
Hence, we compile a copy of PCRE2 for the native build if required.
* Add support for more AArch64 ELF relocs
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
* Update prev and add more relocs
---------
Co-authored-by: Giovanni <561184+wargio@users.noreply.github.com>
Co-authored-by: Pavel I <pelijah@users.noreply.github.com>
* Add CFG generation function.
* Document rz_analysis_op()
* Set type annotation to NONNULL
* Add command to generate CFG.
* Add note about not following calls.
* Add tests and simplify check.
* Add extra bitvector operations defined in core theory basic extra part
* Add extra bitvector operations test
* Fix bv64 init const overflow in windows x64 test
* Add test case for bv_pred and bv_succ near 0
* Add a new helper to convert a `long double` to an 80-bit RzIL float
* New function: `rz_il_op_new_float_from_f80`
* New opbuilder: `F80`
* Add test for `rz_il_op_new_float_from_f80`
* Also add a float format check in `rz_il_sort_pure_eq`
* Add a few `includes` so that some types are visible
Pointer authentication instructions like 'pacibsp' are encoded as alias for 'hint'.
Due to this they got assigned the 'nop' type and got neglected as valid function preamble.