uc_query expects a size_t *, while we are passing uc_arch *. This has
been working for a while as gcc just warned about this, however with
latest gcc this changed into an error:
unicorn.c:122:34: error: passing argument 3 of ‘uc_query’ from incompatible pointer type [-Wincompatible-pointer-types]
206 | uc_query(_uc, UC_QUERY_ARCH, &arch);
unicorn.h:689:60: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘uc_arch *’
689 | uc_err uc_query(uc_engine *uc, uc_query_type type, size_t *result);
Fix this issue by querying the result into a size_t and later downcast
the result into an uc_arch enum.
* use hwaddr for paddrs
* Fix the truncation for memory hooks as well
* Add LPAE regression test
Co-authored-by: Takacs, Philipp <philipp.takacs@iosb.fraunhofer.de>
- Use full code length (instead of subtracting 1) when writing instructions.
- Uniformly zero-pad addresses in logs and print hexadecimal.
- Correct the instruction-hook callback in test_riscv2.
* memory snapshots fix use after free on flatview copy
When restoring a snapshot with memory the flatview must be restored
before the memory reagions are filtered. Because the
AddressSpaceDispatcher also has pointer to the MemoryRegions and on copy
they need to be cleared. The memory_filter_subregions function frees
MemoryRegions which are not used at the time of the snapshot.
* fix some memleaks in tests
These tests has forgott to call uc_close(uc), which lead to memory
leaks. Found by the LeakSanitizer.
* memory snapshots correct clean up container memory regions
* Fix further stackoverflow in tests
---------
Co-authored-by: mio <mio@lazym.io>
* Support mips64 - write correct pc register width on uc_emu_start
* Convert to UC_MODE_MIPS64
* Correctly select MIPS64 CPU model
* Simple 64-bit test - check it doesn't crash
* lint
* Comment
* Comment
* Add offset when indexing cpu model, makes tests work on older python
* Move test
* add PC check to test
* Fix test - add python version check
* Use RegressTest method for assert
Rationale: Previouly, Unicorn uses several hacks to pretend it supports
floating point instructions while not properly setting up something
like CPU features. Therefore, once related registers like CR4 is reset,
the hacks stop working and UC_ERR_INSN_INVALID is thrown. Setting the default
model to a CPu that has basical floating point support should have the
minimal break changes.