e1000 driver now compiles with fewer modifications

- Change some include path in the e1000 drivers
  - Add some files from the FreeBSD source tree (modification in
    freebsd-to-rtems.py)
    - Avoid inconsistent functions declarations: the bool_t and/or
    boolean_t are not the same between rtems and freebsd so that a
    function with the prototype bool_t foobar() and another boolean_t
    foobar() does not compile on rtems. (see if_igb.c for example)
      Joel Note: These are still inconsistent on the FreeBSD side and need
                 to be addressed by them. We will just make the prototype
                 match the body until they give us a solution.
This commit is contained in:
Julien Delange 2012-03-26 09:51:49 -05:00 committed by Joel Sherrill
parent 8dce37226b
commit a52104cf46
33 changed files with 288 additions and 119 deletions

View File

@ -474,7 +474,7 @@ rtems_headerFiles = [
'rtems/machine/mutex.h',
'rtems/machine/param.h',
'rtems/machine/pcpu.h',
#'rtems/machine/pmap.h',
'rtems/machine/pmap.h',
'rtems/machine/proc.h',
'rtems/machine/resource.h',
'rtems/machine/runq.h',
@ -488,7 +488,6 @@ rtems_headerFiles = [
'rtems/machine/rtems-bsd-sysinit.h',
'rtems/machine/rtems-bsd-select.h',
'rtems/machine/rtems-bsd-taskqueue.h',
#'rtems/machine/vm.h',
'bsd.h',
]
rtems_sourceFiles = [
@ -1033,7 +1032,7 @@ devUsbBase.addHeaderFiles(
'vm/uma.h',
'vm/uma_int.h',
'vm/uma_dbg.h',
#'vm/vm.h',
'vm/vm.h',
#'vm/vm_page.h',
'fs/devfs/devfs_int.h',
]
@ -1089,6 +1088,7 @@ devNet.addHeaderFiles(
'dev/mii/miivar.h',
'dev/mii/brgphyreg.h',
'dev/mii/icsphyreg.h',
'dev/led/led.h',
'net/bpf.h',
'net/ethernet.h',
'net/if_arp.h',
@ -1954,6 +1954,7 @@ mm.addEmptyFiles(
'machine/elf.h',
'machine/sf_buf.h',
'machine/smp.h',
'machine/vm.h',
#'machine/vmparam.h',
'local/opt_bce.h',
'local/opt_ntp.h',
@ -1981,7 +1982,7 @@ mm.addEmptyFiles(
'sys/_timeval.h',
#'sys/vmmeter.h',
#'sys/vnode.h',
#'vm/pmap.h',
'vm/pmap.h',
#'vm/uma_int.h',
#'vm/uma_dbg.h',
#'vm/vm_extern.h',
@ -1993,7 +1994,7 @@ mm.addEmptyFiles(
'geom/geom_disk.h',
#'sys/kdb.h',
#'libkern/jenkins.h',
#'machine/pcb.h',
'machine/pcb.h',
#'net80211/ieee80211_freebsd.h',
'netgraph/ng_ipfw.h',
#'sys/sf_buf.h',

View File

@ -39,10 +39,10 @@
* 80003ES2LAN Gigabit Ethernet Controller (Serdes)
*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw);

View File

@ -45,10 +45,10 @@
* 82546GB Gigabit Ethernet Controller
*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_82540(struct e1000_hw *hw);

View File

@ -43,10 +43,10 @@
* 82547GI Gigabit Ethernet Controller
*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_82541(struct e1000_hw *hw);

View File

@ -38,10 +38,10 @@
* 82542 Gigabit Ethernet Controller
*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_82542(struct e1000_hw *hw);

View File

@ -43,10 +43,10 @@
* 82544GC Gigabit Ethernet Controller (LOM)
*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_82543(struct e1000_hw *hw);

View File

@ -51,10 +51,10 @@
* 82583V Gigabit Network Connection
*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_82571(struct e1000_hw *hw);

View File

@ -43,10 +43,10 @@
* 82576 Quad Port Gigabit Mezzanine Adapter
*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_82575(struct e1000_hw *hw);

View File

@ -34,10 +34,10 @@
******************************************************************************/
/*$FreeBSD$*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
/**

View File

@ -35,10 +35,10 @@
#ifndef _E1000_API_HH_
#define _E1000_API_HH_
#ifndef __rtems__
#include <freebsd/local/e1000_hw.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_hw.h>
#else
#include <freebsd/local/e1000_hw.h>
#endif
extern void e1000_init_function_pointers_82542(struct e1000_hw *hw);

View File

@ -35,14 +35,14 @@
#ifndef _E1000_HW_HH_
#define _E1000_HW_HH_
#ifndef __rtems__
#include <freebsd/local/e1000_osdep.h>
#include <freebsd/local/e1000_regs.h>
#include <freebsd/local/e1000_defines.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_osdep.h>
#include <freebsd/dev/e1000/e1000_regs.h>
#include <freebsd/dev/e1000/e1000_defines.h>
#else
#include <freebsd/local/e1000_osdep.h>
#include <freebsd/local/e1000_regs.h>
#include <freebsd/local/e1000_defines.h>
#endif
struct e1000_hw;
@ -629,18 +629,18 @@ struct e1000_host_mng_command_info {
u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH];
};
#ifndef __rtems__
#include <freebsd/local/e1000_mac.h>
#include <freebsd/local/e1000_phy.h>
#include <freebsd/local/e1000_nvm.h>
#include <freebsd/local/e1000_manage.h>
#include <freebsd/local/e1000_mbx.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_mac.h>
#include <freebsd/dev/e1000/e1000_phy.h>
#include <freebsd/dev/e1000/e1000_nvm.h>
#include <freebsd/dev/e1000/e1000_manage.h>
#include <freebsd/dev/e1000/e1000_mbx.h>
#else
#include <freebsd/local/e1000_mac.h>
#include <freebsd/local/e1000_phy.h>
#include <freebsd/local/e1000_nvm.h>
#include <freebsd/local/e1000_manage.h>
#include <freebsd/local/e1000_mbx.h>
#endif
struct e1000_mac_operations {
@ -941,20 +941,20 @@ struct e1000_hw {
u8 revision_id;
};
#ifndef __rtems__
#include <freebsd/local/e1000_82541.h>
#include <freebsd/local/e1000_82543.h>
#include <freebsd/local/e1000_82571.h>
#include <freebsd/local/e1000_80003es2lan.h>
#include <freebsd/local/e1000_ich8lan.h>
#include <freebsd/local/e1000_82575.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_82541.h>
#include <freebsd/dev/e1000/e1000_82543.h>
#include <freebsd/dev/e1000/e1000_82571.h>
#include <freebsd/dev/e1000/e1000_80003es2lan.h>
#include <freebsd/dev/e1000/e1000_ich8lan.h>
#include <freebsd/dev/e1000/e1000_82575.h>
#else
#include <freebsd/local/e1000_82541.h>
#include <freebsd/local/e1000_82543.h>
#include <freebsd/local/e1000_82571.h>
#include <freebsd/local/e1000_80003es2lan.h>
#include <freebsd/local/e1000_ich8lan.h>
#include <freebsd/local/e1000_82575.h>
#endif
/* These functions must be implemented by drivers */

View File

@ -64,10 +64,10 @@
* 82579V Gigabit Network Connection
*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_ich8lan(struct e1000_hw *hw);

View File

@ -34,10 +34,10 @@
******************************************************************************/
/*$FreeBSD$*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw);

View File

@ -34,10 +34,10 @@
******************************************************************************/
/*$FreeBSD$*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static u8 e1000_calculate_checksum(u8 *buffer, u32 length);

View File

@ -34,10 +34,10 @@
******************************************************************************/
/*$FreeBSD$*/
#ifndef __rtems__
#include <freebsd/local/e1000_mbx.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_mbx.h>
#else
#include <freebsd/local/e1000_mnx.h>
#endif
/**

View File

@ -35,10 +35,10 @@
#ifndef _E1000_MBX_HH_
#define _E1000_MBX_HH_
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
/* Define mailbox register bits */

View File

@ -34,10 +34,10 @@
******************************************************************************/
/*$FreeBSD$*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static void e1000_reload_nvm_generic(struct e1000_hw *hw);

View File

@ -34,10 +34,10 @@
******************************************************************************/
/*$FreeBSD$*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
/*

View File

@ -50,10 +50,8 @@
#include <freebsd/machine/bus.h>
#include <freebsd/sys/rman.h>
#include <freebsd/machine/resource.h>
#ifndef __rtems__
#include <freebsd/vm/vm.h>
#include <freebsd/vm/pmap.h>
#endif
#include <freebsd/machine/clock.h>
#include <freebsd/dev/pci/pcivar.h>
#include <freebsd/dev/pci/pcireg.h>

View File

@ -34,10 +34,10 @@
******************************************************************************/
/*$FreeBSD$*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static u32 e1000_get_phy_addr_for_bm_page(u32 page, u32 reg);

View File

@ -34,14 +34,12 @@
******************************************************************************/
/*$FreeBSD$*/
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#else
#include <freebsd/local/e1000_api.h>
#endif
static s32 e1000_init_phy_params_vf(struct e1000_hw *hw);
static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw);
static void e1000_release_vf(struct e1000_hw *hw);

View File

@ -35,14 +35,14 @@
#ifndef _E1000_VF_HH_
#define _E1000_VF_HH_
#ifndef __rtems__
#include <freebsd/local/e1000_osdep.h>
#include <freebsd/local/e1000_regs.h>
#include <freebsd/local/e1000_defines.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_osdep.h>
#include <freebsd/dev/e1000/e1000_regs.h>
#include <freebsd/dev/e1000/e1000_defines.h>
#else
#include <freebsd/local/e1000_osdep.h>
#include <freebsd/local/e1000_regs.h>
#include <freebsd/local/e1000_defines.h>
#endif
struct e1000_hw;
@ -195,7 +195,11 @@ struct e1000_vf_stats {
u64 gprlbc;
};
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_mbx.h>
#else
#include <freebsd/local/e1000_mbx.h>
#endif
struct e1000_mac_operations {
/* Function pointers for the MAC. */

View File

@ -79,20 +79,18 @@
#include <freebsd/netinet/udp.h>
#include <freebsd/machine/in_cksum.h>
#ifndef __rtems__
#include <freebsd/dev/led/led.h>
#endif
#include <freebsd/dev/pci/pcivar.h>
#include <freebsd/dev/pci/pcireg.h>
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#include <freebsd/local/e1000_82571.h>
#include <freebsd/local/if_em.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#include <freebsd/dev/e1000/e1000_82571.h>
#include <freebsd/dev/e1000/if_em.h>
#else
#include <freebsd/local/e1000_api.h>
#include <freebsd/local/e1000_82571.h>
#include <freebsd/local/if_em.h>
#endif
/*********************************************************************

View File

@ -85,20 +85,18 @@
#include <freebsd/netinet/udp.h>
#include <freebsd/machine/in_cksum.h>
#ifndef __rtems__
#include <freebsd/dev/led/led.h>
#endif
#include <freebsd/dev/pci/pcivar.h>
#include <freebsd/dev/pci/pcireg.h>
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#include <freebsd/local/e1000_82575.h>
#include <freebsd/local/if_igb.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#include <freebsd/dev/e1000/e1000_82575.h>
#include <freebsd/dev/e1000/if_igb.h>
#else
#include <freebsd/local/e1000_api.h>
#include <freebsd/local/e1000_82575.h>
#include <freebsd/local/if_igb.h>
#endif
/*********************************************************************
@ -222,16 +220,20 @@ static __inline void igb_rx_discard(struct rx_ring *, int);
static __inline void igb_rx_input(struct rx_ring *,
struct ifnet *, struct mbuf *, u32);
#ifdef __rtems__
/* XXX the inconsistent prototype and body need to be reported to FreeBSD */
static bool igb_rxeof(struct igb_queue *, int, int *);
#else
static boolean_t igb_rxeof(struct igb_queue *, int, int *);
#endif
static void igb_rx_checksum(u32, struct mbuf *, u32);
#ifdef __rtems__
/* XXX this is an inconsistency in BSD */
/* XXX the inconsistent prototype and body need to be reported to FreeBSD */
static bool igb_tx_ctx_setup(struct tx_ring *, struct mbuf *);
static boolean_t igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *);
#else
static int igb_tx_ctx_setup(struct tx_ring *, struct mbuf *);
static bool igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *);
#endif
static boolean_t igb_tso_setup(struct tx_ring *, struct mbuf *, u32 *);
static void igb_set_promisc(struct adapter *);
static void igb_disable_promisc(struct adapter *);
static void igb_set_multi(struct adapter *);
@ -4306,6 +4308,7 @@ igb_rx_input(struct rx_ring *rxr, struct ifnet *ifp, struct mbuf *m, u32 ptype)
*
* Return TRUE if more to clean, FALSE otherwise
*********************************************************************/
static bool
igb_rxeof(struct igb_queue *que, int count, int *done)
{

View File

@ -76,18 +76,16 @@
#include <freebsd/netinet/udp.h>
#include <freebsd/machine/in_cksum.h>
#ifndef __rtems__
#include <freebsd/dev/led/led.h>
#endif
#include <freebsd/dev/pci/pcivar.h>
#include <freebsd/dev/pci/pcireg.h>
#ifndef __rtems__
#include <freebsd/local/e1000_api.h>
#include <freebsd/local/if_lem.h>
#else
#ifdef __rtems__
#include <freebsd/dev/e1000/e1000_api.h>
#include <freebsd/dev/e1000/if_lem.h>
#else
#include <freebsd/local/e1000_api.h>
#include <freebsd/local/if_lem.h>
#endif
/*********************************************************************

21
freebsd/dev/led/led.h Normal file
View File

@ -0,0 +1,21 @@
/*-
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $FreeBSD$
*/
#ifndef _DEV_LED_H
#define _DEV_LED_H
typedef void led_t(void *, int);
struct cdev *led_create_state(led_t *, void *, char const *, int);
struct cdev *led_create(led_t *, void *, char const *);
void led_destroy(struct cdev *);
#endif

View File

@ -110,9 +110,7 @@ struct proc *initproc;
int boothowto = 0; /* initialized so that it can be patched */
SYSCTL_INT(_debug, OID_AUTO, boothowto, CTLFLAG_RD, &boothowto, 0, "");
#endif
int bootverbose;
#ifndef __rtems__
SYSCTL_INT(_debug, OID_AUTO, bootverbose, CTLFLAG_RW, &bootverbose, 0, "");
/*

View File

@ -77,7 +77,6 @@ SYSCTL_INT(_kern, KERN_IOV_MAX, iov_max, CTLFLAG_RD, NULL, UIO_MAXIOV,
/* Declared in uipc_socket.c */
extern int so_zero_copy_receive;
#ifndef __rtems__
/*
* Identify the physical page mapped at the given kernel virtual
* address. Insert this physical page into the given address space at
@ -373,7 +372,6 @@ again:
uio->uio_offset++;
return (0);
}
#endif
/*
* General routine to allocate a hash table with control of memory flags.
@ -439,7 +437,6 @@ static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039,
7159, 7673, 8191, 12281, 16381, 24571, 32749 };
#define NPRIMES (sizeof(primes) / sizeof(primes[0]))
#ifndef __rtems__
/*
* General routine to allocate a prime number sized hash table.
*/
@ -587,5 +584,3 @@ cloneuio(struct uio *uiop)
bcopy(uiop->uio_iov, uio->uio_iov, iovlen);
return (uio);
}
#endif

1
freebsd/machine/pcb.h Normal file
View File

@ -0,0 +1 @@
/* EMPTY */

1
freebsd/machine/vm.h Normal file
View File

@ -0,0 +1 @@
/* EMPTY */

1
freebsd/vm/pmap.h Normal file
View File

@ -0,0 +1 @@
/* EMPTY */

152
freebsd/vm/vm.h Normal file
View File

@ -0,0 +1,152 @@
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. 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.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
*
* @(#)vm.h 8.2 (Berkeley) 12/13/93
* @(#)vm_prot.h 8.1 (Berkeley) 6/11/93
* @(#)vm_inherit.h 8.1 (Berkeley) 6/11/93
*
* Copyright (c) 1987, 1990 Carnegie-Mellon University.
* All rights reserved.
*
* Authors: Avadis Tevanian, Jr., Michael Wayne Young
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $FreeBSD$
*/
#ifndef VM_H
#define VM_H
#include <freebsd/machine/vm.h>
typedef char vm_inherit_t; /* inheritance codes */
#define VM_INHERIT_SHARE ((vm_inherit_t) 0)
#define VM_INHERIT_COPY ((vm_inherit_t) 1)
#define VM_INHERIT_NONE ((vm_inherit_t) 2)
#define VM_INHERIT_DEFAULT VM_INHERIT_COPY
typedef u_char vm_prot_t; /* protection codes */
#define VM_PROT_NONE ((vm_prot_t) 0x00)
#define VM_PROT_READ ((vm_prot_t) 0x01)
#define VM_PROT_WRITE ((vm_prot_t) 0x02)
#define VM_PROT_EXECUTE ((vm_prot_t) 0x04)
#define VM_PROT_OVERRIDE_WRITE ((vm_prot_t) 0x08) /* copy-on-write */
#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
#define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE)
#define VM_PROT_DEFAULT VM_PROT_ALL
enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_PHYS,
OBJT_DEAD, OBJT_SG };
typedef u_char objtype_t;
union vm_map_object;
typedef union vm_map_object vm_map_object_t;
struct vm_map_entry;
typedef struct vm_map_entry *vm_map_entry_t;
struct vm_map;
typedef struct vm_map *vm_map_t;
struct vm_object;
typedef struct vm_object *vm_object_t;
#ifndef _KERNEL
/*
* This is defined in <sys/types.h> for the kernel so that non-vm kernel
* sources (mainly Mach-derived ones such as ddb) don't have to include
* vm stuff. Defining it there for applications might break things.
* Define it here for "applications" that include vm headers (e.g.,
* genassym).
*/
typedef int boolean_t;
/*
* The exact set of memory attributes is machine dependent. However, every
* machine is required to define VM_MEMATTR_DEFAULT.
*/
typedef char vm_memattr_t; /* memory attribute codes */
/*
* This is defined in <sys/types.h> for the kernel so that vnode_if.h
* doesn't have to include <vm/vm.h>.
*/
struct vm_page;
typedef struct vm_page *vm_page_t;
#endif /* _KERNEL */
struct vm_reserv;
typedef struct vm_reserv *vm_reserv_t;
/*
* Information passed from the machine-independant VM initialization code
* for use by machine-dependant code (mainly for MMU support)
*/
struct kva_md_info {
vm_offset_t buffer_sva;
vm_offset_t buffer_eva;
vm_offset_t clean_sva;
vm_offset_t clean_eva;
vm_offset_t pager_sva;
vm_offset_t pager_eva;
};
extern struct kva_md_info kmi;
extern void vm_ksubmap_init(struct kva_md_info *);
struct uidinfo;
int swap_reserve(vm_ooffset_t incr);
int swap_reserve_by_uid(vm_ooffset_t incr, struct uidinfo *uip);
void swap_reserve_force(vm_ooffset_t incr);
void swap_release(vm_ooffset_t decr);
void swap_release_by_uid(vm_ooffset_t decr, struct uidinfo *uip);
#endif /* VM_H */

View File

@ -25,7 +25,7 @@ CXXFLAGS += $(CFLAGS)
all: $(APP)
$(APP): $(APP_O_FILES)
$(CXX) $(CXXFLAGS) $^ $(LINK_LIBS) -o $(APP)
$(CC) $(CXXFLAGS) $^ $(LINK_LIBS) -o $(APP)
clean:
rm -f $(APP_O_FILES) $(APP_DEP_FILES)