From 2c65912458927f5ccc934e5caa6dfb5f101c97b4 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 14 Sep 2003 19:54:40 +0000 Subject: Use sys_mmap2 if it's known to be available. --- sysdeps/unix/sysv/linux/arm/mmap.S | 39 +++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'sysdeps/unix') diff --git a/sysdeps/unix/sysv/linux/arm/mmap.S b/sysdeps/unix/sysv/linux/arm/mmap.S index af93c7bce7..7beba6841c 100644 --- a/sysdeps/unix/sysv/linux/arm/mmap.S +++ b/sysdeps/unix/sysv/linux/arm/mmap.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,11 +17,47 @@ 02111-1307 USA. */ #include +#include + +#define EINVAL 22 .text ENTRY (__mmap) +# ifdef __ASSUME_MMAP2_SYSCALL + /* This code is actually a couple of cycles slower than the + sys_mmap version below, so it might seem like a loss. But the + code path inside the kernel is sufficiently much shorter to + make it a net gain to use mmap2 when it's known to be + available. */ + + /* shuffle args */ + str r5, [sp, #-4]! + ldr r5, [sp, #8] + str r4, [sp, #-4]! + ldr r4, [sp, #8] + + /* convert offset to pages */ + movs ip, r5, lsl #20 + bne .Linval + mov r5, r5, lsr #12 + + /* do the syscall */ + swi SYS_ify (mmap2) + + /* restore registers */ +2: + ldr r4, [sp], #4 + ldr r5, [sp], #4 + + cmn r0, $4096 + RETINSTR(movcc, pc, lr) + b PLTJMP(syscall_error) +.Linval: + mov r0, #-EINVAL + b 2b +# else /* Because we can only get five args through the syscall interface, and mmap() takes six, we need to build a parameter block and pass its address instead. The 386 port does a similar trick. */ @@ -49,6 +85,7 @@ ENTRY (__mmap) cmn r0, $4096 RETINSTR(movcc, pc, lr) b PLTJMP(syscall_error); +#endif PSEUDO_END (__mmap) -- cgit v1.2.3