Skip to contentSkip to conversation

flatload: fix bss clearing

PATCH In review Mike Frysinger 3 participants 4 messages Jul 9, 2012 – Jul 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 flatload: fix bss clearing

The current bss clear logic assumes the target mmap address and host address are the same. Use g2h to translate from the target address space to the host so we can call memset on it.

---
 linux-user/flatload.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
linux-user/flatload.c +1 -1
index be79496..58f679e 100644
@@ -660,7 +660,7 @@ static int load_flat_file(struct linux_binprm * bprm,
     }
 
     /* zero the BSS.  */
-    memset((void *)((unsigned long)datapos + data_len), 0, bss_len);
+    memset(g2h(datapos + data_len), 0, bss_len);
 
     return 0;
 }
Signature · 1 line
1.7.7.3
#2 lore raw
In reply to Mike Frysinger

Hi Mike,

Am 09.07.2012 15:04, schrieb Mike Frysinger:

Quoted 8 lines

The current bss clear logic assumes the target mmap address and host address are the same. Use g2h to translate from the target address space to the host so we can call memset on it.

---
 linux-user/flatload.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch looks sensible. Are you working on rebasing your Blackfin target to QOM and AREG0?

Cheers,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw
Quoted 7 lines · On Monday 09 July 2012 09:21:52 Andreas Färber wrote:

Am 09.07.2012 15:04, schrieb Mike Frysinger:

Quoted 3 lines

The current bss clear logic assumes the target mmap address and host address are the same. Use g2h to translate from the target address space to the host so we can call memset on it.

Patch looks sensible. Are you working on rebasing your Blackfin target to QOM and AREG0?

i've rebased them to the latest release (1.1.0). FDPIC seems to work fine, as does basic ELF, but FLAT gets into an infinite loop and i haven't figured out why just yet.
-mike