xref: /titanic_51/usr/src/lib/libc/common/sys/mmap.s (revision b6917abefc343244b784f0cc34bc65b01469c3bf)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27/*	Copyright (c) 1988 AT&T	*/
28/*	All Rights Reserved	*/
29
30#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32	.file	"%M%"
33
34#include <sys/asm_linkage.h>
35
36#if !defined(_LARGEFILE_SOURCE)
37	ANSI_PRAGMA_WEAK(mmap,function)
38#else
39	ANSI_PRAGMA_WEAK(mmap64,function)
40#endif
41
42#include "SYS.h"
43#include <sys/mman.h>		/* Need _MAP_NEW definition     */
44
45#if !defined(_LARGEFILE_SOURCE)
46
47/*
48 * C library -- mmap
49 * caddr_t mmap(caddr_t addr, size_t len, int prot,
50 *	int flags, int fd, off_t off)
51 */
52
53	ENTRY(mmap)
54#if defined(__sparc)
55	/* this depends upon the _MAP_NEW flag being in the top bits */
56	sethi	%hi(_MAP_NEW), %g1
57	or	%g1, %o3, %o3
58#endif
59	SYSTRAP_RVAL1(mmap)
60	SYSCERROR
61	RET
62	SET_SIZE(mmap)
63
64#else
65
66/*
67 * C library -- mmap64
68 * caddr_t mmap64(caddr_t addr, size_t len, int prot,
69 *	int flags, int fd, off64_t off)
70 */
71
72	ENTRY(mmap64)
73#if defined(__sparc)
74	/* this depends upon the _MAP_NEW flag being in the top bits */
75	sethi	%hi(_MAP_NEW), %g1
76	or	%g1, %o3, %o3
77#endif
78	SYSTRAP_RVAL1(mmap64)
79	SYSCERROR
80	RET
81	SET_SIZE(mmap64)
82
83#endif
84