diff mbox

flatload: fix bss clearing

Message ID 1341839097-4074-1-git-send-email-vapier@gentoo.org
State New
Headers show

Commit Message

Mike Frysinger July 9, 2012, 1:04 p.m. UTC
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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 linux-user/flatload.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Peter Maydell July 9, 2012, 1:11 p.m. UTC | #1
On 9 July 2012 14:04, Mike Frysinger <vapier@gentoo.org> wrote:
> 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.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM
Andreas Färber July 9, 2012, 1:21 p.m. UTC | #2
Hi Mike,

Am 09.07.2012 15:04, schrieb Mike Frysinger:
> 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.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  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
Mike Frysinger July 10, 2012, 5:59 a.m. UTC | #3
On Monday 09 July 2012 09:21:52 Andreas Färber wrote:
> Am 09.07.2012 15:04, schrieb Mike Frysinger:
> > 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
diff mbox

Patch

diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index be79496..58f679e 100644
--- a/linux-user/flatload.c
+++ b/linux-user/flatload.c
@@ -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;
 }