diff options
| author | Camille Mougey <commial@gmail.com> | 2016-02-19 17:11:45 +0100 |
|---|---|---|
| committer | Camille Mougey <commial@gmail.com> | 2016-02-19 17:11:45 +0100 |
| commit | 55cc4ec75424a841748b62e230a1abb01b258014 (patch) | |
| tree | 19e7d45234338c20f5c1f9a753c057a4c32e5749 /miasm2/jitter/loader/elf.py | |
| parent | 91e9abd906c0a9f5b43bad5b9789ffa1b054f6fe (diff) | |
| parent | f242f79868dbd80ea319e2ae97bb44ba11270400 (diff) | |
| download | miasm-55cc4ec75424a841748b62e230a1abb01b258014.tar.gz miasm-55cc4ec75424a841748b62e230a1abb01b258014.zip | |
Merge pull request #327 from serpilliere/vm_name_area
Vm name area
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) |