Statistics
| Branch: | Revision:

root / linux-user / mmap.c @ feature-archipelago

History | View | Annotate | Download (23.5 kB)

# Date Author Comment
24cb36a6 07/22/2013 09:54 pm Peter Maydell

configure: Make NPTL non-optional

Now all linux-user targets support building with NPTL, we can make it
mandatory. This is a good idea because: * NPTL is no longer new and experimental; it is completely standard * in practice, linux-user without NPTL is nearly useless for...

8384274e 07/05/2013 03:45 pm Jürg Billeter

linux-user: Do not ignore mmap failure from host

File mapping may fail with EACCES.

Signed-off-by: Jürg Billeter <>
Message-id:
Reviewed-by: Peter Maydell <>

a5e7ee46 08/04/2012 07:37 pm Richard Henderson

linux-user: Allocate the right amount of space for non-fixed file maps

If we let the kernel handle the implementation of mmap_find_vma,
via an anon mmap, we must use the size as indicated by the user
and not the size truncated to the filesize.

This happens often in ld.so, where we initially mmap the file to...

77a8f1a5 05/19/2012 06:49 pm Alexander Graf

linux-user: Fix stale tbs after mmap

If we execute linux-user code that does the following:

  • A = mmap()
  • execute code in A
  • munmap(A)
  • B = mmap(), but mmap returns the same address as A
  • execute code in B

we end up executing a stale cached tb that contains translated code...

59e9d91c 04/06/2012 06:49 pm Peter Maydell

linux-user: resolve reserved_va vma downwards

After consulting with Paul Brook, we concluded that it's best to search
the VMA space downwards, so that we don't even get the chance to conflict
with the brk range.

This patch resolves a bunch of allocation conflicts when using -R....

8186e783 05/08/2011 12:02 pm Stefan Weil

Fix typo in comment (truely -> truly)

Signed-off-by: Stefan Weil <>
Signed-off-by: Stefan Hajnoczi <>

4e655712 03/04/2011 12:33 am Peter Maydell

linux-user: fix compile failure if !CONFIG_USE_GUEST_BASE

If CONFIG_USE_GUEST_BASE is not defined, gcc complains:
linux-user/mmap.c:235: error: comparison of unsigned expression >= 0 is always true

because RESERVED_VA is #defined to 0. Since mmap_find_vma_reserved()...

c65ffe6d 12/03/2010 03:09 pm amateur

linux-user: mmap_reserve() not controlled by RESERVED_VA

mmap_reserve() should be called only when RESERVED_VA is enabled.
Otherwise, unmaped virtual address space will never be reusable. This
bug will exhaust virtual address space in extreme conditions....

d0b3e4f5 09/18/2010 08:53 am Blue Swirl

linux-user: fix types in a comparison

-1ul is unsigned long, which does not necessarily match abi_ulong
type.

Fix by using abi_long instead.

This also avoids a warning with GCC flag -Wtype-limits.

Signed-off-by: Blue Swirl <>

18e9ea8a 07/30/2010 10:09 pm Aurelien Jarno

linux-user: fix build on hosts not using guest base

Commit 68a1c816868b3e35a1da698af412b29e61b1948a broke qemu on hosts not
using guest base. It uses reserved_va unconditionally in mmap.c. To
avoid to many #ifdef #endif blocks, define RESERVED_VA as either...

68a1c816 05/29/2010 04:27 am Paul Brook

Pre-allocate guest address space

Allow pre-allocation of the guest virtual address space in usermode emulation.

Signed-off-by: Paul Brook <>

680c877a 05/29/2010 12:27 am Richard Henderson

linux-user: Use qemu-malloc.c.

Since we're no longer setting PAGE_RESERVED, there's no need to
implement qemu_malloc via mmap.

Signed-off-by: Richard Henderson <>
Signed-off-by: Aurelien Jarno <>

2e9a5713 05/05/2010 06:32 pm Paul Brook

Remove PAGE_RESERVED

The usermode PAGE_RESERVED code is not required by the current mmap
implementation, and is already broken when guest_base != 0.
Unfortunately the bsd emulation still uses the old mmap implementation,
so we can't rip it out altogether....

b480d9b7 03/13/2010 01:25 am Paul Brook

Fix usermode virtual address type

Usermode virtual addresses are abi_ulong, not target_ulong.

Signed-off-by: Paul Brook <>

14f24e14 03/12/2010 06:29 pm Richard Henderson

linux-user: Fix mmap_find_vma returning invalid addresses.

Don't return addresses that aren't properly aligned for the guest,
e.g. when the guest has a larger page size than the host. Don't
return addresses that are outside the virtual address space for the...

7bc7b099 03/12/2010 06:29 pm Richard Henderson

linux-user: Use h2g_valid in qemu_vmalloc.

Signed-off-by: Richard Henderson <>

