mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
Move VG_(get_memory_from_mmap_for_client) out of m_aspacemgr into
m_libcmman, next to VG_(get_memory_from_mmap). Removes the (direct) dependence of m_mallocfree on m_aspacemgr. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3962
This commit is contained in:
parent
d618b2572c
commit
8fc121f908
@ -1372,28 +1372,9 @@ Bool VG_(is_addressable)(Addr p, SizeT size, UInt prot)
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*--- Manage allocation of memory on behalf of the client ---*/
|
||||
/*--- Random function that doesn't really belong here ---*/
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
// Returns 0 on failure.
|
||||
Addr VG_(get_memory_from_mmap_for_client)
|
||||
(Addr addr, SizeT len, UInt prot, UInt sf_flags)
|
||||
{
|
||||
len = VG_PGROUNDUP(len);
|
||||
|
||||
tl_assert(!(sf_flags & SF_FIXED));
|
||||
tl_assert(0 == addr);
|
||||
|
||||
addr = (Addr)VG_(mmap)((void *)addr, len, prot,
|
||||
VKI_MAP_PRIVATE | VKI_MAP_ANONYMOUS | VKI_MAP_CLIENT,
|
||||
sf_flags | SF_CORE, -1, 0);
|
||||
if ((Addr)-1 != addr)
|
||||
return addr;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* We'll call any RW mmaped memory segment, within the client address
|
||||
range, which isn't SF_CORE, a root.
|
||||
*/
|
||||
|
||||
@ -166,6 +166,25 @@ void* VG_(get_memory_from_mmap) ( SizeT nBytes, Char* who )
|
||||
VG_(exit)(1);
|
||||
}
|
||||
|
||||
// Returns 0 on failure.
|
||||
Addr VG_(get_memory_from_mmap_for_client)
|
||||
(Addr addr, SizeT len, UInt prot, UInt sf_flags)
|
||||
{
|
||||
len = VG_PGROUNDUP(len);
|
||||
|
||||
tl_assert(!(sf_flags & SF_FIXED));
|
||||
tl_assert(0 == addr);
|
||||
|
||||
addr = (Addr)VG_(mmap)((void *)addr, len, prot,
|
||||
VKI_MAP_PRIVATE | VKI_MAP_ANONYMOUS | VKI_MAP_CLIENT,
|
||||
sf_flags | SF_CORE, -1, 0);
|
||||
if ((Addr)-1 != addr)
|
||||
return addr;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/*--- end ---*/
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
@ -30,7 +30,6 @@
|
||||
*/
|
||||
|
||||
#include "pub_core_basics.h"
|
||||
#include "pub_core_aspacemgr.h"
|
||||
#include "pub_core_libcbase.h"
|
||||
#include "pub_core_libcassert.h"
|
||||
#include "pub_core_libcmman.h"
|
||||
|
||||
@ -145,9 +145,6 @@ extern VGA_REGPARM(2)
|
||||
/* Return string for prot */
|
||||
extern const HChar *VG_(prot_str)(UInt prot);
|
||||
|
||||
extern Addr VG_(get_memory_from_mmap_for_client)
|
||||
(Addr base, SizeT len, UInt prot, UInt flags);
|
||||
|
||||
/* Parses /proc/self/maps, calling `record_mapping' for each entry. */
|
||||
extern
|
||||
void VG_(parse_procselfmaps) (
|
||||
|
||||
@ -48,6 +48,9 @@ extern SysRes VG_(mmap_native) ( void* start, SizeT length, UInt prot,
|
||||
extern SysRes VG_(munmap_native) ( void* start, SizeT length );
|
||||
extern SysRes VG_(mprotect_native) ( void *start, SizeT length, UInt prot );
|
||||
|
||||
extern Addr VG_(get_memory_from_mmap_for_client)
|
||||
(Addr base, SizeT len, UInt prot, UInt flags);
|
||||
|
||||
#endif // __PUB_CORE_LIBCMMAN_H
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user