1999-02-19 03:21:36 +03:00
/*
* Copyright ( c ) 1991 , 1992 Paul Kranenburg < pk @ cs . few . eur . nl >
* Copyright ( c ) 1993 Branko Lankester < branko @ hacktic . nl >
* Copyright ( c ) 1993 , 1994 , 1995 , 1996 Rick Sladkey < jrs @ world . std . com >
1999-12-23 17:20:14 +03:00
* Copyright ( c ) 1996 - 1999 Wichert Akkerman < wichert @ cistron . nl >
2003-06-02 23:18:58 +04:00
* Copyright ( c ) 2000 PocketPenguins Inc . Linux for Hitachi SuperH
* port by Greg Banks < gbanks @ pocketpenguins . com >
1999-02-19 03:21:36 +03:00
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions
* are met :
* 1. Redistributions of source code must retain the above copyright
* notice , this list of conditions and the following disclaimer .
* 2. Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` ` AS IS ' ' AND ANY EXPRESS OR
* IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED .
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT ,
* INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES ( INCLUDING , BUT
* NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE ,
* DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
* ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
*/
# include "defs.h"
2004-03-02 09:16:59 +03:00
# include <asm/mman.h>
1999-05-09 04:29:58 +04:00
# include <sys/mman.h>
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
2015-03-31 22:45:08 +03:00
unsigned long
get_pagesize ( void )
2013-03-05 18:58:24 +04:00
{
static unsigned long pagesize ;
if ( ! pagesize )
pagesize = sysconf ( _SC_PAGESIZE ) ;
return pagesize ;
}
1999-02-19 03:21:36 +03:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( brk )
1999-02-19 03:21:36 +03:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
printaddr ( tcp - > u_arg [ 0 ] ) ;
return RVAL_DECODED | RVAL_HEX ;
1999-02-19 03:21:36 +03:00
}
2014-04-26 03:30:54 +04:00
# include "xlat/mmap_prot.h"
# include "xlat/mmap_flags.h"
1999-02-19 03:21:36 +03:00
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
static void
2013-02-18 05:36:36 +04:00
print_mmap ( struct tcb * tcp , long * u_arg , unsigned long long offset )
1999-02-19 03:21:36 +03:00
{
2016-04-01 18:31:23 +03:00
const unsigned long addr = u_arg [ 0 ] ;
const unsigned long len = u_arg [ 1 ] ;
const unsigned long prot = u_arg [ 2 ] ;
const unsigned long flags = u_arg [ 3 ] ;
const int fd = u_arg [ 4 ] ;
printaddr ( addr ) ;
tprintf ( " , %lu, " , len ) ;
printflags ( mmap_prot , prot , " PROT_??? " ) ;
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
tprints ( " , " ) ;
2000-09-02 01:03:06 +04:00
# ifdef MAP_TYPE
2016-04-01 18:31:23 +03:00
printxval ( mmap_flags , flags & MAP_TYPE , " MAP_??? " ) ;
addflags ( mmap_flags , flags & ~ MAP_TYPE ) ;
2000-09-02 01:03:06 +04:00
# else
2016-04-01 18:31:23 +03:00
printflags ( mmap_flags , flags , " MAP_??? " ) ;
2000-09-02 01:03:06 +04:00
# endif
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
tprints ( " , " ) ;
2016-04-01 18:31:23 +03:00
printfd ( tcp , fd ) ;
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
tprintf ( " , %#llx " , offset ) ;
1999-02-19 03:21:36 +03:00
}
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
/* Syscall name<->function correspondence is messed up on many arches.
* For example :
* i386 has __NR_mmap = = 90 , and it is " old mmap " , and
* also it has __NR_mmap2 = = 192 , which is a " new mmap with page offsets " .
* But x86_64 has just one __NR_mmap = = 9 , a " new mmap with byte offsets " .
* Confused ? Me too !
*/
2016-04-23 02:36:26 +03:00
# if defined AARCH64 || defined ARM \
| | defined I386 | | defined X86_64 | | defined X32 \
| | defined M68K \
| | defined S390 | | defined S390X
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
/* Params are pointed to by u_arg[0], offset is in bytes */
2015-04-07 04:36:50 +03:00
SYS_FUNC ( old_mmap )
1999-12-23 17:20:14 +03:00
{
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
long u_arg [ 6 ] ;
2016-04-23 02:36:26 +03:00
# if defined(X86_64)
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
/* We are here only in personality 1 (i386) */
int i ;
unsigned narrow_arg [ 6 ] ;
2015-03-21 21:50:53 +03:00
if ( umoven ( tcp , tcp - > u_arg [ 0 ] , sizeof ( narrow_arg ) , narrow_arg ) = = - 1 )
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
return 0 ;
for ( i = 0 ; i < 6 ; + + i )
u_arg [ i ] = ( unsigned long ) narrow_arg [ i ] ;
2016-04-23 02:36:26 +03:00
# else
2015-03-21 21:50:53 +03:00
if ( umoven ( tcp , tcp - > u_arg [ 0 ] , sizeof ( u_arg ) , u_arg ) = = - 1 )
2008-12-30 21:47:55 +03:00
return 0 ;
2016-04-23 02:36:26 +03:00
# endif
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
print_mmap ( tcp , u_arg , ( unsigned long ) u_arg [ 5 ] ) ;
return RVAL_DECODED | RVAL_HEX ;
1999-12-23 17:20:14 +03:00
}
2016-04-23 02:36:26 +03:00
# endif /* old_mmap architectures */
1999-12-23 17:20:14 +03:00
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
# if defined(S390)
/* Params are pointed to by u_arg[0], offset is in pages */
2015-04-07 04:36:50 +03:00
SYS_FUNC ( old_mmap_pgoff )
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
{
long u_arg [ 5 ] ;
int i ;
unsigned narrow_arg [ 6 ] ;
unsigned long long offset ;
2015-03-21 21:50:53 +03:00
if ( umoven ( tcp , tcp - > u_arg [ 0 ] , sizeof ( narrow_arg ) , narrow_arg ) = = - 1 )
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
return 0 ;
for ( i = 0 ; i < 5 ; i + + )
u_arg [ i ] = ( unsigned long ) narrow_arg [ i ] ;
offset = narrow_arg [ 5 ] ;
2013-03-05 18:58:24 +04:00
offset * = get_pagesize ( ) ;
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
print_mmap ( tcp , u_arg , offset ) ;
return RVAL_DECODED | RVAL_HEX ;
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
}
# endif
/* Params are passed directly, offset is in bytes */
2015-04-07 04:36:50 +03:00
SYS_FUNC ( mmap )
1999-12-23 17:20:14 +03:00
{
2013-02-18 06:13:07 +04:00
unsigned long long offset = ( unsigned long ) tcp - > u_arg [ 5 ] ;
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
# if defined(LINUX_MIPSN32) || defined(X32)
2013-02-18 06:13:07 +04:00
/* Try test/x32_mmap.c */
2008-12-30 21:47:55 +03:00
offset = tcp - > ext_arg [ 5 ] ;
2003-06-02 23:18:58 +04:00
# endif
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
/* Example of kernel-side handling of this variety of mmap:
* arch / x86 / kernel / sys_x86_64 . c : : SYSCALL_DEFINE6 ( mmap , . . . ) calls
* sys_mmap_pgoff ( . . . , off > > PAGE_SHIFT ) ; i . e . off is in bytes ,
* since the above code converts off to pages .
*/
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
print_mmap ( tcp , tcp - > u_arg , offset ) ;
return RVAL_DECODED | RVAL_HEX ;
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
}
/* Params are passed directly, offset is in pages */
2015-04-07 04:36:50 +03:00
SYS_FUNC ( mmap_pgoff )
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
{
/* Try test/mmap_offset_decode.c */
unsigned long long offset ;
offset = ( unsigned long ) tcp - > u_arg [ 5 ] ;
2013-03-05 18:58:24 +04:00
offset * = get_pagesize ( ) ;
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
print_mmap ( tcp , tcp - > u_arg , offset ) ;
return RVAL_DECODED | RVAL_HEX ;
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
}
/* Params are passed directly, offset is in 4k units */
2015-04-07 04:36:50 +03:00
SYS_FUNC ( mmap_4koff )
Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!
It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.
Then we just insert correct function pointers into
arch syscall tables.
It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.
A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.
There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.
* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 14:28:20 +04:00
{
unsigned long long offset ;
offset = ( unsigned long ) tcp - > u_arg [ 5 ] ;
offset < < = 12 ;
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
print_mmap ( tcp , tcp - > u_arg , offset ) ;
return RVAL_DECODED | RVAL_HEX ;
1999-12-23 17:20:14 +03:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( munmap )
1999-02-19 03:21:36 +03:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
printaddr ( tcp - > u_arg [ 0 ] ) ;
tprintf ( " , %lu " , tcp - > u_arg [ 1 ] ) ;
return RVAL_DECODED ;
1999-02-19 03:21:36 +03:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( mprotect )
1999-02-19 03:21:36 +03:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
printaddr ( tcp - > u_arg [ 0 ] ) ;
tprintf ( " , %lu, " , tcp - > u_arg [ 1 ] ) ;
printflags ( mmap_prot , tcp - > u_arg [ 2 ] , " PROT_??? " ) ;
return RVAL_DECODED ;
1999-02-19 03:21:36 +03:00
}
2014-04-26 03:30:54 +04:00
# include "xlat/mremap_flags.h"
1999-05-09 04:29:58 +04:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( mremap )
1999-05-09 04:29:58 +04:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
printaddr ( tcp - > u_arg [ 0 ] ) ;
tprintf ( " , %lu, %lu, " , tcp - > u_arg [ 1 ] , tcp - > u_arg [ 2 ] ) ;
printflags ( mremap_flags , tcp - > u_arg [ 3 ] , " MREMAP_??? " ) ;
2009-12-25 02:34:58 +03:00
# ifdef MREMAP_FIXED
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
if ( ( tcp - > u_arg [ 3 ] & ( MREMAP_MAYMOVE | MREMAP_FIXED ) ) = =
( MREMAP_MAYMOVE | MREMAP_FIXED ) ) {
tprints ( " , " ) ;
printaddr ( tcp - > u_arg [ 4 ] ) ;
1999-05-09 04:29:58 +04:00
}
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
# endif
return RVAL_DECODED | RVAL_HEX ;
1999-05-09 04:29:58 +04:00
}
2014-04-26 03:30:54 +04:00
# include "xlat/madvise_cmds.h"
2000-04-11 02:22:31 +04:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( madvise )
2000-04-11 02:22:31 +04:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
printaddr ( tcp - > u_arg [ 0 ] ) ;
tprintf ( " , %lu, " , tcp - > u_arg [ 1 ] ) ;
printxval ( madvise_cmds , tcp - > u_arg [ 2 ] , " MADV_??? " ) ;
return RVAL_DECODED ;
2000-04-11 02:22:31 +04:00
}
2014-04-26 03:30:54 +04:00
# include "xlat/mlockall_flags.h"
2000-04-11 02:22:31 +04:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( mlockall )
2000-04-11 02:22:31 +04:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
printflags ( mlockall_flags , tcp - > u_arg [ 0 ] , " MCL_??? " ) ;
return RVAL_DECODED ;
2000-04-11 02:22:31 +04:00
}
2014-04-26 03:30:54 +04:00
# include "xlat/mctl_sync.h"
1999-02-19 03:21:36 +03:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( msync )
1999-02-19 03:21:36 +03:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
/* addr */
printaddr ( tcp - > u_arg [ 0 ] ) ;
/* len */
tprintf ( " , %lu, " , tcp - > u_arg [ 1 ] ) ;
/* flags */
printflags ( mctl_sync , tcp - > u_arg [ 2 ] , " MS_??? " ) ;
return RVAL_DECODED ;
1999-02-19 03:21:36 +03:00
}
2015-11-15 05:35:57 +03:00
# include "xlat/mlock_flags.h"
SYS_FUNC ( mlock2 )
{
printaddr ( tcp - > u_arg [ 0 ] ) ;
tprintf ( " , %lu, " , tcp - > u_arg [ 1 ] ) ;
printflags ( mlock_flags , tcp - > u_arg [ 2 ] , " MLOCK_??? " ) ;
return RVAL_DECODED ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( mincore )
1999-02-19 03:21:36 +03:00
{
if ( entering ( tcp ) ) {
mem.c: use printaddr and umove_or_printaddr
* mem.c (sys_brk, print_mmap, sys_munmap, sys_mprotect, sys_mremap,
sys_madvise, sys_msync, sys_mincore, sys_remap_file_pages, get_nodes,
sys_mbind, [POWERPC] sys_subpage_prot): Use printaddr.
(sys_get_mempolicy): Use printaddr and umove_or_printaddr.
2015-07-20 02:25:56 +03:00
printaddr ( tcp - > u_arg [ 0 ] ) ;
tprintf ( " , %lu, " , tcp - > u_arg [ 1 ] ) ;
1999-02-19 03:21:36 +03:00
} else {
2016-01-29 04:51:54 +03:00
const unsigned long page_size = get_pagesize ( ) ;
const unsigned long page_mask = page_size - 1 ;
unsigned long len = tcp - > u_arg [ 1 ] ;
unsigned char * vec = NULL ;
2011-08-31 16:00:02 +04:00
2016-01-29 04:51:54 +03:00
len = len / page_size + ( len & page_mask ? 1 : 0 ) ;
mem.c: use printaddr and umove_or_printaddr
* mem.c (sys_brk, print_mmap, sys_munmap, sys_mprotect, sys_mremap,
sys_madvise, sys_msync, sys_mincore, sys_remap_file_pages, get_nodes,
sys_mbind, [POWERPC] sys_subpage_prot): Use printaddr.
(sys_get_mempolicy): Use printaddr and umove_or_printaddr.
2015-07-20 02:25:56 +03:00
if ( syserror ( tcp ) | | ! verbose ( tcp ) | |
! tcp - > u_arg [ 2 ] | | ! ( vec = malloc ( len ) ) | |
umoven ( tcp , tcp - > u_arg [ 2 ] , len , vec ) < 0 )
printaddr ( tcp - > u_arg [ 2 ] ) ;
1999-02-19 03:21:36 +03:00
else {
2016-01-29 04:51:54 +03:00
unsigned long i ;
2011-09-01 12:00:28 +04:00
tprints ( " [ " ) ;
1999-02-19 03:21:36 +03:00
for ( i = 0 ; i < len ; i + + ) {
if ( abbrev ( tcp ) & & i > = max_strlen ) {
2011-09-01 12:00:28 +04:00
tprints ( " ... " ) ;
1999-02-19 03:21:36 +03:00
break ;
}
2011-09-01 12:00:28 +04:00
tprints ( ( vec [ i ] & 1 ) ? " 1 " : " 0 " ) ;
1999-02-19 03:21:36 +03:00
}
2011-09-01 12:00:28 +04:00
tprints ( " ] " ) ;
1999-02-19 03:21:36 +03:00
}
2011-08-31 16:00:02 +04:00
free ( vec ) ;
1999-02-19 03:21:36 +03:00
}
return 0 ;
}
2015-07-21 18:55:09 +03:00
# if defined ALPHA || defined IA64 || defined M68K \
| | defined SPARC | | defined SPARC64
2015-04-07 04:36:50 +03:00
SYS_FUNC ( getpagesize )
1999-02-19 03:21:36 +03:00
{
2016-01-08 22:20:05 +03:00
return RVAL_DECODED | RVAL_HEX ;
1999-02-19 03:21:36 +03:00
}
2012-02-25 05:38:52 +04:00
# endif
1999-02-19 03:21:36 +03:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( remap_file_pages )
2003-03-05 07:08:00 +03:00
{
2016-04-01 18:31:23 +03:00
const unsigned long addr = tcp - > u_arg [ 0 ] ;
const unsigned long size = tcp - > u_arg [ 1 ] ;
const unsigned long prot = tcp - > u_arg [ 2 ] ;
const unsigned long pgoff = tcp - > u_arg [ 3 ] ;
const unsigned long flags = tcp - > u_arg [ 4 ] ;
printaddr ( addr ) ;
tprintf ( " , %lu, " , size ) ;
printflags ( mmap_prot , prot , " PROT_??? " ) ;
tprintf ( " , %lu, " , pgoff ) ;
2003-03-05 07:08:00 +03:00
# ifdef MAP_TYPE
2016-04-01 18:31:23 +03:00
printxval ( mmap_flags , flags & MAP_TYPE , " MAP_??? " ) ;
addflags ( mmap_flags , flags & ~ MAP_TYPE ) ;
2003-03-05 07:08:00 +03:00
# else
2016-04-01 18:31:23 +03:00
printflags ( mmap_flags , flags , " MAP_??? " ) ;
2003-03-05 07:08:00 +03:00
# endif
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
return RVAL_DECODED ;
2003-03-05 07:08:00 +03:00
}
2004-10-07 22:53:12 +04:00
# define MPOL_DEFAULT 0
# define MPOL_PREFERRED 1
# define MPOL_BIND 2
# define MPOL_INTERLEAVE 3
# define MPOL_F_NODE (1<<0)
# define MPOL_F_ADDR (1<<1)
# define MPOL_MF_STRICT (1<<0)
2007-07-24 05:52:58 +04:00
# define MPOL_MF_MOVE (1<<1)
# define MPOL_MF_MOVE_ALL (1<<2)
2004-10-07 22:53:12 +04:00
2014-04-26 03:30:54 +04:00
# include "xlat/policies.h"
# include "xlat/mbindflags.h"
# include "xlat/mempolicyflags.h"
# include "xlat/move_pages_flags.h"
2007-07-24 05:52:58 +04:00
2004-10-07 22:53:12 +04:00
static void
2011-05-30 16:00:14 +04:00
get_nodes ( struct tcb * tcp , unsigned long ptr , unsigned long maxnodes , int err )
2004-10-07 22:53:12 +04:00
{
2005-06-01 23:22:06 +04:00
unsigned long nlongs , size , end ;
nlongs = ( maxnodes + 8 * sizeof ( long ) - 1 ) / ( 8 * sizeof ( long ) ) ;
size = nlongs * sizeof ( long ) ;
end = ptr + size ;
if ( nlongs = = 0 | | ( ( err | | verbose ( tcp ) ) & & ( size * 8 = = maxnodes )
& & ( end > ptr ) ) ) {
unsigned long n , cur , abbrev_end ;
int failed = 0 ;
if ( abbrev ( tcp ) ) {
abbrev_end = ptr + max_strlen * sizeof ( long ) ;
if ( abbrev_end < ptr )
abbrev_end = end ;
} else {
abbrev_end = end ;
}
2011-09-01 12:00:28 +04:00
tprints ( " , { " ) ;
2005-06-01 23:22:06 +04:00
for ( cur = ptr ; cur < end ; cur + = sizeof ( long ) ) {
if ( cur > ptr )
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2005-06-01 23:22:06 +04:00
if ( cur > = abbrev_end ) {
2011-09-01 12:00:28 +04:00
tprints ( " ... " ) ;
2005-06-01 23:22:06 +04:00
break ;
}
2015-03-21 21:50:53 +03:00
if ( umoven ( tcp , cur , sizeof ( n ) , & n ) < 0 ) {
2011-09-01 12:00:28 +04:00
tprints ( " ? " ) ;
2005-06-01 23:22:06 +04:00
failed = 1 ;
break ;
2004-10-07 22:53:12 +04:00
}
2005-06-01 23:22:06 +04:00
tprintf ( " %#0*lx " , ( int ) sizeof ( long ) * 2 + 2 , n ) ;
2004-10-07 22:53:12 +04:00
}
2011-09-01 12:00:28 +04:00
tprints ( " } " ) ;
mem.c: use printaddr and umove_or_printaddr
* mem.c (sys_brk, print_mmap, sys_munmap, sys_mprotect, sys_mremap,
sys_madvise, sys_msync, sys_mincore, sys_remap_file_pages, get_nodes,
sys_mbind, [POWERPC] sys_subpage_prot): Use printaddr.
(sys_get_mempolicy): Use printaddr and umove_or_printaddr.
2015-07-20 02:25:56 +03:00
if ( failed ) {
tprints ( " " ) ;
printaddr ( ptr ) ;
}
} else {
tprints ( " " ) ;
printaddr ( ptr ) ;
}
2004-10-07 22:53:12 +04:00
tprintf ( " , %lu " , maxnodes ) ;
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( mbind )
2004-10-07 22:53:12 +04:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
printaddr ( tcp - > u_arg [ 0 ] ) ;
tprintf ( " , %lu, " , tcp - > u_arg [ 1 ] ) ;
printxval ( policies , tcp - > u_arg [ 2 ] , " MPOL_??? " ) ;
get_nodes ( tcp , tcp - > u_arg [ 3 ] , tcp - > u_arg [ 4 ] , 0 ) ;
tprints ( " , " ) ;
printflags ( mbindflags , tcp - > u_arg [ 5 ] , " MPOL_??? " ) ;
return RVAL_DECODED ;
2004-10-07 22:53:12 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( set_mempolicy )
2004-10-07 22:53:12 +04:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
printxval ( policies , tcp - > u_arg [ 0 ] , " MPOL_??? " ) ;
get_nodes ( tcp , tcp - > u_arg [ 1 ] , tcp - > u_arg [ 2 ] , 0 ) ;
return RVAL_DECODED ;
2004-10-07 22:53:12 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( get_mempolicy )
2004-10-07 22:53:12 +04:00
{
if ( exiting ( tcp ) ) {
int pol ;
mem.c: use printaddr and umove_or_printaddr
* mem.c (sys_brk, print_mmap, sys_munmap, sys_mprotect, sys_mremap,
sys_madvise, sys_msync, sys_mincore, sys_remap_file_pages, get_nodes,
sys_mbind, [POWERPC] sys_subpage_prot): Use printaddr.
(sys_get_mempolicy): Use printaddr and umove_or_printaddr.
2015-07-20 02:25:56 +03:00
if ( ! umove_or_printaddr ( tcp , tcp - > u_arg [ 0 ] , & pol ) )
2004-10-07 22:53:12 +04:00
printxval ( policies , pol , " MPOL_??? " ) ;
get_nodes ( tcp , tcp - > u_arg [ 1 ] , tcp - > u_arg [ 2 ] , syserror ( tcp ) ) ;
mem.c: use printaddr and umove_or_printaddr
* mem.c (sys_brk, print_mmap, sys_munmap, sys_mprotect, sys_mremap,
sys_madvise, sys_msync, sys_mincore, sys_remap_file_pages, get_nodes,
sys_mbind, [POWERPC] sys_subpage_prot): Use printaddr.
(sys_get_mempolicy): Use printaddr and umove_or_printaddr.
2015-07-20 02:25:56 +03:00
tprints ( " , " ) ;
printaddr ( tcp - > u_arg [ 3 ] ) ;
tprints ( " , " ) ;
2005-05-31 Dmitry V. Levin <ldv@altlinux.org>
* util.c (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument, "const char *", with similar
meaning to the third argument of printxval().
* defs.h (printxval): Change third argument from "char *" to
"const char *".
(printflags): Add third argument.
* bjm.c (sys_query_module) [LINUX]: Pass third argument to
printflags().
* desc.c (sys_fcntl): Likewise.
(sys_flock) [LOCK_SH]: Likewise.
(print_epoll_event) [HAVE_SYS_EPOLL_H]: Likewise.
* file.c (sys_open): Likewise.
(solaris_open) [LINUXSPARC]: Likewise.
(sys_access): Likewise.
(sys_chflags, sys_fchflags) [FREEBSD]: Likewise.
(realprintstat) [HAVE_LONG_LONG_OFF_T &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(printstat64) [HAVE_STAT64 &&
HAVE_STRUCT_STAT_ST_FLAGS]: Likewise.
(sys_setxattr, sys_fsetxattr): Likewise.
* ipc.c (sys_msgget, sys_msgsnd, sys_msgrcv, sys_semget,
sys_shmget, sys_shmat) [LINUX || SUNOS4 || FREEBSD]: Likewise.
(sys_mq_open) [LINUX]: Likewise.
(printmqattr) [HAVE_MQUEUE_H]: Likewise.
* mem.c (print_mmap) [!HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mmap64) [_LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T]: Likewise.
(sys_mprotect): Likewise.
(sys_mremap, sys_madvise, sys_mlockall) [LINUX]: Likewise.
(sys_msync) [MS_ASYNC]: Likewise.
(sys_mctl) [MC_SYNC]: Likewise.
(sys_remap_file_pages, sys_mbind, sys_get_mempolicy) [LINUX]:
Likewise.
* net.c (printmsghdr) [HAVE_STRUCT_MSGHDR_MSG_CONTROL]: Likewise.
(sys_send, sys_sendto): Likewise.
(sys_sendmsg) [HAVE_SENDMSG]: Likewise.
(sys_recv, sys_recvfrom): Likewise.
(sys_recvmsg) [HAVE_SENDMSG]: Likewise.
(printicmpfilter) [ICMP_FILTER]: Likewise.
* proc.c (proc_ioctl) [SVR4 && !HAVE_MP_PROCFS || FREEBSD]: Likewise.
* process.c (sys_clone) [LINUX]: Likewise.
(printwaitn): Likewise.
(sys_waitid) [SVR4 || LINUX]: Likewise.
* signal.c (sys_sigvec) [SUNOS4 || FREEBSD]: Likewise.
(sys_sigaction): Likewise.
(printcontext) [SVR4]: Likewise.
(print_stack_t) [LINUX) || FREEBSD]: Likewise.
(sys_rt_sigaction) [LINUX]: Likewise.
* sock.c (sock_ioctl) [LINUX]: Likewise.
* stream.c (sys_putmsg, sys_getmsg): Likewise.
(sys_putpmsg) [SYS_putpmsg]: Likewise.
(sys_getpmsg) [SYS_getpmsg]: Likewise.
(sys_poll): Likewise.
(print_transport_message) [TI_BIND]: Likewise.
(stream_ioctl): Likewise.
* system.c (sys_mount, sys_reboot): Likewise.
(sys_cacheflush) [LINUX && M68K]: Likewise.
(sys_capget, sys_capset) [SYS_capget]: Likewise.
* term.c (term_ioctl) [TIOCMGET]: Likewise.
* time.c (sys_clock_nanosleep, sys_timer_settime) [LINUX]:
Likewise.
Fixes RH#159310.
2005-06-01 23:02:36 +04:00
printflags ( mempolicyflags , tcp - > u_arg [ 4 ] , " MPOL_??? " ) ;
2004-10-07 22:53:12 +04:00
}
return 0 ;
}
2007-07-24 05:52:58 +04:00
2015-04-07 04:36:50 +03:00
SYS_FUNC ( migrate_pages )
2012-03-12 02:44:14 +04:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
tprintf ( " %ld, " , ( long ) ( pid_t ) tcp - > u_arg [ 0 ] ) ;
get_nodes ( tcp , tcp - > u_arg [ 2 ] , tcp - > u_arg [ 1 ] , 0 ) ;
tprints ( " , " ) ;
get_nodes ( tcp , tcp - > u_arg [ 3 ] , tcp - > u_arg [ 1 ] , 0 ) ;
return RVAL_DECODED ;
2012-03-12 02:44:14 +04:00
}
2015-04-07 04:36:50 +03:00
SYS_FUNC ( move_pages )
2007-07-24 05:52:58 +04:00
{
if ( entering ( tcp ) ) {
unsigned long npages = tcp - > u_arg [ 1 ] ;
tprintf ( " %ld, %lu, " , tcp - > u_arg [ 0 ] , npages ) ;
if ( tcp - > u_arg [ 2 ] = = 0 )
2011-09-01 12:00:28 +04:00
tprints ( " NULL, " ) ;
2007-07-24 05:52:58 +04:00
else {
2014-09-10 17:46:04 +04:00
unsigned int i ;
2007-07-24 05:52:58 +04:00
long puser = tcp - > u_arg [ 2 ] ;
2011-09-01 12:00:28 +04:00
tprints ( " { " ) ;
2007-07-24 05:52:58 +04:00
for ( i = 0 ; i < npages ; + + i ) {
void * p ;
if ( i > 0 )
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2007-07-24 05:52:58 +04:00
if ( umove ( tcp , puser , & p ) < 0 ) {
2011-09-01 12:00:28 +04:00
tprints ( " ??? " ) ;
2007-07-24 05:52:58 +04:00
break ;
}
tprintf ( " %p " , p ) ;
2011-06-07 14:13:24 +04:00
puser + = sizeof ( void * ) ;
2007-07-24 05:52:58 +04:00
}
2011-09-01 12:00:28 +04:00
tprints ( " }, " ) ;
2007-07-24 05:52:58 +04:00
}
if ( tcp - > u_arg [ 3 ] = = 0 )
2011-09-01 12:00:28 +04:00
tprints ( " NULL, " ) ;
2007-07-24 05:52:58 +04:00
else {
2014-09-10 17:46:04 +04:00
unsigned int i ;
2007-07-24 05:52:58 +04:00
long nodeuser = tcp - > u_arg [ 3 ] ;
2011-09-01 12:00:28 +04:00
tprints ( " { " ) ;
2007-07-24 05:52:58 +04:00
for ( i = 0 ; i < npages ; + + i ) {
int node ;
if ( i > 0 )
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2007-07-24 05:52:58 +04:00
if ( umove ( tcp , nodeuser , & node ) < 0 ) {
2011-09-01 12:00:28 +04:00
tprints ( " ??? " ) ;
2007-07-24 05:52:58 +04:00
break ;
}
tprintf ( " %#x " , node ) ;
2011-06-07 14:13:24 +04:00
nodeuser + = sizeof ( int ) ;
2007-07-24 05:52:58 +04:00
}
2011-09-01 12:00:28 +04:00
tprints ( " }, " ) ;
2007-07-24 05:52:58 +04:00
}
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
} else {
2007-07-24 05:52:58 +04:00
unsigned long npages = tcp - > u_arg [ 1 ] ;
if ( tcp - > u_arg [ 4 ] = = 0 )
2011-09-01 12:00:28 +04:00
tprints ( " NULL, " ) ;
2007-07-24 05:52:58 +04:00
else {
2014-09-10 17:46:04 +04:00
unsigned int i ;
2007-07-24 05:52:58 +04:00
long statususer = tcp - > u_arg [ 4 ] ;
2011-09-01 12:00:28 +04:00
tprints ( " { " ) ;
2007-07-24 05:52:58 +04:00
for ( i = 0 ; i < npages ; + + i ) {
int status ;
if ( i > 0 )
2011-09-01 12:00:28 +04:00
tprints ( " , " ) ;
2007-07-24 05:52:58 +04:00
if ( umove ( tcp , statususer , & status ) < 0 ) {
2011-09-01 12:00:28 +04:00
tprints ( " ??? " ) ;
2007-07-24 05:52:58 +04:00
break ;
}
tprintf ( " %#x " , status ) ;
2011-06-07 14:13:24 +04:00
statususer + = sizeof ( int ) ;
2007-07-24 05:52:58 +04:00
}
2011-09-01 12:00:28 +04:00
tprints ( " }, " ) ;
2007-07-24 05:52:58 +04:00
}
printflags ( move_pages_flags , tcp - > u_arg [ 5 ] , " MPOL_??? " ) ;
}
return 0 ;
}
2008-08-25 07:09:16 +04:00
2012-02-25 05:38:52 +04:00
# if defined(POWERPC)
2015-04-07 04:36:50 +03:00
SYS_FUNC ( subpage_prot )
2008-08-25 07:09:16 +04:00
{
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
unsigned long cur , end , abbrev_end , entries ;
unsigned int entry ;
printaddr ( tcp - > u_arg [ 0 ] ) ;
tprints ( " , " ) ;
printaddr ( tcp - > u_arg [ 1 ] ) ;
tprints ( " , " ) ;
entries = tcp - > u_arg [ 1 ] > > 16 ;
if ( ! entries | | ! tcp - > u_arg [ 2 ] ) {
tprints ( " {} " ) ;
return 0 ;
}
cur = tcp - > u_arg [ 2 ] ;
end = cur + ( sizeof ( int ) * entries ) ;
if ( ! verbose ( tcp ) | | end < ( unsigned long ) tcp - > u_arg [ 2 ] ) {
printaddr ( tcp - > u_arg [ 2 ] ) ;
return 0 ;
}
if ( abbrev ( tcp ) ) {
abbrev_end = cur + ( sizeof ( int ) * max_strlen ) ;
if ( abbrev_end > end )
abbrev_end = end ;
}
else
abbrev_end = end ;
tprints ( " { " ) ;
for ( ; cur < end ; cur + = sizeof ( int ) ) {
if ( cur > ( unsigned long ) tcp - > u_arg [ 2 ] )
tprints ( " , " ) ;
if ( cur > = abbrev_end ) {
tprints ( " ... " ) ;
break ;
2008-08-25 07:09:16 +04:00
}
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
if ( umove ( tcp , cur , & entry ) < 0 ) {
tprintf ( " ??? [%#lx] " , cur ) ;
break ;
2008-08-25 07:09:16 +04:00
}
else
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
tprintf ( " %#08x " , entry ) ;
2008-08-25 07:09:16 +04:00
}
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
tprints ( " } " ) ;
2008-08-25 07:09:16 +04:00
mem.c: make use of RVAL_DECODED
* mem.c (print_mmap): Change to return void.
Update for RVAL_DECODED.
(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
sys_mmap_4koff): Update callers. Update for RVAL_DECODED.
(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
Update for RVAL_DECODED.
2015-07-20 02:37:40 +03:00
return RVAL_DECODED ;
2008-08-25 07:09:16 +04:00
}
# endif