fb7e378c 01/26/2010 10:59 pm Kirill A. Shutemov

linux-user/mmap.c: fix warnings with _FORTIFY_SOURCE

CC i386-linux-user/mmap.o
cc1: warnings being treated as errors
/usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c: In function 'mmap_frag':
/usr/src/RPM/BUILD/qemu-0.11.92/linux-user/mmap.c:253: error: ignoring return value of 'pread', declared with attribute warn_unused_result...

ee636500 01/26/2010 10:59 pm Juan Quintela

mmap_frag() users only check for -1 error

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

dfd3f85c 09/25/2009 10:53 pm Juan Quintela

__thread should be before real type

Signed-off-by: Juan Quintela <>
Signed-off-by: Blue Swirl <>

1e6eec8b 09/05/2009 01:14 pm Blue Swirl

Fix Sparse warnings: add "static"

Signed-off-by: Blue Swirl <>

fe3b4152 08/25/2009 05:15 pm Kirill A. Shutemov

linux-user: Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit targets

qemu's page table can be incomple if /proc/self/maps is unavailable or
host allocating a memory with mmap(), so we can't use it to find free
memory area.

New version mmap_find_vma() uses mmap() without MAP_FIXED to find free...

2f7bb878 07/27/2009 10:10 pm Juan Quintela

rename USE_NPTL to CONFIG_USE_NPTL

Signed-off-by: Juan Quintela <>
Signed-off-by: Anthony Liguori <>

0bf9e31a 07/20/2009 08:19 pm Blue Swirl

Fix most warnings (errors with -Werror) when debugging is enabled

