Commit Graph

19 Commits

Author SHA1 Message Date
PhilippTakacs
e8ca3cbea5 Optimize memory handling (#1963)
* optimize ram block handling

Save the last element of the ram_list. This allows to
faster find where to add new elements when they are not
bigger then page size.

* save ram_list freed

this keeps the optimization for find_ram_offset() intact after snapshot
restore.

* cow only clear the tlb of affected pages

* update flatview when possible

Building each flatview new when the memory has changed is quite
expensive when many MemoryRegions are used. This is an issue when using
snapshots.

* update benchmark for new api

* save flatview in context

this avoids rebuilding the flatview when restore a context.

* init context flatview with zero

* address_space_dispatch_clear remove subpage with higher priority

* docutemnt the options for UC_CTL_CONTEXT_MODE

Specialy stress that with UC_CTL_CONTEXT_MEMORY it is not possible to
use the context with a different unicorn object.
2024-10-16 21:51:13 +08:00
Takacs, Philipp
8d3bf02041 fix cow when using uc_mem_write
memory_cow expect the address and size to be aligned on pagesize.
2024-01-10 15:54:46 +01:00
Takacs, Philipp
df18756234 implement uc_mem_unmap with snapshots
still has todos and need tests
2023-07-11 11:51:44 +02:00
Takacs, Philipp
80bd825420 implement simple memory snapshot mechanismus
Uses Copy on Write to make it posible to restore the memory state after a snapshot
was made. To restore all MemoryRegions created after the snapshot are removed.
2023-07-11 11:51:40 +02:00
Takacs, Philipp
065af19dc5 use address_space_translate to find memory mapping
first version has bugs
2023-07-11 11:47:50 +02:00
Takacs, Philipp
cd85f589a2 add memory_region_add_subregion_overlap 2023-07-11 11:47:50 +02:00
Takacs, Philipp
7bb1501bc2 use int128_get64 in memory_unmap
This fixes build errors introduced by bbbc7856ac
2023-04-17 17:48:58 +02:00
Mio
bbbc7856ac Invalidate tb cache once mapping is removed 2023-04-12 20:56:54 +08:00
289034538d Cleaner implementation for uc_mem_prot on mmio regions 2022-05-28 23:46:06 +02:00
2a6529348c Support uc_mem_protect on mmio regions
Also make mmio ranges return the correct errors on wrong protection
2022-05-28 23:33:43 +02:00
3d3deac5e6 Fix crash when mapping a big memory and calling uc_close 2022-04-16 19:17:41 +02:00
9ff335efdc Fix memory leak of the empty_view 2022-02-12 15:47:25 +01:00
a5ceca6d51 Remove the static variable in flatviews_init
Or we may get an invalid old (and free-ed) uc instance reference
2022-01-15 22:11:14 +01:00
78e0ddbc4d Fix mmio unmap 2021-11-24 00:18:19 +01:00
c1106b811b Fix a memory leak in mmio 2021-11-16 22:44:03 +01:00
fc467edbc6 Fix 32bit target getting wrong offset for mmio 2021-11-16 22:40:57 +01:00
2f61592ff9 Fix uc_mem_protect 2021-11-07 20:37:58 +01:00
76a1b4661c Fix a memory leak due to wrong free order 2021-10-06 10:11:04 +02:00
Nguyen Anh Quynh
aaaea14214 import Unicorn2 2021-10-03 22:14:44 +08:00