OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [libc/] [sysdeps/] [linux/] [arm/] [mmap64.S] - Blame information for rev 1325

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Copyright (C) 2000 Free Software Foundation, Inc.
2
   This file is part of the GNU C Library.
3
 
4
   The GNU C Library is free software; you can redistribute it and/or
5
   modify it under the terms of the GNU Lesser General Public
6
   License as published by the Free Software Foundation; either
7
   version 2.1 of the License, or (at your option) any later version.
8
 
9
   The GNU C Library is distributed in the hope that it will be useful,
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
   Lesser General Public License for more details.
13
 
14
   You should have received a copy of the GNU Lesser General Public
15
   License along with the GNU C Library; if not, write to the Free
16
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17
   02111-1307 USA.  */
18
 
19
#define _ERRNO_H        1
20
#include 
21
#include 
22
#include 
23
 
24
#if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2
25
 
26
 
27
        /* The mmap2 system call takes six arguments, all in registers.  */
28
        .text
29
        .global mmap64;
30
        .type mmap64,%function
31
        .align 4;
32
 
33
mmap64:
34
        stmfd   sp!, {r4, r5, lr}
35
        ldr     r5, [sp, $16]
36
        ldr     r4, [sp, $12]
37
        movs    ip, r5, lsl $20         @ check that offset is page-aligned
38
        bne     .Linval
39
        ldr     ip, [sp, $20]
40
        mov     r5, r5, lsr $12
41
        orr     r5, r5, ip, lsl $20     @ compose page offset
42
        movs    ip, ip, lsr $12
43
        bne     .Linval                 @ check for overflow
44
        mov     ip, r0
45
        swi     __NR_mmap2
46
        cmn     r0, $4096
47
        ldmccfd sp!, {r4, r5, pc}
48
        cmn     r0, $ENOSYS
49
        ldmnefd sp!, {r4, r5, lr}
50
        bne     __syscall_error (PLT)
51
        /* The current kernel does not support mmap2.  Fall back to plain
52
           mmap if the offset is small enough.  */
53
        ldr     r5, [sp, $20]
54
        mov     r0, ip                  @ first arg was clobbered
55
        teq     r5, $0
56
        ldmeqfd sp!, {r4, r5, lr}
57
        beq     mmap (PLT)
58
.Linval:
59
        mov     r0, $-EINVAL
60
        ldmfd   sp!, {r4, r5, lr}
61
        b       __syscall_error (PLT)
62
 
63
__syscall_error:
64
        /* Looks like the syscall choked -- set errno */
65
        ldr  r3, .L4
66
        /* Calculate the - of the syscall result, in case we need it */
67
        rsb  r2, r0, $0
68
 
69
        /* errno = -result */
70
        str  r2, [r9,r3]
71
 
72
        /* return -1 */
73
        mvn  r0, $0
74
        mov  pc, lr
75
.size mmap64,.-mmap64;
76
 
77
.L4:  .word errno
78
 
79
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.