diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2016-02-16 08:46:55 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2016-02-19 16:05:16 +0100 |
| commit | a7f4a0efdddb72bd994b5dc219b1374a616a50ce (patch) | |
| tree | d8a4d7d032d65204c498601b09fdcf697463d19c /miasm2/jitter/loader/elf.py | |
| parent | 34039011459c729a93a79deea1d3c5000bc03032 (diff) | |
| download | miasm-a7f4a0efdddb72bd994b5dc219b1374a616a50ce.tar.gz miasm-a7f4a0efdddb72bd994b5dc219b1374a616a50ce.zip | |
Jitter/vm: Suppport memory comment
Diffstat (limited to 'miasm2/jitter/loader/elf.py')
| -rw-r--r-- | miasm2/jitter/loader/elf.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/miasm2/jitter/loader/elf.py b/miasm2/jitter/loader/elf.py index 08df632a..db0f1cb7 100644 --- a/miasm2/jitter/loader/elf.py +++ b/miasm2/jitter/loader/elf.py @@ -47,7 +47,7 @@ def preload_elf(vm, e, runtime_lib, patch_vm_imp=True): return runtime_lib, dyn_funcs -def vm_load_elf(vm, fdata, **kargs): +def vm_load_elf(vm, fdata, name="", **kargs): """ Very dirty elf loader TODO XXX: implement real loader @@ -56,6 +56,7 @@ def vm_load_elf(vm, fdata, **kargs): e = elf_init.ELF(fdata, **kargs) i = interval() all_data = {} + for p in e.ph.phlist: if p.ph.type != elf_csts.PT_LOAD: continue @@ -72,7 +73,8 @@ def vm_load_elf(vm, fdata, **kargs): i += [(a_addr, b_addr - 2)] for a, b in i.intervals: # print hex(a), hex(b) - vm.add_memory_page(a, PAGE_READ | PAGE_WRITE, "\x00" * (b + 2 - a)) + vm.add_memory_page(a, PAGE_READ | PAGE_WRITE, "\x00" * (b + 2 - a), + repr(name)) for r_vaddr, data in all_data.items(): vm.set_mem(r_vaddr, data) |