Commit graph

31 commits

Author SHA1 Message Date
Chris Eagle fccbcfd4c2 revert to use of g_free to make future qemu integrations easier (#695)
* revert to use of g_free to make future qemu integrations easier

* bracing
2016-12-21 22:28:36 +08:00
Chris Eagle e46545f722 remove glib dependency by provide compatible replacements 2016-12-18 14:56:58 -08:00
Fish ad7ae63e92 Remove unmapped/freed memory regions from the object property list.
This commit fixes the following issues:
- Any unmapped/free'd memory regions (MemoryRegion instances) are not
  removed from the object property linked list of its owner (which is
  always qdev_get_machine(uc)). This issue makes adding new memory
  mapping by calling mem_map() or mem_map_ptr() slower as more and more
  memory pages are mapped and unmapped - yes, even if those memory pages
  are unmapped, they still impact the speed of future memory page
  mappings due to this issue.
- FlatView is not reconstructed after a memory region is freed during
  unmapping, which leads to a use-after-free the next time a new memory
  region is mapped in address_space_update_topology().
2016-10-20 03:48:58 -07:00
Nguyen Anh Quynh 8b030ae51a fix for issue #523 2016-08-27 21:49:11 +08:00
Nguyen Anh Quynh b69feb8d0b Merge branch 'master' into memleak2 2016-02-15 15:52:10 +08:00
coco 95beec805c fixed memcpy that should be memmove 2016-02-11 16:38:50 +01:00
farmdve 036763d6ae Fix memory leaks as reported by DrMemory and Valgrind.
ARM and probably the rest of the arches have significant memory leaks as
they have no release interface.

Additionally, DrMemory does not have 64-bit support and thus I can't
test the 64-bit version under Windows. Under Linux valgrind supports
both 32-bit and 64-bit but there are different macros and code for Linux
and Windows.
2016-01-08 01:42:56 +02:00
Nguyen Anh Quynh 771f9f7c3b fix conflicts when merging map-ptr branch to master branch 2015-12-17 08:12:02 +08:00
farmdve 8b79a872d0 Fix segfault introduced in my previous commits. 2015-12-11 22:35:25 +02:00
Nguyen Anh Quynh 74986cc59a g_free() can handle NULL pointer 2015-12-11 11:25:35 +08:00
farmdve 3e57615c76 Fix uc_mem_unmap memory leak and in uc_close.
It appears the problem is that we are not calling the memory region
destructor. After modifying memory_unmap to include the destructor call
for the memory region, the memory is freed.

Furthermore in uc_close we must explicitly free any blocks that were not
unmapped by the user to prevent leaks.

This should fix issue 305.
2015-12-11 02:42:31 +02:00
Ryan Hileman 230cbd5330 add permissions to map_ptr api 2015-11-28 11:28:31 -08:00
Nguyen Anh Quynh 4a759cebb5 set permission for memory region allocated by memory_map_ptr(). this fixes the segfault in sample_x86.c, function test_x86_map_ptr() 2015-11-28 17:11:27 +08:00
Ryan Hileman 6d21ebabea implement host-controlled memory mapping for #261 2015-11-27 23:30:36 -08:00
Nguyen Anh Quynh 272293556a do not abort() when memory is insufficient. this fixes issue #244 2015-11-10 11:44:29 +08:00
Nguyen Anh Quynh b66a323b19 do not free MemoryRegion in memory_unmap() because it will be unref later in memory_region_unref(). this fixes issue #202 2015-10-28 01:26:59 +08:00
Chris Eagle 8cfd902e4b Move mem_xxx samples to regress. Add check to only flush tlb when unmapping if there is a current cpu 2015-09-04 00:48:24 -07:00
Chris Eagle 2da46caef7 smooth out split_region related code 2015-09-03 12:26:36 -07:00
Chris Eagle b27e987932 Add target_page_size member to uc_struct to track TARGET_PAGE_SIZE 2015-08-31 01:00:44 -07:00
Chris Eagle 410e317e92 dont use explicit page size, use TARGET_PAGE_SIZE 2015-08-30 21:24:14 -07:00
Chris Eagle 0a60fa4c8a fix perms 2015-08-30 00:22:49 -07:00
Chris Eagle 942de0f2ae implemented basic block splitting, uc_mem_unmap should work for sub=blocks or across contiguous blocks 2015-08-30 00:22:18 -07:00
Chris Eagle 4a680b9277 Merge branch 'master' into mem_map_ex_cse 2015-08-29 21:22:33 -07:00
Chris Eagle 6beb1b8a13 intermediate commit, working unmap of complete blocks, still need sub-blocks, and cross block 2015-08-29 21:17:30 -07:00
Nguyen Anh Quynh c23d387e2f remove redundant uc_struct.ram 2015-08-30 10:51:28 +08:00
Nguyen Anh Quynh 3b5df362d7 chmod -x <some source code> 2015-08-28 18:12:56 +08:00
Chris Eagle 9530b2daff Remove MemoryBlock struct by consolidating in MemoryRegion. add new API uc_mem_protect. Add regress/mem_protect.c. Drop UC_PROT_EXEC for time being 2015-08-27 23:19:32 -07:00
Chris Eagle 686acb7e6e Detect all occurences of write to read only page. Add callback capability on write to read only. Add new error type UC_ERR_MEM_WRITE_RO and new access type UC_MEM_WRITE_RO for use in callback 2015-08-27 18:03:17 -07:00
Chris Eagle 4b529bc56c Free up all MemoryRegion* when uc is closed 2015-08-26 14:09:46 -07:00
Chris Eagle 00944b6cde Add ability to mark memory are read only. Add new API uc_mem_map_ex to allow permissions to be passed. Change MemoryBlock to track created MemoryRegions. Add regress/ro_mem_test.c 2015-08-26 13:29:54 -07:00
Nguyen Anh Quynh 344d016104 import 2015-08-21 15:04:50 +08:00