11541Srgrimes/*-
21541Srgrimes * Copyright (c) 1992, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes * 4. Neither the name of the University nor the names of its contributors
141541Srgrimes *    may be used to endorse or promote products derived from this software
151541Srgrimes *    without specific prior written permission.
161541Srgrimes *
171541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271541Srgrimes * SUCH DAMAGE.
281541Srgrimes *
291541Srgrimes *	@(#)vm_extern.h	8.2 (Berkeley) 1/12/94
3050477Speter * $FreeBSD$
311541Srgrimes */
321541Srgrimes
335283Sbde#ifndef _VM_EXTERN_H_
345283Sbde#define	_VM_EXTERN_H_
352177Spaul
361541Srgrimesstruct proc;
371541Srgrimesstruct vmspace;
381541Srgrimesstruct vnode;
391541Srgrimes
4055206Speter#ifdef _KERNEL
417090Sbde
42109630Salfredint kernacc(void *, int, int);
4392727Salfredvm_offset_t kmem_alloc(vm_map_t, vm_size_t);
44206409Salcvm_offset_t kmem_alloc_attr(vm_map_t map, vm_size_t size, int flags,
45206409Salc    vm_paddr_t low, vm_paddr_t high, vm_memattr_t memattr);
46194376Salcvm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags,
47262874Sdumbbell    vm_paddr_t low, vm_paddr_t high, u_long alignment, u_long boundary,
48262874Sdumbbell    vm_memattr_t memattr);
4992727Salfredvm_offset_t kmem_alloc_nofault(vm_map_t, vm_size_t);
50206819Sjmallettvm_offset_t kmem_alloc_nofault_space(vm_map_t, vm_size_t, int);
5192727Salfredvm_offset_t kmem_alloc_wait(vm_map_t, vm_size_t);
5292727Salfredvoid kmem_free(vm_map_t, vm_offset_t, vm_size_t);
5392727Salfredvoid kmem_free_wakeup(vm_map_t, vm_offset_t, vm_size_t);
5492727Salfredvoid kmem_init(vm_offset_t, vm_offset_t);
55206409Salcvm_offset_t kmem_malloc(vm_map_t map, vm_size_t size, int flags);
56211194Smdfint kmem_back(vm_map_t, vm_offset_t, vm_size_t, int);
57178933Salcvm_map_t kmem_suballoc(vm_map_t, vm_offset_t *, vm_offset_t *, vm_size_t,
58178933Salc    boolean_t);
5992727Salfredvoid swapout_procs(int);
60109630Salfredint useracc(void *, int, int);
6192727Salfredint vm_fault(vm_map_t, vm_offset_t, vm_prot_t, int);
62195329Skibvoid vm_fault_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t,
63195329Skib    vm_ooffset_t *);
64223889Skibint vm_fault_disable_pagefaults(void);
65223889Skibvoid vm_fault_enable_pagefaults(int save);
66216604Salcint vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type,
67216604Salc    int fault_flags, vm_page_t *m_hold);
68216699Salcint vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len,
69216699Salc    vm_prot_t prot, vm_page_t *ma, int max_count);
70129571Salcvoid vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
71199490Salcint vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
72173361Skibint vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int);
7392727Salfredvoid vm_waitproc(struct proc *);
74144501Sjhbint vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, objtype_t, void *, vm_ooffset_t);
75223914Skibint vm_mmap_to_errno(int rv);
7692727Salfredvoid vm_set_page_size(void);
77198341Smarcelvoid vm_sync_icache(vm_map_t, vm_offset_t, vm_size_t);
7892727Salfredstruct vmspace *vmspace_alloc(vm_offset_t, vm_offset_t);
79194766Skibstruct vmspace *vmspace_fork(struct vmspace *, vm_ooffset_t *);
80173361Skibint vmspace_exec(struct proc *, vm_offset_t, vm_offset_t);
81173361Skibint vmspace_unshare(struct proc *);
82159054Steggevoid vmspace_exit(struct thread *);
83159054Steggestruct vmspace *vmspace_acquire_ref(struct proc *);
8492727Salfredvoid vmspace_free(struct vmspace *);
8592727Salfredvoid vmspace_exitfree(struct proc *);
8692727Salfredvoid vnode_pager_setsize(struct vnode *, vm_ooffset_t);
87127007Struckmanint vslock(void *, size_t);
88127007Struckmanvoid vsunlock(void *, size_t);
89153485Salcstruct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset);
90153485Salcvoid vm_imgact_unmap_page(struct sf_buf *sf);
91116355Salcvoid vm_thread_dispose(struct thread *td);
92173361Skibint vm_thread_new(struct thread *td, int pages);
9355206Speter#endif				/* _KERNEL */
945455Sdg#endif				/* !_VM_EXTERN_H_ */
95