I used the following command to enable debugging:
perl -p -i -e 's/^\/\/#define DEBUG/#define DEBUG/g' * /* *//*

Signed-off-by: Blue Swirl <>

8167ee88 07/16/2009 11:47 pm Blue Swirl

Update to a hopefully more future proof FSF address

Signed-off-by: Blue Swirl <>

df377d03 06/16/2009 04:58 pm Nathan Froyd

linux-user: initialize mmap_mutex properly

We initialize mmap_mutex in any child threads/processes, but we need to
correctly statically initialize it for the original process.

Signed-off-by: Nathan Froyd <>
Signed-off-by: Riku Voipio <>

9ad197d9 06/16/2009 04:56 pm Riku Voipio

export mmap_find_vma for shmat

Signed-off-by: Riku Voipio <>

54c5a2ae 02/04/2009 01:06 am edgar_igl

Partialy fix mmap at EOF for large pagesize targets in user-mode.

Signed-off-by: Edgar E. Iglesias <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6510 c046a42c-6fe2-441c-8c8c-71466251a162

baa8c602 01/28/2009 07:16 pm malc

Fix qemu_malloc.

make {linux,bsd}-user qemu_realloc handle ptr == NULL correctly.
spotted by malc.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6466 c046a42c-6fe2-441c-8c8c-71466251a162

1a6f0dbc 01/23/2009 05:02 pm aliguori

linux-user: add qemu_realloc() implementation to unbreak the build (Gerd Hoffman)

Signed-off-by: Gerd Hoffmann <>
Signed-off-by: Anthony Liguori <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6412 c046a42c-6fe2-441c-8c8c-71466251a162

530e7615 01/05/2009 08:11 pm blueswir1

Fix more FSF addresses

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6192 c046a42c-6fe2-441c-8c8c-71466251a162

3af72a4d 12/15/2008 07:58 pm blueswir1

Fix mremap, based on patch by Kirill A. Shutemov

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6056 c046a42c-6fe2-441c-8c8c-71466251a162

5caf7bb2 12/11/2008 09:12 pm blueswir1

Fix compiling without MREMAP_FIXED

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5979 c046a42c-6fe2-441c-8c8c-71466251a162

f19412a2 12/08/2008 08:12 pm aurel32

linux-user: mremap(): handle MREMAP_FIXED and MREMAP_MAYMOVE correctly

Signed-off-by: Kirill A. Shutemov <>
Acked-by: Edgar E. Iglesias <>
Signed-off-by: Aurelien Jarno <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5959 c046a42c-6fe2-441c-8c8c-71466251a162

45bc1f52 12/08/2008 08:12 pm aurel32

linux-user: mmap: add check if requested memory area fits target address space

Signed-off-by: Kirill A. Shutemov <>
Acked-by: Edgar E. Iglesias <>
Signed-off-by: Aurelien Jarno <>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5958 c046a42c-6fe2-441c-8c8c-71466251a162

78f5bf1e 10/02/2008 10:55 pm blueswir1

Include qemu-common.h in order to get prototypes for qemu_malloc etc.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5402 c046a42c-6fe2-441c-8c8c-71466251a162

17e2377a 06/09/2008 04:47 pm pbrook

Prevent guest reusing host memory allocations.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4710 c046a42c-6fe2-441c-8c8c-71466251a162

d5975363 06/07/2008 11:50 pm pbrook

Multithreaded locking fixes.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4692 c046a42c-6fe2-441c-8c8c-71466251a162

c8a706fe 06/02/2008 07:16 pm pbrook

Multithreaded locking for mmap().

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4654 c046a42c-6fe2-441c-8c8c-71466251a162

0776590d 05/31/2008 07:33 pm pbrook

Mark host brk() area as reserved.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4637 c046a42c-6fe2-441c-8c8c-71466251a162

7ab240ad 04/26/2008 03:17 pm balrog

Teach mmap to not overwrite reserved pages and fix brk return value (Richard Purdie).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4255 c046a42c-6fe2-441c-8c8c-71466251a162

171cd1cd 04/25/2008 12:11 am balrog

Cope with arch-specific page protection flags in mmap (Richard Purdie).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4250 c046a42c-6fe2-441c-8c8c-71466251a162

2e0ded9c 03/14/2008 04:11 pm edgar_igl

Use TARGET_FMT_lx.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4061 c046a42c-6fe2-441c-8c8c-71466251a162

50a9569b 12/12/2007 03:16 am balrog

Mark host pages as reserved (Magnus Damm).

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3813 c046a42c-6fe2-441c-8c8c-71466251a162

a03e2d42 11/14/2007 01:29 pm bellard

fixed target_mmap() if host page size < TARGET_PAGE_SIZE

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3642 c046a42c-6fe2-441c-8c8c-71466251a162

80210bcd 11/02/2007 09:08 pm ths

Fix compiler warnings, by Stefan Weil.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3507 c046a42c-6fe2-441c-8c8c-71466251a162

992f48a0 10/14/2007 07:27 pm blueswir1

Support for 32 bit ABI on 64 bit targets (only enabled Sparc64)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3396 c046a42c-6fe2-441c-8c8c-71466251a162

a5b85f79 09/30/2007 05:32 pm ths

Fix mmap to handle differing host/target page sizes, by Edgar E. Iglesias.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3291 c046a42c-6fe2-441c-8c8c-71466251a162

4118a970 09/27/2007 07:10 am j_mayer

memset string pages to zero to avoid putting random data on the stack
that may make some program crash at startup.
Fix unsigned long / target_ulong confusion (more to do).
Fix missing g2h macros.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3249 c046a42c-6fe2-441c-8c8c-71466251a162

3b46e624 09/17/2007 11:09 am ths

find -type f | xargs sed -i 's/[\t ]*$//g' # Yes, again. Note the star in the regex.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3177 c046a42c-6fe2-441c-8c8c-71466251a162

5fafdf24 09/17/2007 12:08 am ths

find -type f | xargs sed -i 's/[\t ]$//g' # on most files

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3173 c046a42c-6fe2-441c-8c8c-71466251a162

6b078dfd 06/03/2007 06:31 pm ths

Add _mips_to mmap specialcase.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2932 c046a42c-6fe2-441c-8c8c-71466251a162

e6e5906b 10/22/2006 03:18 am pbrook

ColdFire target.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2196 c046a42c-6fe2-441c-8c8c-71466251a162

53a5960a 03/25/2006 09:31 pm pbrook

Avoid accessing guest memory directly in usermode emulation.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1790 c046a42c-6fe2-441c-8c8c-71466251a162

e89f07d3 02/04/2006 10:46 pm pbrook

Make target_mmap always return -1 on failure.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1741 c046a42c-6fe2-441c-8c8c-71466251a162

b8076a74 04/08/2005 01:20 am bellard

ia64 host support (David Mosberger)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1360 c046a42c-6fe2-441c-8c8c-71466251a162

83fb7adf 07/06/2004 12:25 am bellard

Darwin patch (initial patch by Pierre d'Herbemont)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@980 c046a42c-6fe2-441c-8c8c-71466251a162

4f2ac237 04/26/2004 10:44 pm bellard

amd64 port (Jocelyn Mayer)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@762 c046a42c-6fe2-441c-8c8c-71466251a162

bc51c5c9 03/18/2004 01:46 am bellard

initial x86-64 host support (Gwenole Beauchesne)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@670 c046a42c-6fe2-441c-8c8c-71466251a162

4a585ccb 06/09/2003 06:24 pm bellard

avoid unaligned file offset in anonymous mapping

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@215 c046a42c-6fe2-441c-8c8c-71466251a162

917f95fd 06/05/2003 03:56 am bellard

alpha fix

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@207 c046a42c-6fe2-441c-8c8c-71466251a162

d418c81e 05/13/2003 03:57 am bellard

fixed small page handling

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@160 c046a42c-6fe2-441c-8c8c-71466251a162

54936004 05/13/2003 03:25 am bellard

mmap emulation

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@158 c046a42c-6fe2-441c-8c8c-71466251a162