--- bochs-2.3.5.orig/config.guess +++ bochs-2.3.5/config.guess @@ -1,9 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. -timestamp='2002-03-20' +timestamp='2007-07-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +18,15 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,7 +56,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -66,11 +69,11 @@ while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -88,30 +91,42 @@ exit 1 fi +trap 'exit 1' 1 2 15 -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. -# CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. -set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c ; +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; - if test $? = 0 ; then + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; - rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -142,9 +157,11 @@ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -167,141 +184,128 @@ ;; esac # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - cat <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - 2-1307) - UNAME_MACHINE="alphaev68" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -309,25 +313,32 @@ else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -336,10 +347,10 @@ esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -351,10 +362,10 @@ echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -365,37 +376,40 @@ # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -419,27 +433,33 @@ exit (-1); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -455,29 +475,29 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -485,7 +505,7 @@ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -500,15 +520,18 @@ exit(0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then @@ -522,28 +545,28 @@ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -599,17 +622,37 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -637,134 +680,182 @@ exit (0); } EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) + exit ;; + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:3*) - echo i386-pc-interix3 - exit 0 ;; + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; + echo i586-pc-interix + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -781,16 +872,45 @@ #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - rm -f $dummy.c - test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -804,7 +924,7 @@ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -812,22 +932,31 @@ PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; + xtensa:Linux:*:*) + echo xtensa-unknown-linux-gnu + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -845,15 +974,15 @@ ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -870,24 +999,33 @@ LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) LIBC=gnu #else LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - rm -f $dummy.c - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -895,7 +1033,27 @@ # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -903,99 +1061,100 @@ else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp - exit 0 ;; + exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 - exit 0 ;; + exit ;; paragon:*:*:*) echo i860-intel-osf1 - exit 0 ;; + exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1003,61 +1162,81 @@ else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1065,22 +1244,25 @@ UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1091,36 +1273,47 @@ UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1152,7 +1345,7 @@ #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1241,12 +1434,12 @@ } EOF -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1255,22 +1448,22 @@ case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1281,7 +1474,9 @@ the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be --- bochs-2.3.5.orig/config.sub +++ bochs-2.3.5/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. -timestamp='2002-03-07' +timestamp='2007-06-28' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +22,15 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,7 +72,7 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -83,11 +85,11 @@ while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +101,7 @@ *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,7 +120,9 @@ # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -144,7 +148,7 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -169,6 +173,10 @@ -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -185,6 +193,10 @@ # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -228,31 +240,52 @@ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ | c4x | clipper \ - | d10v | d30v | dsp16xx \ - | fr30 \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el | mips64vr4300 \ - | mips64vr4300el | mips64vr5000 | mips64vr5000el \ - | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ - | mipsisa32 | mipsisa64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -263,6 +296,9 @@ ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -281,38 +317,59 @@ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c54x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ - | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ - | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; @@ -332,6 +389,9 @@ basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -346,6 +406,12 @@ basic_machine=a29k-none os=-bsd ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -405,12 +471,27 @@ basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -433,6 +514,10 @@ basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -598,6 +683,10 @@ basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -611,10 +700,6 @@ mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -627,6 +712,9 @@ basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -702,9 +790,12 @@ basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson @@ -728,49 +819,61 @@ pbb) basic_machine=m68k-tti ;; - pc532 | pc532-*) + pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; - pentiumpro | p6 | 6x86 | athlon) + pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; + pentium4) + basic_machine=i786-pc + ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown - ;; + ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown - ;; + ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown - ;; + ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown - ;; + ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; @@ -781,6 +884,10 @@ basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -801,6 +908,20 @@ basic_machine=a29k-amd os=-udi ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -808,6 +929,12 @@ basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks @@ -866,7 +993,7 @@ sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; - sv1) + sv1) basic_machine=sv1-cray os=-unicos ;; @@ -874,10 +1001,6 @@ basic_machine=i386-sequent os=-dynix ;; - t3d) - basic_machine=alpha-cray - os=-unicos - ;; t3e) basic_machine=alphaev5-cray os=-unicos @@ -890,6 +1013,14 @@ basic_machine=tic54x-unknown os=-coff ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -903,6 +1034,10 @@ tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -924,8 +1059,8 @@ os=-vms ;; vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; + basic_machine=f301-fujitsu + ;; vxworks960) basic_machine=i960-wrs os=-vxworks @@ -946,11 +1081,11 @@ basic_machine=hppa1.1-winbond os=-proelf ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt + xbox) + basic_machine=i686-pc + os=-mingw32 ;; - xps | xps100) + xps | xps100) basic_machine=xps100-honeywell ;; ymp) @@ -980,6 +1115,9 @@ romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -996,16 +1134,13 @@ we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh3eb | sh4eb) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; - cydra) + cydra) basic_machine=cydra-cydrome ;; orion) @@ -1020,10 +1155,6 @@ pmac | pmac-mpw) basic_machine=powerpc-apple ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; @@ -1079,18 +1210,23 @@ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova*) + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1102,16 +1238,21 @@ ;; esac ;; + -nto-qnx*) + ;; -nto*) - os=-nto-qnx + os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1124,6 +1265,9 @@ -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1145,6 +1289,9 @@ -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1155,7 +1302,7 @@ os=-rtmk-nova ;; -ns2 ) - os=-nextstep2 + os=-nextstep2 ;; -nsk*) os=-nsk @@ -1167,6 +1314,9 @@ -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1194,8 +1344,17 @@ -xenix) os=-xenix ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe ;; -none) ;; @@ -1219,6 +1378,12 @@ # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1228,11 +1393,14 @@ arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; - pdp11-*) + pdp11-*) os=-none ;; *-dec | vax-*) @@ -1253,6 +1421,9 @@ m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1271,9 +1442,15 @@ *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1325,19 +1502,19 @@ *-next) os=-nextstep3 ;; - *-gould) + *-gould) os=-sysv ;; - *-highlevel) + *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; - *-sgi) + *-sgi) os=-irix ;; - *-siemens) + *-siemens) os=-sysv4 ;; *-masscomp) @@ -1406,10 +1583,16 @@ -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; - -vxsim* | -vxworks*) + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) @@ -1433,7 +1616,7 @@ esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) --- bochs-2.3.5.orig/debian/bochs-sdl.install +++ bochs-2.3.5/debian/bochs-sdl.install @@ -0,0 +1 @@ +usr/lib/bochs/plugins/libbx_sdl.* --- bochs-2.3.5.orig/debian/README.Debian +++ bochs-2.3.5/debian/README.Debian @@ -0,0 +1,95 @@ +bochs for Debian +---------------- + +In order to use Bochs you need to follow these steps: + + - Gunzip the sample bochsrc file (in examples/bochsrc.gz) into ~/.bochsrc. + + - Take a look at ~/.bochsrc and adapt it to your needs. In particular you + need to set the "boot:" parameter. The default is to use /dev/cdrom for + boot. If you want to start from floppy or hard disk you'll need to + change that. + + - Now invoke bochs from command line or from the menu entry. + + +Upstream documentation +---------------------- + +It's in the bochs-doc package. Start with index.html. + + +sb16ctrl +-------- + +The sb16ctrl utility can be used to query the emulated SB16 device from +WITHIN the emulator. You can compile it with: + + gcc sb16ctrl.c -o sb16ctrl + +Add -static if you're not certain that the libc version of the guest +and the system where you compile are the same. + +If your guest OS is debian-based there's a "sb16ctrl-bochs" package you +can use. + + +amd64 / x86-64 support +---------------------- + +amd64 support in Bochs turned out to be not mature enough to be enabled +as default in the package, but you can easily re-enable it by adding +"--enable-x86-64" to conf_args in debian/rules and rebuilding the bochs +package. + +You can find an image of Linux, the kernel, for x86-64 in +. + +The site contains an x86-64 toolchain, cpu +specification and other resources. + + +Bochs as init +------------- + +By telling your kernel to use /etc/bochs-init/init.sh as init, you can turn +your system into a Bochs-only environment. This may be useful for simulating +that you have an i386-based PC on different hardware platforms. It is mainly +targetted at embedded systems or some such. + +If your kernel is Linux (which is the most likely), you need to pass +"init=/etc/bochs-init/init.sh" as a kernel parameter. + +Beware that Bochs is not particularly dessigned to be secure from local +attacks. This will let any user with physical access to the system to run +Bochs. Don't use this feature if you're concerned about local security. + + +Source tree +----------- + +This package's orig file contains a pristine Bochs source tree, with some +binary blobs removed (like the propietary BIOS VGABIOS-elpin-2.40 which is +not free software as per the DFSG). + +There's a script to help generating this cleaned tarball (or a snapshot +from CVS): + + $ debian/tarball.sh tarball + +or + + $ debian/tarball.sh snapshot + + +EtherBoot support +----------------- + +To be able to use EtherBoot within Bochs you can read the following +info: + + + +The pseudo NIC is now enabled by default, so there is no need to rebuild +the package. + --- bochs-2.3.5.orig/debian/bochs-doc.docs +++ bochs-2.3.5/debian/bochs-doc.docs @@ -0,0 +1,5 @@ +debian/tmp/usr/share/doc/bochs/development +debian/tmp/usr/share/doc/bochs/documentation +debian/tmp/usr/share/doc/bochs/images +debian/tmp/usr/share/doc/bochs/index.html +debian/tmp/usr/share/doc/bochs/user --- bochs-2.3.5.orig/debian/README.plugins +++ bochs-2.3.5/debian/README.plugins @@ -0,0 +1,45 @@ +Bochs supports several user interface plugins, the following is the +current list: + + - wx + - sdl + - x + - svga + - term + +In this document we will refer with '%ui%' to any of those plugins. +In Debian those are split in independent packages, having installed +the bochs-%ui% package we could use it in one of the following ways: + +1) Run it only once, using command line parameters. + + $ bochs -q 'config_interface:textconfig display_library:%ui%' + +2) To make %ui% the default. + + Edit '.bochsrc', change the 'config_interface' and 'display_library' + settings to: + + config_interface: textconfig + display_library: %ui% + + Run it: + + $ bochs + +3) Use an %ui% config file occasionaly. + + Copy your '.bochsrc' file: + + $ cp .bochsrc .bochsrc.%ui% + + Edit '.bochsrc.%ui%', change the 'config_interface' and + 'display_library' settings to: + + config_interface: textconfig + display_library: %ui% + + Run bochs with the '-f' switch: + + $ bochs -f .bochsrc.%ui% + --- bochs-2.3.5.orig/debian/sb16ctrl-bochs.install +++ bochs-2.3.5/debian/sb16ctrl-bochs.install @@ -0,0 +1 @@ +usr/bin/sb16ctrl --- bochs-2.3.5.orig/debian/bochs-svga.install +++ bochs-2.3.5/debian/bochs-svga.install @@ -0,0 +1 @@ +usr/lib/bochs/plugins/libbx_svga.* --- bochs-2.3.5.orig/debian/bochs-term.install +++ bochs-2.3.5/debian/bochs-term.install @@ -0,0 +1 @@ +usr/lib/bochs/plugins/libbx_term.* --- bochs-2.3.5.orig/debian/bochs-wx.install +++ bochs-2.3.5/debian/bochs-wx.install @@ -0,0 +1 @@ +usr/lib/bochs/plugins/libbx_wx.* --- bochs-2.3.5.orig/debian/bochs-x.install +++ bochs-2.3.5/debian/bochs-x.install @@ -0,0 +1 @@ +usr/lib/bochs/plugins/libbx_x.* --- bochs-2.3.5.orig/debian/bochs.dirs +++ bochs-2.3.5/debian/bochs.dirs @@ -0,0 +1,4 @@ +usr/share/bochs +usr/share/man +usr/share/doc/bochs/examples +usr/bin --- bochs-2.3.5.orig/debian/bochs.docs +++ bochs-2.3.5/debian/bochs.docs @@ -0,0 +1,3 @@ +README +TESTFORM.txt +debian/README.plugins --- bochs-2.3.5.orig/debian/bochs.install +++ bochs-2.3.5/debian/bochs.install @@ -0,0 +1,24 @@ +usr/lib/bochs/plugins/libbx_biosdev.* +usr/lib/bochs/plugins/libbx_cmos.* +usr/lib/bochs/plugins/libbx_dma.* +usr/lib/bochs/plugins/libbx_extfpuirq.* +usr/lib/bochs/plugins/libbx_gameport.* +usr/lib/bochs/plugins/libbx_floppy.* +usr/lib/bochs/plugins/libbx_harddrv.* +usr/lib/bochs/plugins/libbx_keyboard.* +usr/lib/bochs/plugins/libbx_busmouse.* +usr/lib/bochs/plugins/libbx_ne2k.* +usr/lib/bochs/plugins/libbx_parallel.* +usr/lib/bochs/plugins/libbx_pci* +usr/lib/bochs/plugins/libbx_pic.* +usr/lib/bochs/plugins/libbx_sb16.* +usr/lib/bochs/plugins/libbx_serial.* +usr/lib/bochs/plugins/libbx_speaker.* +usr/lib/bochs/plugins/libbx_unmapped.* +usr/lib/bochs/plugins/libbx_vga.* +usr/share/man/man1/bochs.1.gz +usr/share/man/man5/bochsrc.5.gz +usr/bin/bochs +usr/bin/bochs-bin +usr/share/bochs/keymaps +etc/bochs-init --- bochs-2.3.5.orig/debian/bochs.links +++ bochs-2.3.5/debian/bochs.links @@ -0,0 +1 @@ +usr/share/man/man1/bochs.1 usr/share/man/man1/bochs-bin.1 --- bochs-2.3.5.orig/debian/bochs.menu +++ bochs-2.3.5/debian/bochs.menu @@ -0,0 +1,5 @@ +?package(bochs): \ + section="Applications/Emulators" \ + needs="x11" \ + title="Bochs" \ + command="/usr/bin/bochs" --- bochs-2.3.5.orig/debian/bochs.postinst +++ bochs-2.3.5/debian/bochs.postinst @@ -0,0 +1,50 @@ +#! /bin/sh +# postinst script for bochs +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + +case "$1" in + configure) + + DEVICE=/dev/net/tun + + if [ ! -e /dev/.devfsd ] && [ ! -c $DEVICE ]; then + cd /dev + ./MAKEDEV tun || true + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 + --- bochs-2.3.5.orig/debian/bochsbios.dirs +++ bochs-2.3.5/debian/bochsbios.dirs @@ -0,0 +1 @@ +usr/share/bochs --- bochs-2.3.5.orig/debian/bximage.dirs +++ bochs-2.3.5/debian/bximage.dirs @@ -0,0 +1,2 @@ +usr/bin +usr/share/man/man1 --- bochs-2.3.5.orig/debian/bximage.install +++ bochs-2.3.5/debian/bximage.install @@ -0,0 +1,4 @@ +usr/bin/bximage +usr/share/man/man1/bximage.1.gz +usr/bin/bxcommit +usr/share/man/man1/bxcommit.1.gz --- bochs-2.3.5.orig/debian/compat +++ bochs-2.3.5/debian/compat @@ -0,0 +1 @@ +5 --- bochs-2.3.5.orig/debian/copyright +++ bochs-2.3.5/debian/copyright @@ -0,0 +1,40 @@ +This package was debianized by Robert Millan on +Sat, 12 Jan 2002 11:34:12 +0100. + +Now maintained by Guillem Jover . + +It was downloaded from: + + . + +The debian packages are maintained through Subversion on: + + + +Upstream Author: + + The Bochs project + +Copyright: + + Copyright (C) 2001-2006 The Bochs Project + +License: + + This package is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU Lesser General +Public License can be found in '/usr/share/common-licenses/LGPL-2.1'. + --- bochs-2.3.5.orig/debian/launcher +++ bochs-2.3.5/debian/launcher @@ -0,0 +1,10 @@ +#!/bin/sh -e +# +# Wrapper script for Bochs. + +# this allows use of a GUEST variable in bochsrc +: ${GUEST:=guest} + +# now we run bochs +GUEST=$GUEST exec bochs-bin -q "$@" + --- bochs-2.3.5.orig/debian/rules +++ bochs-2.3.5/debian/rules @@ -0,0 +1,235 @@ +#!/usr/bin/make -f +# +# $Id: rules 150 2007-12-07 06:32:53Z guillem $ +# +# Copyright (C) 1997-1999 Joey Hess +# Copyright (C) 2002-2004 Robert Millan +# Copyright (C) 2004-2007 Guillem Jover +# + +tmpdir := $(CURDIR)/debian/tmp +pkg_bochs := $(CURDIR)/debian/bochs + +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) +DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) + +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + conf_gnu_type += --build $(DEB_HOST_GNU_TYPE) +else + conf_gnu_type += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +endif + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +sb16 := dummy +cdrom := cdrom + +ifeq ($(DEB_HOST_ARCH_OS),linux) + kernel := linux + conf_args += --enable-ne2000 --enable-pnic + eth := eth0 + sb16 := linux + com := ttyS0 +ifneq (,$(findstring $(DEB_HOST_ARCH_CPU),i386 amd64)) + conf_args += --with-svga +endif +endif +ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) + kernel := fbsd + conf_args += --enable-ne2000 --enable-pnic + eth := xl0 + sb16 := freebsd + com := cuua0 + cdrom := acd0 +endif +ifeq ($(DEB_HOST_ARCH_OS),hurd) + com := com0 +endif + +include /usr/share/quilt/quilt.make + +clean: unpatch + dh_testdir + dh_testroot + + [ ! -f bios/Makefile ] || $(MAKE) -C bios bios-clean + rm -f bios/VGABIOS-* + rm -f misc/sb16/sb16ctrl + [ ! -f Makefile ] || $(MAKE) dist-clean + + -test -r /usr/share/misc/config.sub && \ + cp -fu /usr/share/misc/config.sub config.sub + -test -r /usr/share/misc/config.guess && \ + cp -fu /usr/share/misc/config.guess config.guess + + dh_clean + +# XXX: This can be moved, once we do not need to patch this file +configure.in: patch + +configure: configure.in + dh_testdir + + autoconf + +config.status: configure + dh_testdir + + CFLAGS="$(CFLAGS)" CXXFLAGS="$(CFLAGS)" ./configure \ + $(conf_gnu_type) \ + --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --with-x11 \ + --with-term \ + --with-sdl \ + --with-wx \ + --enable-cdrom \ + --enable-vbe \ + --enable-pci \ + --enable-usb \ + --enable-apic \ + --enable-cpu-level=6 \ + --enable-x86-64 \ + --enable-vme \ + --enable-fpu \ + --enable-mmx \ + --enable-3dnow \ + --enable-sse=4 \ + --enable-gdb-stub \ + --enable-disasm \ + --enable-idle-hack \ + --enable-all-optimizations \ + --enable-repeat-speedups \ + --enable-icache \ + --enable-plugins \ + --enable-save-restore \ + --enable-compressed-hd \ + --enable-sb16=$(sb16) \ + $(conf_args) + +build: build-arch + +build-arch: config.status + dh_testdir + + $(MAKE) + +ifeq ($(DEB_HOST_ARCH_CPU),i386) + $(CC) misc/sb16/sb16ctrl.c -o misc/sb16/sb16ctrl +endif + +build-indep: config.status + dh_testdir + +ifneq ($(DEB_HOST_ARCH_CPU),i386) + $(error "build-indep will only succeed on any-i386") +endif + + # bochsbios + $(MAKE) -C bios + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs -s + + # Hack to keep install target happy + touch bios/VGABIOS-fake + + $(MAKE) install DESTDIR=$(tmpdir) + + # misc cleanup + rm -f \ + $(tmpdir)/usr/share/bochs/install-x11-fonts \ + $(tmpdir)/usr/share/bochs/test-x11-fonts \ + $(tmpdir)/usr/share/man/man1/bochs-dlx.1.gz \ + $(tmpdir)/usr/share/doc/bochs/COPYING.gz \ + $(tmpdir)/usr/bin/bochs-docs + + # bochs + cat $(tmpdir)/usr/share/doc/bochs/bochsrc-sample.txt \ + | sed \ + -e "s/#kernel#/$(kernel)/g" \ + -e "s/#eth#/$(eth)/g" \ + -e "s/#com#/$(com)/g" \ + -e "s/#cdrom#/$(cdrom)/g" \ + | gzip -c9 \ + > $(pkg_bochs)/usr/share/doc/bochs/examples/bochsrc.gz + rm -f $(tmpdir)/usr/share/doc/bochs/bochsrc-sample.txt + + mv $(tmpdir)/usr/bin/bochs \ + $(tmpdir)/usr/bin/bochs-bin + install -m755 debian/launcher \ + $(tmpdir)/usr/bin/bochs + + cp -a debian/etc debian/tmp/ + chmod 755 $(tmpdir)/etc/bochs-init/init.sh + +ifeq ($(DEB_HOST_ARCH_CPU),i386) + cp misc/sb16/sb16ctrl \ + $(tmpdir)/usr/bin/ +endif + +install-indep: build-indep install + dh_testdir + dh_testroot + dh_installdirs -i + + # bochsbios + cp bios/BIOS* \ + $(tmpdir)/usr/share/bochs/ + + # bochs-doc + cp /usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif \ + $(tmpdir)/usr/share/doc/bochs/images/ + +binary-indep: install-indep + dh_testdir -i + dh_testroot -i + dh_install -i --sourcedir=$(tmpdir) + + dh_installdocs -i + dh_installexamples -i + dh_installchangelogs -i CHANGES + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +binary-arch: install + dh_testdir -s + dh_testroot -s + dh_install -s -Nbochs --sourcedir=$(tmpdir) + dh_install -pbochs --sourcedir=$(tmpdir) # bochs should be last + dh_installdocs -s + dh_installexamples -s + dh_installmenu -s + dh_installman -s + dh_installchangelogs -s CHANGES + dh_link -s + dh_strip -s + dh_compress -s + dh_fixperms -s + dh_installdeb -s + dh_shlibdeps -s + dh_gencontrol -s + dh_md5sums -s + dh_builddeb -s + +binary: binary-indep binary-arch + +.PHONY: build build-arch build-indep clean install install-indep +.PHONY: binary-indep binary-arch binary + --- bochs-2.3.5.orig/debian/sb16ctrl-bochs.docs +++ bochs-2.3.5/debian/sb16ctrl-bochs.docs @@ -0,0 +1 @@ +misc/sb16/sb16ctrl.example --- bochs-2.3.5.orig/debian/watch +++ bochs-2.3.5/debian/watch @@ -0,0 +1,4 @@ +# You can run the "uscan" command to check for upstream updates and more. +# Site Directory Pattern Version Script +version=3 +http://sf.net/bochs bochs-([\d.]*).tar.gz debian uupdate --- bochs-2.3.5.orig/debian/sb16ctrl-bochs.manpages +++ bochs-2.3.5/debian/sb16ctrl-bochs.manpages @@ -0,0 +1 @@ +debian/sb16ctrl.1 --- bochs-2.3.5.orig/debian/sb16ctrl.1 +++ bochs-2.3.5/debian/sb16ctrl.1 @@ -0,0 +1,77 @@ +.\"Document Author: Guillem Jover - +.TH sb16ctrl 1 2006-02-09 sb16ctrl "The Bochs Project" +.\"SKIP_SECTION" +.SH NAME +sb16ctrl \- SoundBlaster16 emulator control program for Bochs +.\"SKIP_SECTION" +.SH USAGE +.B sb16ctrl +.RI [ options ] +.\"SKIP_SECTION" +.SH DESCRIPTION +.LP +sb16ctrl is a program to control the operation of the SoundBlaster16 +emulator for bochs. +.\".\"DONT_SPLIT" +.SH OPTIONS +.LP +Any number of commands can be given. If none are present "\-f \-" +is assumed. The value "#" can be decimal, octal (first digit 0) +or hexadecimal (0x..). +.TP +.BI \-i # +show the selected emulator info string +.TP +.BI \-t #,#,#,#,#,# +load the patch translation into the emulator +.TP +.BI \-r +resets the patch translation table +.TP +.BI \-m #,... +sends the given midi message (up to 255 bytes) +.TP +.BI \-f filename +loads commands from the given file, or stdin if "\-" +.TP +.BI \-v +be verbose +.\"SKIP_SECTION" +.SH LICENSE +This program is distributed under the terms of the GNU +Lesser General Public License as published by the Free +Software Foundation. See the COPYING file located in +/usr/local/share/doc/bochs/ for details on the license and +the lack of warrantee. +.\"SKIP_SECTION" +.SH AVAILABILITY +The latest version of this program can be found at: + http://bochs.sourceforge.net/getcurrent.html +.\"SKIP_SECTION" +.SH SEE ALSO +.BR bochs (1), +.BR bochsrc (5), +.BR bochs-dlx (1), +.BR bximage (1). +.PP +.nf +The Bochs IA-32 Emulator site on the World Wide Web: + http://bochs.sourceforge.net + +Online Bochs Documentation: + http://bochs.sourceforge.net/doc/docbook +.fi +.\"SKIP_SECTION" +.SH AUTHORS +sb16ctrl was written by Josef Drexler. +.\"SKIP_SECTION" +.SH BUGS +Please report all bugs to the bug tracker on our web site. +Just go to http://bochs.sourceforge.net, and click "Bug +Reports" on the sidebar under "Feedback." +.PP +Provide a detailed description of the bug, the version of +the program you are running, the operating system you are +running the program on and the operating system you are +running in the emulator. + --- bochs-2.3.5.orig/debian/tarball.sh +++ bochs-2.3.5/debian/tarball.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# +# tarball.sh +# +# $Id: tarball.sh 137 2007-10-04 02:49:50Z guillem $ +# +# Copyright (C) 2004, 2007 Guillem Jover +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# + +set -e +set -u + +action=$1 +shift + +get_version() +{ + local d=$1 + + eval $(grep '^VERSION=' $d/configure.in | sed -e 's/\.cvs//' ) + + echo $VERSION +} + +echo "-> getting the source." +case "$action" in + snapshot) + echo " -> making a cvs snapshot." + + snapshot_dir="bochs-snapshot" + + if [ -d $snapshot_dir ]; then + cvs up -dP $snapshot_dir + else + export CVSROOT=":pserver:anonymous@bochs.cvs.sf.net:/cvsroot/bochs" + cvs login + cvs co -d $snapshot_dir bochs + fi + + version="$(get_version $snapshot_dir)+$(date +%Y%m%d)" + ;; + tarball) + echo " -> unpacking upstream tarball." + + upstream_dir="bochs-tarball" + upstream_tarball=$1 + + mkdir $upstream_dir + cd $upstream_dir + tar xzf ../$upstream_tarball --strip 1 + cd .. + + version=$(get_version $upstream_dir) + ;; +esac + +tarball=bochs_$version.orig.tar.gz +tree=bochs-$version + +echo "-> filling the working tree." +case "$action" in + snapshot) + cp -al $snapshot_dir $tree + ;; + tarball) + mv $upstream_dir $tree + ;; +esac + +if ! [ -e $tree/bochs.h ] +then + echo "error: no bochs tree available." + exit 1 +fi + +echo "-> cleaning tree." +# Clean non-free stuff +rm -f $tree/bios/BIOS* +rm -f $tree/bios/VGABIOS* +rm -f $tree/bios/acpi-dsdt.hex +rm -f $tree/patches/beos-gui-fabo.capture-filter +# Clean cvs stuff +find $tree -name 'CVS' -o -name '.cvsignore' | xargs rm -rf + +echo "-> creating new tarball." +tar czf $tarball $tree + +echo "-> cleaning directory tree." +rm -rf $tree + --- bochs-2.3.5.orig/debian/bochsbios-qemu.dirs +++ bochs-2.3.5/debian/bochsbios-qemu.dirs @@ -0,0 +1 @@ +usr/share/bochs --- bochs-2.3.5.orig/debian/etc/bochs-init/bochsrc +++ bochs-2.3.5/debian/etc/bochs-init/bochsrc @@ -0,0 +1,43 @@ +config_interface: textconfig +display_library: sdl +romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000 +megs: 32 +vgaromimage: file=/usr/share/vgabios/vgabios.bin +floppya: 1_44=/dev/fd0, status=inserted +ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 +ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15 +ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11 +ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9 +#ata0-master: type=disk, path="", mode=flat, cylinders=1024, heads=16, spt=63 +ata0-slave: type=cdrom, path="/dev/cdrom", status=inserted + +boot: cdrom + +ips: 1000000 +floppy_bootsig_check: disabled=0 +log: /dev/stdout +panic: action=ask +error: action=report +info: action=report +debug: action=ignore +debugger_log: - +com1: enabled=1, dev=/dev/ttyS0 +parport1: enabled=1, file="/dev/lp0" +sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=/dev/stdout, dmatimer=600000 +vga_update_interval: 300000 +keyboard_serial_delay: 250 +keyboard_paste_delay: 100000 +floppy_command_delay: 500 +mouse: enabled=1 +private_colormap: enabled=0 +#ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0 +#keyboard_mapping: enabled=0, map=/usr/share/bochs/keymaps/x11-pc-de.map +#keyboard_type: mf +#user_shortcut: keys=ctrlaltdel +#magic_break: enabled=1 +#cmosimage: cmos.img +#load32bitOSImage: os=nullkernel, path=../kernel.img, iolog=../vga_io.log +#load32bitOSImage: os=linux, path=../linux.img, iolog=../vga_io.log, initrd=../initrd.img +#i440fxsupport: enabled=1 +usb1: enabled=1, ioaddr=0xFF80, irq=10 +#text_snapshot_check: enable --- bochs-2.3.5.orig/debian/etc/bochs-init/init.sh +++ bochs-2.3.5/debian/etc/bochs-init/init.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +mount / -o rw,remount +export PATH=/usr/X11R6/bin:$PATH + +while true +do + echo -n " + - Run [B]ochs + - Run [S]hell + - [R]eboot +Choose an option: " + read + case $REPLY in + B|b) + startx $(which bochs-bin) -qf /etc/bochs-init/bochsrc + ;; + S|s) + login + ;; + R|r) + sync + mount / -o ro,remount + reboot + ;; + esac +done + --- bochs-2.3.5.orig/debian/patches/00_base.patch +++ bochs-2.3.5/debian/patches/00_base.patch @@ -0,0 +1,201 @@ +Index: b/.bochsrc +=================================================================== +--- a/.bochsrc 2007-09-15 19:00:17.000000000 +0300 ++++ b/.bochsrc 2007-11-20 04:25:51.000000000 +0200 +@@ -17,7 +17,7 @@ + # the "wx" display library. + #======================================================================= + #config_interface: textconfig +-#config_interface: wx ++config_interface: wx + + #======================================================================= + # DISPLAY_LIBRARY +@@ -31,15 +31,9 @@ + # + # The choices are: + # x use X windows interface, cross platform +-# win32 use native win32 libraries +-# carbon use Carbon library (for MacOS X) +-# beos use native BeOS libraries +-# macintosh use MacOS pre-10 +-# amigaos use native AmigaOS libraries + # sdl use SDL library, cross platform + # svga use SVGALIB library for Linux, allows graphics without X11 + # term text only, uses curses/ncurses library, cross platform +-# rfb provides an interface to AT&T's VNC viewer, cross platform + # wx use wxWidgets library, cross platform + # nogui no display at all + # +@@ -50,17 +44,10 @@ + # Some display libraries now support specific option to control their + # behaviour. See the examples below for currently supported options. + #======================================================================= +-#display_library: amigaos +-#display_library: beos +-#display_library: carbon +-#display_library: macintosh + #display_library: nogui +-#display_library: rfb, options="timeout=60" # time to wait for client + #display_library: sdl, options="fullscreen" # startup in fullscreen mode + #display_library: term +-#display_library: win32, options="legacyF12" # use F12 to toggle mouse +-#display_library: win32, options="windebug" # use experimental debugger gui +-#display_library: wx ++display_library: wx + #display_library: x + + #======================================================================= +@@ -76,7 +63,7 @@ + # now supported, but we still recommend to use the BIOS distributed with + # Bochs. Now the start address can be calculated from image size. + #======================================================================= +-romimage: file=$BXSHARE/BIOS-bochs-latest ++romimage: file=/usr/share/bochs/BIOS-bochs-latest + #romimage: file=mybios.bin, address=0xfff80000 # 512k at memory top + + #======================================================================= +@@ -162,9 +149,8 @@ megs: 32 + # VGAROMIMAGE + # You now need to load a VGA ROM BIOS into C0000. + #======================================================================= +-#vgaromimage: file=bios/VGABIOS-elpin-2.40 +-vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest +-#vgaromimage: file=bios/VGABIOS-lgpl-latest-cirrus ++vgaromimage: file=/usr/share/vgabios/vgabios.bin ++#vgaromimage: file=/usr/share/vgabios/vgabios.debug.bin + + #======================================================================= + # VGA: +@@ -283,13 +269,10 @@ ata3: enabled=0, ioaddr1=0x168, ioaddr2= + # ata3-master: type=disk, mode=flat, path=483M.sample, cylinders=1024, heads=15, spt=63 + # ata3-slave: type=cdrom, path=iso.sample, status=inserted + #======================================================================= +-ata0-master: type=disk, mode=flat, path="30M.sample" +-#ata0-master: type=disk, mode=flat, path="30M.sample", cylinders=615, heads=6, spt=17 ++#ata0-master: type=disk, mode=flat, path="d.sample" ++#ata0-master: type=disk, mode=flat, path="$HOME/.bochs/guest.hd0", cylinders=#cylinders#, heads=16, spt=63 + #ata0-master: type=disk, mode=flat, path="c.img", cylinders=0 # autodetect +-#ata0-slave: type=cdrom, path=D:, status=inserted +-#ata0-slave: type=cdrom, path=/dev/cdrom, status=inserted +-#ata0-slave: type=cdrom, path="drive", status=inserted +-#ata0-slave: type=cdrom, path=/dev/rcd0d, status=inserted ++ata0-slave: type=cdrom, path=/dev/#cdrom#, status=inserted + + #======================================================================= + # BOOT: +@@ -303,7 +286,8 @@ ata0-master: type=disk, mode=flat, path= + # boot: cdrom, floppy, disk + #======================================================================= + #boot: floppy +-boot: disk ++#boot: disk ++boot: cdrom + + #======================================================================= + # CLOCK: +@@ -358,8 +342,9 @@ floppy_bootsig_check: disabled=0 + # log: ./bochs.out + # log: /dev/tty + #======================================================================= ++log: /dev/stdout + #log: /dev/null +-log: bochsout.txt ++#log: /tmp/bochsout.txt + + #======================================================================= + # LOGPREFIX: +@@ -440,7 +425,7 @@ debugger_log: - + # com3: enabled=1, mode=raw, dev=com1 + # com3: enabled=1, mode=socket, dev=localhost:8888 + #======================================================================= +-#com1: enabled=1, mode=term, dev=/dev/ttyp9 ++com1: enabled=1, mode=term, dev=/dev/#com# + + + #======================================================================= +@@ -456,7 +441,7 @@ debugger_log: - + # parport2: enabled=1, file="/dev/lp0" + # parport1: enabled=0 + #======================================================================= +-parport1: enabled=1, file="parport.out" ++parport1: enabled=1, file="/dev/lp0" + + #======================================================================= + # SB16: +@@ -493,7 +478,7 @@ parport1: enabled=1, file="parport.out" + # For an example look at the next line: + #======================================================================= + +-#sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=sb16.log, dmatimer=600000 ++sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=/dev/stdout, dmatimer=600000 + + #======================================================================= + # VGA_UPDATE_INTERVAL: +@@ -574,18 +559,6 @@ mouse: enabled=0 + private_colormap: enabled=0 + + #======================================================================= +-# fullscreen: ONLY IMPLEMENTED ON AMIGA +-# Request that Bochs occupy the entire screen instead of a +-# window. +-# +-# Examples: +-# fullscreen: enabled=0 +-# fullscreen: enabled=1 +-#======================================================================= +-#fullscreen: enabled=0 +-#screenmode: name="sample" +- +-#======================================================================= + # ne2k: NE2000 compatible ethernet adapter + # + # Examples: +@@ -625,10 +598,7 @@ private_colormap: enabled=0 + # overwrite files. + # + #======================================================================= +-# ne2k: ioaddr=0x300, irq=9, mac=fe:fd:00:00:00:01, ethmod=fbsd, ethdev=en0 #macosx +-# ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:00, ethmod=fbsd, ethdev=xl0 +-# ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0 +-# ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:01, ethmod=win32, ethdev=MYCARD ++# ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:00, ethmod=#kernel#, ethdev=#eth# + # ne2k: ioaddr=0x300, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0 + # ne2k: ioaddr=0x300, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun0, script=./tunconfig + # ne2k: ioaddr=0x300, irq=9, mac=b0:c4:20:00:00:01, ethmod=null, ethdev=eth0 +@@ -644,7 +614,7 @@ private_colormap: enabled=0 + # Examples: + # keyboard_mapping: enabled=1, map=gui/keymaps/x11-pc-de.map + #======================================================================= +-keyboard_mapping: enabled=0, map= ++#keyboard_mapping: enabled=0, map=/usr/share/bochs/keymaps/x11-pc-de.map + + #======================================================================= + # KEYBOARD_TYPE: +@@ -752,11 +722,3 @@ i440fxsupport: enabled=1 + #======================================================================= + #ips: 10000000 + +-#======================================================================= +-# for Macintosh, use the style of pathnames in the following +-# examples. +-# +-# vgaromimage: :bios:VGABIOS-elpin-2.40 +-# romimage: file=:bios:BIOS-bochs-latest, address=0xf0000 +-# floppya: 1_44=[fd:], status=inserted +-#======================================================================= +Index: b/doc/man/bochs.1 +=================================================================== +--- a/doc/man/bochs.1 2005-12-29 21:51:00.000000000 +0200 ++++ b/doc/man/bochs.1 2007-11-20 04:24:58.000000000 +0200 +@@ -57,8 +57,8 @@ Example: + .SH LICENSE + This program is distributed under the terms of the GNU + Lesser General Public License as published by the Free +-Software Foundation. See the COPYING file located in +-/usr/local/share/doc/bochs/ for details on the license and ++Software Foundation. See the LGPL file located in ++/usr/share/common-licenses/ for details on the license and + the lack of warranty. + .\"SKIP_SECTION" + .SH AVAILABILITY --- bochs-2.3.5.orig/debian/patches/02_libtool.patch +++ bochs-2.3.5/debian/patches/02_libtool.patch @@ -0,0 +1,139 @@ +Index: b/gui/Makefile.in +=================================================================== +--- a/gui/Makefile.in 2007-04-09 00:57:05.000000000 +0300 ++++ b/gui/Makefile.in 2007-12-07 08:15:05.000000000 +0200 +@@ -112,47 +112,47 @@ libgui.a: $(NONPLUGIN_OBJS) + + ##### building plugins with libtool + %.lo: %.@CPP_SUFFIX@ +- $(LIBTOOL) --mode=compile $(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $< -o $@ ++ $(LIBTOOL) --mode=compile --tag CXX $(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $< -o $@ + + libbx_%.la: %.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) + + libbx_x.la: x.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_X) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_X) + + libbx_sdl.la: sdl.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_SDL) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_SDL) + + libbx_svga.la: svga.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_SVGA) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_SVGA) + + libbx_beos.la: beos.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_BEOS) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_BEOS) + + libbx_rfb.la: rfb.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_RFB) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_RFB) + + libbx_amigaos.la: amigaos.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_AMIGAOS) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_AMIGAOS) + + libbx_win32.la: win32.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_WIN32) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_WIN32) + + libbx_macos.la: macos.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_MACOS) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_MACOS) + + libbx_carbon.la: carbon.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_CARBON) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_CARBON) + + libbx_nogui.la: nogui.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_NOGUI) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_NOGUI) + + libbx_term.la: term.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_TERM) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_TERM) + + # special link rules for plugins that require more than one object file + libbx_wx.la: $(GUI_OBJS_WX:.o=.lo) $(GUI_OBJS_WX_SUPPORT:.o=.lo) +- $(LIBTOOL) --mode=link $(CXX) -module $(GUI_OBJS_WX:.o=.lo) $(GUI_OBJS_WX_SUPPORT:.o=.lo) -o libbx_wx.la -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_WX) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $(GUI_OBJS_WX:.o=.lo) $(GUI_OBJS_WX_SUPPORT:.o=.lo) -o libbx_wx.la -rpath $(PLUGIN_PATH) $(GUI_LINK_OPTS_WX) + + #### building DLLs for win32 (tested on cygwin only) + bx_%.dll: %.o +Index: b/iodev/Makefile.in +=================================================================== +--- a/iodev/Makefile.in 2007-09-10 19:00:15.000000000 +0300 ++++ b/iodev/Makefile.in 2007-12-07 08:15:05.000000000 +0200 +@@ -129,41 +129,41 @@ pcidev.o : pcidev.@CPP_SUFFIX@ + + ##### building plugins with libtool + %.lo: %.@CPP_SUFFIX@ +- $(LIBTOOL) --mode=compile $(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $< -o $@ ++ $(LIBTOOL) --mode=compile --tag CXX $(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $< -o $@ + + pcidev.lo : pcidev.@CPP_SUFFIX@ +- $(LIBTOOL) --mode=compile $(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $(PCIDEV_CXXFLAGS) $< -o $@ ++ $(LIBTOOL) --mode=compile --tag CXX $(CXX) -c $(CXXFLAGS) $(LOCAL_CXXFLAGS) $(PCIDEV_CXXFLAGS) $< -o $@ + + libbx_%.la: %.lo +- $(LIBTOOL) --mode=link $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module $< -o $@ -rpath $(PLUGIN_PATH) + + # special link rules for plugins that require more than one object file + libbx_harddrv.la: harddrv.lo hdimage.lo vmware3.lo vmware4.lo $(CDROM_OBJS:.o=.lo) +- $(LIBTOOL) --mode=link $(CXX) -module harddrv.lo hdimage.lo vmware3.lo vmware4.lo $(CDROM_OBJS:.o=.lo) -o libbx_harddrv.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module harddrv.lo hdimage.lo vmware3.lo vmware4.lo $(CDROM_OBJS:.o=.lo) -o libbx_harddrv.la -rpath $(PLUGIN_PATH) + + libbx_keyboard.la: keyboard.lo scancodes.lo +- $(LIBTOOL) --mode=link $(CXX) -module keyboard.lo scancodes.lo -o libbx_keyboard.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module keyboard.lo scancodes.lo -o libbx_keyboard.la -rpath $(PLUGIN_PATH) + + libbx_pit.la: pit82c54.lo pit_wrap.lo +- $(LIBTOOL) --mode=link $(CXX) -module pit82c54.lo pit_wrap.lo -o libbx_pit.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module pit82c54.lo pit_wrap.lo -o libbx_pit.la -rpath $(PLUGIN_PATH) + + libbx_sb16.la: sb16.lo $(SOUNDLOW_OBJS:.o=.lo) +- $(LIBTOOL) --mode=link $(CXX) -module sb16.lo $(SOUNDLOW_OBJS:.o=.lo) -o libbx_sb16.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module sb16.lo $(SOUNDLOW_OBJS:.o=.lo) -o libbx_sb16.la -rpath $(PLUGIN_PATH) + + libbx_ne2k.la: ne2k.lo $(NETLOW_OBJS:.o=.lo) +- $(LIBTOOL) --mode=link $(CXX) -module ne2k.lo $(NETLOW_OBJS:.o=.lo) -o libbx_ne2k.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module ne2k.lo $(NETLOW_OBJS:.o=.lo) -o libbx_ne2k.la -rpath $(PLUGIN_PATH) + + libbx_pcipnic.la: pcipnic.lo $(NETLOW_OBJS:.o=.lo) +- $(LIBTOOL) --mode=link $(CXX) -module pcipnic.lo $(NETLOW_OBJS:.o=.lo) -o libbx_pcipnic.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module pcipnic.lo $(NETLOW_OBJS:.o=.lo) -o libbx_pcipnic.la -rpath $(PLUGIN_PATH) + + libbx_serial.la: serial.lo serial_raw.lo +- $(LIBTOOL) --mode=link $(CXX) -module serial.lo serial_raw.lo -o libbx_serial.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module serial.lo serial_raw.lo -o libbx_serial.la -rpath $(PLUGIN_PATH) + + libbx_vga.la: vga.lo svga_cirrus.lo +- $(LIBTOOL) --mode=link $(CXX) -module vga.lo svga_cirrus.lo -o libbx_vga.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module vga.lo svga_cirrus.lo -o libbx_vga.la -rpath $(PLUGIN_PATH) + + libbx_pciusb.la: pciusb.lo usb_hid.lo usb_msd.lo scsi_device.lo hdimage.lo cdrom.lo +- $(LIBTOOL) --mode=link $(CXX) -module pciusb.lo usb_hid.lo usb_msd.lo scsi_device.lo hdimage.lo cdrom.lo -o libbx_pciusb.la -rpath $(PLUGIN_PATH) ++ $(LIBTOOL) --mode=link --tag CXX $(CXX) -module pciusb.lo usb_hid.lo usb_msd.lo scsi_device.lo hdimage.lo cdrom.lo -o libbx_pciusb.la -rpath $(PLUGIN_PATH) + + #### building DLLs for win32 (tested on cygwin only) + bx_%.dll: %.o +Index: b/configure.in +=================================================================== +--- a/configure.in 2007-09-16 10:53:00.000000000 +0300 ++++ b/configure.in 2007-12-07 08:15:05.000000000 +0200 +@@ -2052,8 +2052,8 @@ OFP="-o " + MAKELIB="ar rv \$@" + RMCOMMAND="rm -f " + # first define link variables without libtool +-LINK="\$(CXX) -o \$@ \$(CXXFLAGS) \$(LDFLAGS)" +-LINK_CONSOLE="\$(CXX) -o \$@ \$(CXXFLAGS_CONSOLE) \$(LDFLAGS)" ++LINK="--tag CXX \$(CXX) -o \$@ \$(CXXFLAGS) \$(LDFLAGS)" ++LINK_CONSOLE="--tag CXX \$(CXX) -o \$@ \$(CXXFLAGS_CONSOLE) \$(LDFLAGS)" + # unless NO_LT is set, add libtool to the front of the link command + if test "$NO_LT" != 1; then + LINK="\$(LIBTOOL) --mode=link $LINK" --- bochs-2.3.5.orig/debian/patches/04_man_table.patch +++ bochs-2.3.5/debian/patches/04_man_table.patch @@ -0,0 +1,30 @@ +Index: b/doc/man/bochsrc.5 +=================================================================== +--- a/doc/man/bochsrc.5 2007-09-15 19:00:25.000000000 +0300 ++++ b/doc/man/bochsrc.5 2007-12-07 08:15:25.000000000 +0200 +@@ -146,13 +146,18 @@ starts to autorepeat, and the measureme + BogoMips and other benchmarks. + + Example Specifications[1] +- Bochs Machine/Compiler Mips +- ------------------------------------------------------------------- +- 2.2.6 2.6Ghz Intel Core 2 Duo with WinXP/g++ 3.4 21 to 25 Mips +- 2.2.6 2.1Ghz Athlon XP with Linux 2.6/g++ 3.4 12 to 15 Mips +- 2.0.1 1.6Ghz Intel P4 with Win2000/g++ 3.3 5 to 7 Mips +- 1.4 650Mhz Athlon K-7 with Linux 2.4.4/egcs-2.91.66 2 to 2.5 Mips +- 1.4 400Mhz Pentium II with Linux 2.0.36/egcs-1.0.3 1 to 1.8 Mips ++ ++.TS ++tab (@); ++l l l. ++Bochs@Machine/Compiler@Mips ++_ ++2.2.6@2.6Ghz Intel Core 2 Duo with WinXP/g++ 3.4@21 to 25 Mips ++2.2.6@2.1Ghz Athlon XP with Linux 2.6/g++ 3.4@12 to 15 Mips ++2.0.1@1.6Ghz Intel P4 with Win2000/g++ 3.3@ 5 to 7 Mips ++1.4@650Mhz Athlon K-7 with Linux 2.4.4/egcs-2.91.66@ 2 to 2.5 Mips ++1.4@400Mhz Pentium II with Linux 2.0.36/egcs-1.0.3@ 1 to 1.8 Mips ++.TE + + [1] IPS measurements depend on OS and compiler + configuration in addition to processor clock --- bochs-2.3.5.orig/debian/patches/plex86.disabled +++ bochs-2.3.5/debian/patches/plex86.disabled @@ -0,0 +1,12224 @@ +diff -Nur bochs-2.0.2+20030829.old/config.h.in bochs-2.0.2+20030829/config.h.in +--- bochs-2.0.2+20030829.old/config.h.in 2003-08-24 23:39:33.000000000 +0000 ++++ bochs-2.0.2+20030829/config.h.in 2003-08-29 14:31:40.000000000 +0000 +@@ -914,4 +914,6 @@ + //#define BX_SCHEDULED_DIE_TIME 1162230000 // end of redhat6.0 boot + + ++#undef BX_USE_PLEX86 ++ + #endif // _BX_CONFIG_H +diff -Nur bochs-2.0.2+20030829.old/configure.in bochs-2.0.2+20030829/configure.in +--- bochs-2.0.2+20030829.old/configure.in 2003-08-29 14:14:48.000000000 +0000 ++++ bochs-2.0.2+20030829/configure.in 2003-08-29 14:31:40.000000000 +0000 +@@ -1715,6 +1715,20 @@ + AC_SUBST(INSTALL_DOCBOOK_VAR) + AC_SUBST(DOCBOOK2HTML) + ++AC_MSG_CHECKING(for Plex86 support) ++AC_ARG_ENABLE(plex86, ++ [ --enable-plex86 support a Plex86 backend (i386 only)], ++ [if test "$enableval" = yes; then ++ AC_MSG_RESULT(yes) ++ AC_DEFINE(BX_USE_PLEX86, 1) ++ EXTRA_BX_OBJS="$EXTRA_BX_OBJS plex86.o" ++ else ++ AC_MSG_RESULT(no) ++ AC_DEFINE(BX_USE_PLEX86, 0) ++ fi ++ ] ++ ) ++ + PRIMARY_TARGET='bochs' + PLUGIN_LIBNAME_TRANSFORMATION='%.o=libbx_%.la' + +diff -Nur bochs-2.0.2+20030829.old/main.cc bochs-2.0.2+20030829/main.cc +--- bochs-2.0.2+20030829.old/main.cc 2003-08-27 17:52:02.000000000 +0000 ++++ bochs-2.0.2+20030829/main.cc 2003-08-29 14:31:40.000000000 +0000 +@@ -28,6 +28,10 @@ + #include "bochs.h" + #include + #include "state_file.h" ++#if BX_USE_PLEX86 ++#include "plex86.h" ++unsigned short int using_plex86; ++#endif + + #ifdef HAVE_LOCALE_H + #include +@@ -60,6 +64,7 @@ + + int bochsrc_include_count = 0; + ++ + extern "C" { + #include + } +@@ -2202,6 +2207,17 @@ + bx_dbg_main(argc, argv); + #else + ++#if BX_USE_PLEX86 ++ // If plex86 is requested, open plex86 device. ++ if (plex86Open() > -1) ++ using_plex86 = 1; ++ else ++ { ++ using_plex86 = 0; ++ BX_INFO(("Failed to open plex86 device.")); ++ } ++#endif ++ + bx_init_hardware(); + + if (bx_options.load32bitOSImage.OwhichOS->get ()) { +@@ -2498,7 +2514,12 @@ + signal(SIGALRM, SIG_DFL); + #endif + #endif +- return 0; ++ ++#if BX_USE_PLEX86 ++ if (using_plex86) ++ plex86TearDown(); ++#endif ++ return 0; + } + + #if BX_PROVIDE_MAIN +diff -Nur bochs-2.0.2+20030829.old/memory/misc_mem.cc bochs-2.0.2+20030829/memory/misc_mem.cc +--- bochs-2.0.2+20030829.old/memory/misc_mem.cc 2003-08-06 08:24:14.000000000 +0000 ++++ bochs-2.0.2+20030829/memory/misc_mem.cc 2003-08-29 14:31:40.000000000 +0000 +@@ -33,7 +33,10 @@ + #include "bochs.h" + #define LOG_THIS BX_MEM(0)-> + +- ++#if BX_USE_PLEX86 ++#include "plex86.h" ++extern unsigned short int using_plex86; ++#endif + + #if BX_PROVIDE_CPU_MEMORY + Bit32u +@@ -68,10 +71,23 @@ + { + if (actual_vector != NULL) { + BX_INFO (("freeing existing memory vector")); +- delete [] actual_vector; ++#if BX_USE_PLEX86 ++ if (!using_plex86) ++#endif ++ delete [] actual_vector; + actual_vector = NULL; + vector = NULL; + } ++#if BX_USE_PLEX86 ++ if (plex86State == Plex86StateFDOpened) { ++ actual_vector = vector = plex86AllocateMemory(bytes >> 20); ++ if (vector == 0) { ++ BX_PANIC(("Failed allocation of memory from plex86 device.\n")); ++ return; ++ } ++ } ++ else { ++#endif + Bit64u test_mask = alignment - 1; + actual_vector = new Bit8u [bytes+test_mask]; + // round address forward to nearest multiple of alignment. Alignment +@@ -84,6 +100,9 @@ + BX_ASSERT (vector+bytes <= actual_vector+bytes+test_mask); + BX_INFO (("allocated memory at %p. after alignment, vector=%p", + actual_vector, vector)); ++#if BX_USE_PLEX86 ++ } ++#endif + } + #endif + +@@ -114,7 +133,10 @@ + BX_MEM_C::~BX_MEM_C(void) + { + if (this-> vector != NULL) { +- delete [] actual_vector; ++#if BX_USE_PLEX86 ++ if (!using_plex86) ++#endif ++ delete [] actual_vector; + actual_vector = NULL; + vector = NULL; + } +diff -Nur bochs-2.0.2+20030829.old/plex86/COPYING bochs-2.0.2+20030829/plex86/COPYING +--- bochs-2.0.2+20030829.old/plex86/COPYING 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/COPYING 1970-01-01 00:00:00.000000000 +0000 +@@ -1,504 +0,0 @@ +- GNU LESSER GENERAL PUBLIC LICENSE +- Version 2.1, February 1999 +- +- Copyright (C) 1991, 1999 Free Software Foundation, Inc. +- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- Everyone is permitted to copy and distribute verbatim copies +- of this license document, but changing it is not allowed. +- +-[This is the first released version of the Lesser GPL. It also counts +- as the successor of the GNU Library Public License, version 2, hence +- the version number 2.1.] +- +- Preamble +- +- The licenses for most software are designed to take away your +-freedom to share and change it. By contrast, the GNU General Public +-Licenses are intended to guarantee your freedom to share and change +-free software--to make sure the software is free for all its users. +- +- This license, the Lesser General Public License, applies to some +-specially designated software packages--typically libraries--of the +-Free Software Foundation and other authors who decide to use it. You +-can use it too, but we suggest you first think carefully about whether +-this license or the ordinary General Public License is the better +-strategy to use in any particular case, based on the explanations below. +- +- When we speak of free software, we are referring to freedom of use, +-not price. Our General Public Licenses are designed to make sure that +-you have the freedom to distribute copies of free software (and charge +-for this service if you wish); that you receive source code or can get +-it if you want it; that you can change the software and use pieces of +-it in new free programs; and that you are informed that you can do +-these things. +- +- To protect your rights, we need to make restrictions that forbid +-distributors to deny you these rights or to ask you to surrender these +-rights. These restrictions translate to certain responsibilities for +-you if you distribute copies of the library or if you modify it. +- +- For example, if you distribute copies of the library, whether gratis +-or for a fee, you must give the recipients all the rights that we gave +-you. You must make sure that they, too, receive or can get the source +-code. If you link other code with the library, you must provide +-complete object files to the recipients, so that they can relink them +-with the library after making changes to the library and recompiling +-it. And you must show them these terms so they know their rights. +- +- We protect your rights with a two-step method: (1) we copyright the +-library, and (2) we offer you this license, which gives you legal +-permission to copy, distribute and/or modify the library. +- +- To protect each distributor, we want to make it very clear that +-there is no warranty for the free library. Also, if the library is +-modified by someone else and passed on, the recipients should know +-that what they have is not the original version, so that the original +-author's reputation will not be affected by problems that might be +-introduced by others. +- +- Finally, software patents pose a constant threat to the existence of +-any free program. We wish to make sure that a company cannot +-effectively restrict the users of a free program by obtaining a +-restrictive license from a patent holder. Therefore, we insist that +-any patent license obtained for a version of the library must be +-consistent with the full freedom of use specified in this license. +- +- Most GNU software, including some libraries, is covered by the +-ordinary GNU General Public License. This license, the GNU Lesser +-General Public License, applies to certain designated libraries, and +-is quite different from the ordinary General Public License. We use +-this license for certain libraries in order to permit linking those +-libraries into non-free programs. +- +- When a program is linked with a library, whether statically or using +-a shared library, the combination of the two is legally speaking a +-combined work, a derivative of the original library. The ordinary +-General Public License therefore permits such linking only if the +-entire combination fits its criteria of freedom. The Lesser General +-Public License permits more lax criteria for linking other code with +-the library. +- +- We call this license the "Lesser" General Public License because it +-does Less to protect the user's freedom than the ordinary General +-Public License. It also provides other free software developers Less +-of an advantage over competing non-free programs. These disadvantages +-are the reason we use the ordinary General Public License for many +-libraries. However, the Lesser license provides advantages in certain +-special circumstances. +- +- For example, on rare occasions, there may be a special need to +-encourage the widest possible use of a certain library, so that it becomes +-a de-facto standard. To achieve this, non-free programs must be +-allowed to use the library. A more frequent case is that a free +-library does the same job as widely used non-free libraries. In this +-case, there is little to gain by limiting the free library to free +-software only, so we use the Lesser General Public License. +- +- In other cases, permission to use a particular library in non-free +-programs enables a greater number of people to use a large body of +-free software. For example, permission to use the GNU C Library in +-non-free programs enables many more people to use the whole GNU +-operating system, as well as its variant, the GNU/Linux operating +-system. +- +- Although the Lesser General Public License is Less protective of the +-users' freedom, it does ensure that the user of a program that is +-linked with the Library has the freedom and the wherewithal to run +-that program using a modified version of the Library. +- +- The precise terms and conditions for copying, distribution and +-modification follow. Pay close attention to the difference between a +-"work based on the library" and a "work that uses the library". The +-former contains code derived from the library, whereas the latter must +-be combined with the library in order to run. +- +- GNU LESSER GENERAL PUBLIC LICENSE +- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +- +- 0. This License Agreement applies to any software library or other +-program which contains a notice placed by the copyright holder or +-other authorized party saying it may be distributed under the terms of +-this Lesser General Public License (also called "this License"). +-Each licensee is addressed as "you". +- +- A "library" means a collection of software functions and/or data +-prepared so as to be conveniently linked with application programs +-(which use some of those functions and data) to form executables. +- +- The "Library", below, refers to any such software library or work +-which has been distributed under these terms. A "work based on the +-Library" means either the Library or any derivative work under +-copyright law: that is to say, a work containing the Library or a +-portion of it, either verbatim or with modifications and/or translated +-straightforwardly into another language. (Hereinafter, translation is +-included without limitation in the term "modification".) +- +- "Source code" for a work means the preferred form of the work for +-making modifications to it. For a library, complete source code means +-all the source code for all modules it contains, plus any associated +-interface definition files, plus the scripts used to control compilation +-and installation of the library. +- +- Activities other than copying, distribution and modification are not +-covered by this License; they are outside its scope. The act of +-running a program using the Library is not restricted, and output from +-such a program is covered only if its contents constitute a work based +-on the Library (independent of the use of the Library in a tool for +-writing it). Whether that is true depends on what the Library does +-and what the program that uses the Library does. +- +- 1. You may copy and distribute verbatim copies of the Library's +-complete source code as you receive it, in any medium, provided that +-you conspicuously and appropriately publish on each copy an +-appropriate copyright notice and disclaimer of warranty; keep intact +-all the notices that refer to this License and to the absence of any +-warranty; and distribute a copy of this License along with the +-Library. +- +- You may charge a fee for the physical act of transferring a copy, +-and you may at your option offer warranty protection in exchange for a +-fee. +- +- 2. You may modify your copy or copies of the Library or any portion +-of it, thus forming a work based on the Library, and copy and +-distribute such modifications or work under the terms of Section 1 +-above, provided that you also meet all of these conditions: +- +- a) The modified work must itself be a software library. +- +- b) You must cause the files modified to carry prominent notices +- stating that you changed the files and the date of any change. +- +- c) You must cause the whole of the work to be licensed at no +- charge to all third parties under the terms of this License. +- +- d) If a facility in the modified Library refers to a function or a +- table of data to be supplied by an application program that uses +- the facility, other than as an argument passed when the facility +- is invoked, then you must make a good faith effort to ensure that, +- in the event an application does not supply such function or +- table, the facility still operates, and performs whatever part of +- its purpose remains meaningful. +- +- (For example, a function in a library to compute square roots has +- a purpose that is entirely well-defined independent of the +- application. Therefore, Subsection 2d requires that any +- application-supplied function or table used by this function must +- be optional: if the application does not supply it, the square +- root function must still compute square roots.) +- +-These requirements apply to the modified work as a whole. If +-identifiable sections of that work are not derived from the Library, +-and can be reasonably considered independent and separate works in +-themselves, then this License, and its terms, do not apply to those +-sections when you distribute them as separate works. But when you +-distribute the same sections as part of a whole which is a work based +-on the Library, the distribution of the whole must be on the terms of +-this License, whose permissions for other licensees extend to the +-entire whole, and thus to each and every part regardless of who wrote +-it. +- +-Thus, it is not the intent of this section to claim rights or contest +-your rights to work written entirely by you; rather, the intent is to +-exercise the right to control the distribution of derivative or +-collective works based on the Library. +- +-In addition, mere aggregation of another work not based on the Library +-with the Library (or with a work based on the Library) on a volume of +-a storage or distribution medium does not bring the other work under +-the scope of this License. +- +- 3. You may opt to apply the terms of the ordinary GNU General Public +-License instead of this License to a given copy of the Library. To do +-this, you must alter all the notices that refer to this License, so +-that they refer to the ordinary GNU General Public License, version 2, +-instead of to this License. (If a newer version than version 2 of the +-ordinary GNU General Public License has appeared, then you can specify +-that version instead if you wish.) Do not make any other change in +-these notices. +- +- Once this change is made in a given copy, it is irreversible for +-that copy, so the ordinary GNU General Public License applies to all +-subsequent copies and derivative works made from that copy. +- +- This option is useful when you wish to copy part of the code of +-the Library into a program that is not a library. +- +- 4. You may copy and distribute the Library (or a portion or +-derivative of it, under Section 2) in object code or executable form +-under the terms of Sections 1 and 2 above provided that you accompany +-it with the complete corresponding machine-readable source code, which +-must be distributed under the terms of Sections 1 and 2 above on a +-medium customarily used for software interchange. +- +- If distribution of object code is made by offering access to copy +-from a designated place, then offering equivalent access to copy the +-source code from the same place satisfies the requirement to +-distribute the source code, even though third parties are not +-compelled to copy the source along with the object code. +- +- 5. A program that contains no derivative of any portion of the +-Library, but is designed to work with the Library by being compiled or +-linked with it, is called a "work that uses the Library". Such a +-work, in isolation, is not a derivative work of the Library, and +-therefore falls outside the scope of this License. +- +- However, linking a "work that uses the Library" with the Library +-creates an executable that is a derivative of the Library (because it +-contains portions of the Library), rather than a "work that uses the +-library". The executable is therefore covered by this License. +-Section 6 states terms for distribution of such executables. +- +- When a "work that uses the Library" uses material from a header file +-that is part of the Library, the object code for the work may be a +-derivative work of the Library even though the source code is not. +-Whether this is true is especially significant if the work can be +-linked without the Library, or if the work is itself a library. The +-threshold for this to be true is not precisely defined by law. +- +- If such an object file uses only numerical parameters, data +-structure layouts and accessors, and small macros and small inline +-functions (ten lines or less in length), then the use of the object +-file is unrestricted, regardless of whether it is legally a derivative +-work. (Executables containing this object code plus portions of the +-Library will still fall under Section 6.) +- +- Otherwise, if the work is a derivative of the Library, you may +-distribute the object code for the work under the terms of Section 6. +-Any executables containing that work also fall under Section 6, +-whether or not they are linked directly with the Library itself. +- +- 6. As an exception to the Sections above, you may also combine or +-link a "work that uses the Library" with the Library to produce a +-work containing portions of the Library, and distribute that work +-under terms of your choice, provided that the terms permit +-modification of the work for the customer's own use and reverse +-engineering for debugging such modifications. +- +- You must give prominent notice with each copy of the work that the +-Library is used in it and that the Library and its use are covered by +-this License. You must supply a copy of this License. If the work +-during execution displays copyright notices, you must include the +-copyright notice for the Library among them, as well as a reference +-directing the user to the copy of this License. Also, you must do one +-of these things: +- +- a) Accompany the work with the complete corresponding +- machine-readable source code for the Library including whatever +- changes were used in the work (which must be distributed under +- Sections 1 and 2 above); and, if the work is an executable linked +- with the Library, with the complete machine-readable "work that +- uses the Library", as object code and/or source code, so that the +- user can modify the Library and then relink to produce a modified +- executable containing the modified Library. (It is understood +- that the user who changes the contents of definitions files in the +- Library will not necessarily be able to recompile the application +- to use the modified definitions.) +- +- b) Use a suitable shared library mechanism for linking with the +- Library. A suitable mechanism is one that (1) uses at run time a +- copy of the library already present on the user's computer system, +- rather than copying library functions into the executable, and (2) +- will operate properly with a modified version of the library, if +- the user installs one, as long as the modified version is +- interface-compatible with the version that the work was made with. +- +- c) Accompany the work with a written offer, valid for at +- least three years, to give the same user the materials +- specified in Subsection 6a, above, for a charge no more +- than the cost of performing this distribution. +- +- d) If distribution of the work is made by offering access to copy +- from a designated place, offer equivalent access to copy the above +- specified materials from the same place. +- +- e) Verify that the user has already received a copy of these +- materials or that you have already sent this user a copy. +- +- For an executable, the required form of the "work that uses the +-Library" must include any data and utility programs needed for +-reproducing the executable from it. However, as a special exception, +-the materials to be distributed need not include anything that is +-normally distributed (in either source or binary form) with the major +-components (compiler, kernel, and so on) of the operating system on +-which the executable runs, unless that component itself accompanies +-the executable. +- +- It may happen that this requirement contradicts the license +-restrictions of other proprietary libraries that do not normally +-accompany the operating system. Such a contradiction means you cannot +-use both them and the Library together in an executable that you +-distribute. +- +- 7. You may place library facilities that are a work based on the +-Library side-by-side in a single library together with other library +-facilities not covered by this License, and distribute such a combined +-library, provided that the separate distribution of the work based on +-the Library and of the other library facilities is otherwise +-permitted, and provided that you do these two things: +- +- a) Accompany the combined library with a copy of the same work +- based on the Library, uncombined with any other library +- facilities. This must be distributed under the terms of the +- Sections above. +- +- b) Give prominent notice with the combined library of the fact +- that part of it is a work based on the Library, and explaining +- where to find the accompanying uncombined form of the same work. +- +- 8. You may not copy, modify, sublicense, link with, or distribute +-the Library except as expressly provided under this License. Any +-attempt otherwise to copy, modify, sublicense, link with, or +-distribute the Library is void, and will automatically terminate your +-rights under this License. However, parties who have received copies, +-or rights, from you under this License will not have their licenses +-terminated so long as such parties remain in full compliance. +- +- 9. You are not required to accept this License, since you have not +-signed it. However, nothing else grants you permission to modify or +-distribute the Library or its derivative works. These actions are +-prohibited by law if you do not accept this License. Therefore, by +-modifying or distributing the Library (or any work based on the +-Library), you indicate your acceptance of this License to do so, and +-all its terms and conditions for copying, distributing or modifying +-the Library or works based on it. +- +- 10. Each time you redistribute the Library (or any work based on the +-Library), the recipient automatically receives a license from the +-original licensor to copy, distribute, link with or modify the Library +-subject to these terms and conditions. You may not impose any further +-restrictions on the recipients' exercise of the rights granted herein. +-You are not responsible for enforcing compliance by third parties with +-this License. +- +- 11. If, as a consequence of a court judgment or allegation of patent +-infringement or for any other reason (not limited to patent issues), +-conditions are imposed on you (whether by court order, agreement or +-otherwise) that contradict the conditions of this License, they do not +-excuse you from the conditions of this License. If you cannot +-distribute so as to satisfy simultaneously your obligations under this +-License and any other pertinent obligations, then as a consequence you +-may not distribute the Library at all. For example, if a patent +-license would not permit royalty-free redistribution of the Library by +-all those who receive copies directly or indirectly through you, then +-the only way you could satisfy both it and this License would be to +-refrain entirely from distribution of the Library. +- +-If any portion of this section is held invalid or unenforceable under any +-particular circumstance, the balance of the section is intended to apply, +-and the section as a whole is intended to apply in other circumstances. +- +-It is not the purpose of this section to induce you to infringe any +-patents or other property right claims or to contest validity of any +-such claims; this section has the sole purpose of protecting the +-integrity of the free software distribution system which is +-implemented by public license practices. Many people have made +-generous contributions to the wide range of software distributed +-through that system in reliance on consistent application of that +-system; it is up to the author/donor to decide if he or she is willing +-to distribute software through any other system and a licensee cannot +-impose that choice. +- +-This section is intended to make thoroughly clear what is believed to +-be a consequence of the rest of this License. +- +- 12. If the distribution and/or use of the Library is restricted in +-certain countries either by patents or by copyrighted interfaces, the +-original copyright holder who places the Library under this License may add +-an explicit geographical distribution limitation excluding those countries, +-so that distribution is permitted only in or among countries not thus +-excluded. In such case, this License incorporates the limitation as if +-written in the body of this License. +- +- 13. The Free Software Foundation may publish revised and/or new +-versions of the Lesser General Public License from time to time. +-Such new versions will be similar in spirit to the present version, +-but may differ in detail to address new problems or concerns. +- +-Each version is given a distinguishing version number. If the Library +-specifies a version number of this License which applies to it and +-"any later version", you have the option of following the terms and +-conditions either of that version or of any later version published by +-the Free Software Foundation. If the Library does not specify a +-license version number, you may choose any version ever published by +-the Free Software Foundation. +- +- 14. If you wish to incorporate parts of the Library into other free +-programs whose distribution conditions are incompatible with these, +-write to the author to ask for permission. For software which is +-copyrighted by the Free Software Foundation, write to the Free +-Software Foundation; we sometimes make exceptions for this. Our +-decision will be guided by the two goals of preserving the free status +-of all derivatives of our free software and of promoting the sharing +-and reuse of software generally. +- +- NO WARRANTY +- +- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +- +- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +-DAMAGES. +- +- END OF TERMS AND CONDITIONS +- +- How to Apply These Terms to Your New Libraries +- +- If you develop a new library, and you want it to be of the greatest +-possible use to the public, we recommend making it free software that +-everyone can redistribute and change. You can do so by permitting +-redistribution under these terms (or, alternatively, under the terms of the +-ordinary General Public License). +- +- To apply these terms, attach the following notices to the library. It is +-safest to attach them to the start of each source file to most effectively +-convey the exclusion of warranty; and each file should have at least the +-"copyright" line and a pointer to where the full notice is found. +- +- +- Copyright (C) +- +- This library is free software; you can redistribute it and/or +- modify it under the terms of the GNU Lesser General Public +- License as published by the Free Software Foundation; either +- version 2 of the License, or (at your option) any later version. +- +- This library is distributed in the hope that it will be useful, +- but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- Lesser General Public License for more details. +- +- You should have received a copy of the GNU Lesser General Public +- License along with this library; if not, write to the Free Software +- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- +-Also add information on how to contact you by electronic and paper mail. +- +-You should also get your employer (if you work as a programmer) or your +-school, if any, to sign a "copyright disclaimer" for the library, if +-necessary. Here is a sample; alter the names: +- +- Yoyodyne, Inc., hereby disclaims all copyright interest in the +- library `Frob' (a library for tweaking knobs) written by James Random Hacker. +- +- , 1 April 1990 +- Ty Coon, President of Vice +- +-That's all there is to it! +- +- +diff -Nur bochs-2.0.2+20030829.old/plex86/Makefile.in bochs-2.0.2+20030829/plex86/Makefile.in +--- bochs-2.0.2+20030829.old/plex86/Makefile.in 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +@@ -1,46 +0,0 @@ +-# plex86: run multiple x86 operating systems concurrently +-# Copyright (C) 1999-2000 Kevin P. Lawton +-# +-# This library is free software; you can redistribute it and/or +-# modify it under the terms of the GNU Lesser General Public +-# License as published by the Free Software Foundation; either +-# version 2 of the License, or (at your option) any later version. +-# +-# This library is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-# Lesser General Public License for more details. +-# +-# You should have received a copy of the GNU Lesser General Public +-# License along with this library; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- +-.PHONY: all clean dist-clean +- +- +-# Get variables from shell, or override if specified to make +-CC = @CC@ +-CFLAGS = @CFLAGS@ +-LDFLAGS = @LDFLAGS@ +- +-srcdir = @srcdir@ +-VPATH = @srcdir@ +- +-MDEFINES = CC="$(CC)" CFLAGS="$(CFLAGS)" \ +- LDFLAGS="$(LDFLAGS)" +- +-all: +- $(MAKE) -C kernel $(MDEFINES) +- +- +-clean: +- $(MAKE) -C kernel clean +- +-dist-clean: +- $(MAKE) -C kernel dist-clean +- /bin/rm -f config.status config.cache config.log +- /bin/rm -f Makefile config.h +- +-Makefile: Makefile.in config.status +- CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) config.status +- +diff -Nur bochs-2.0.2+20030829.old/plex86/PERFORMANCE bochs-2.0.2+20030829/plex86/PERFORMANCE +--- bochs-2.0.2+20030829.old/plex86/PERFORMANCE 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/PERFORMANCE 1970-01-01 00:00:00.000000000 +0000 +@@ -1,17 +0,0 @@ +-PERFORMANCE +-=========== +- +-Optimize functions in util-nexus.c: mon_memzero, mon_memcpy, mon_memset +- They could be done a lot more efficiently. +- Perhaps make mon_memzero function specifically for pages. +- +-Pseudo devices and special guest-OS specific device drivers for +- disk/network/video/etc and an associated architecture. This would +- let us pass data more quickly and prevent a lot of emulation overhead. +- The real device emulation could plug into the same architecture as +- the pseudo devices. +- +- +-Fix extra CR3 reload in nexus.S +- +-Alignment of routines in mon-fault.c +diff -Nur bochs-2.0.2+20030829.old/plex86/TODO bochs-2.0.2+20030829/plex86/TODO +--- bochs-2.0.2+20030829.old/plex86/TODO 2003-01-09 04:02:30.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/TODO 1970-01-01 00:00:00.000000000 +0000 +@@ -1,80 +0,0 @@ +-Main monitor loop should compare cycles burned thus far vs +- cycles requested, so it doesn't keep bopping back and forth +- between host-kernel and monitor spaces without returning to +- user space. +- +-Fix monPrint and friends. +-monpanic breaks up into 2 monprints which hit user space twice. +- +-Could put the GDT/LDT in linear memory where the guest +- expects them. +- +-Synchronize page writes with iCache in bochs. +- +-Deal with cycle counts of guest execution in VM, and in +- bochs/plex86 shim. +- +-Deal with page_usage. How do we update this between timeslices? +- Do we always clear it? Maybe we should keep a log of things to +- clear (page_usage, GDT entries, PDE entries, ...) and clear those +- before returning to user space. +- +-GDT entries for guest need to be cleared upon return from guest +- execution, or just cleared before invocation of the guest. +- +-Task segment must be a 32-bit'er. +- +-Save/restore floating point state of host/VM. +- +-deduct off some cycles for the IRET/int sequence. +- +-Conditions for bochs compile using plex86: +- - Not compiled for debug +- - x86 host +- - Not PCI supported (for now). +- +-paging-mon.c: We can eliminate any code other than CPL==3. +- +-Fix extra PDBR reload in nexus.S +- +-Manipulation/reading of host page tables needs to be SMP/preempt +- compatible. Need to do spin-lock (big kernel lock for old Linux) +- on vma. +- +-==================== From previous plex86 TODO file ==================== +- +- This is a list of the major tasks/achievements/milestones yet to-do. +- We should keep this list prioritized, creating sort of a road map. +- Hopefully, this will reduce duplicate suggestions on the developers +- channels, and let people know where we are in the development process. +- Entries listed first have highest priority. +- +- +- - Fix plex86 on Linux 2.4.x/SMP or with 1P and LAPIC enabled. +- +- - Save FPU state on host <--> monitor context switch. +- +- - Special guest-specific drivers and special emulated pseudo-devices +- for faster graphics/network/disk access. +- +- - Allow some of the inactive guest pages be host swappable. +- Currently, all pages are locked down. +- +- - Many performance enhancements (see PERFORMANCE) +- +- - Allow memory to be mapped anywhere in the physical address +- space. +- +- - Allow certain guest pages to be swap eligible by the host. +- This means they will have to be unavailable by the guest +- during that time. Need a dynamic algorith for this. +- +- - Test on 2.4 with SMP/APIC enabled on single processor machine. +- +- - Deal with guest use of TF. +- +- - Deal with LDT +- +- +-unallocVmPages/unreserve_guest_pages called twice, +- release & teardown. +diff -Nur bochs-2.0.2+20030829.old/plex86/bochs-plex86-notes bochs-2.0.2+20030829/plex86/bochs-plex86-notes +--- bochs-2.0.2+20030829.old/plex86/bochs-plex86-notes 1970-01-01 00:00:00.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/bochs-plex86-notes 2003-08-29 14:31:40.000000000 +0000 +@@ -0,0 +1,30 @@ ++ ++ ++ To get Bochs using a Plex86 backend, you'll have to: ++ ++ - build bochs with --enable-plex86 ++ - build plex86 [1] ++ - use [plex86]/misc/load_module to insert the plex86 kernel module ++ and setup the plex86 device (/dev/plex86) ++ - run bochs ++ ++[1] http://savannah.nongnu.org/projects/plex86 ++ ++ Some notes from Kevin: ++ ++ Likely, bochs+plex86 will panic on OSes other than the one I tried ++ due to a matrix of CR0/CR4/EFLAGS values which we can support over ++ time. I have things duct-taped together to demo this. Please stick ++ to just this test, or else your machine will likely erupt into ++ flames. ++ ++ Don't run this on a machine with important data!!! It's experimental ++ Need I say more? ++ ++ The new plex86 VM is user-level only. It will only kick in when ++ Pragma mounts the filesystem embedded in the floppy image. ++ ++ I'd like to get confirmation that of performance on your native ++ machine vs the bochs+plex86VM for that a.out test. ++ ++ -Kevin +diff -Nur bochs-2.0.2+20030829.old/plex86/config.h.in bochs-2.0.2+20030829/plex86/config.h.in +--- bochs-2.0.2+20030829.old/plex86/config.h.in 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/config.h.in 1970-01-01 00:00:00.000000000 +0000 +@@ -1,63 +0,0 @@ +-/* our plex86 compile time configuration options will go here */ +- +-#ifndef _CONFIG_H_ +-#define _CONFIG_H_ +- +-#define VERSION "Plex86 2002/07/11" +-#define BUGSMAIL "plex86-devel@mail.freesoftware.fsf.org" +- +-/* Might need these for some host OS. */ +-#define SIZEOF_UNSIGNED_CHAR 0 +-#define SIZEOF_UNSIGNED_SHORT 0 +-#define SIZEOF_UNSIGNED_INT 0 +-#define SIZEOF_UNSIGNED_LONG 0 +-#define SIZEOF_UNSIGNED_LONG_LONG 0 +- +-#if SIZEOF_UNSIGNED_CHAR != 1 +-# error "sizeof (unsigned char) != 1" +-#else +- typedef unsigned char Bit8u; +- typedef signed char Bit8s; +-#endif +- +-#if SIZEOF_UNSIGNED_SHORT != 2 +-# error "sizeof (unsigned short) != 2" +-#else +- typedef unsigned short Bit16u; +- typedef signed short Bit16s; +-#endif +- +-#if SIZEOF_UNSIGNED_INT == 4 +- typedef unsigned int Bit32u; +- typedef signed int Bit32s; +-#elif SIZEOF_UNSIGNED_LONG == 4 +- typedef unsigned long Bit32u; +- typedef signed long Bit32s; +-#else +-# error "can't find sizeof(type) of 4 bytes!" +-#endif +- +-#if SIZEOF_UNSIGNED_LONG == 8 +- typedef unsigned long Bit64u; +- typedef signed long Bit64s; +-#elif SIZEOF_UNSIGNED_LONG_LONG == 8 +- typedef unsigned long long Bit64u; +- typedef signed long long Bit64s; +-#else +-# error "can't find data type of 8 bytes" +-#endif +- +-typedef unsigned int Boolean; +- +-/* +- * NetBSD just has off_t, which is 64 bits, not loff_t. +- */ +-#ifdef __NetBSD__ +-typedef unsigned long long loff_t; +-#endif +- +- +-/* Some plex86 customization options. */ +-#define ANAL_CHECKS 1 +- +-#endif /* _CONFIG_H_ */ +diff -Nur bochs-2.0.2+20030829.old/plex86/configure bochs-2.0.2+20030829/plex86/configure +--- bochs-2.0.2+20030829.old/plex86/configure 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/configure 1970-01-01 00:00:00.000000000 +0000 +@@ -1,2535 +0,0 @@ +-#! /bin/sh +- +-# Guess values for system-dependent variables and create Makefiles. +-# Generated automatically using autoconf version 2.13 +-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +-# +-# This configure script is free software; the Free Software Foundation +-# gives unlimited permission to copy, distribute and modify it. +- +-# Defaults: +-ac_help= +-ac_default_prefix=/usr/local +-# Any additions from configure.in: +-ac_help="$ac_help +- --with-x use the X Window System" +-ac_help="$ac_help +- --with-WinNT WinNT host" +-ac_help="$ac_help +- --with-BeOS BeOS host" +-ac_help="$ac_help +- --with-Linux Linux host" +-ac_help="$ac_help +- --with-NetBSD NetBSD host" +-ac_help="$ac_help +- --with-FreeBSD FreeBSD host" +-ac_help="$ac_help +- --with-null No real host" +-ac_help="$ac_help +- --with-linux-source=dir Linux kernel source dir" +-ac_help="$ac_help +- --with-netbsd-source=dir NetBSD kernel source dir" +-ac_help="$ac_help +- --with-freebsd-source=dir FreeBSD kernel source dir" +- +-# Initialize some variables set by options. +-# The variables have the same names as the options, with +-# dashes changed to underlines. +-build=NONE +-cache_file=./config.cache +-exec_prefix=NONE +-host=NONE +-no_create= +-nonopt=NONE +-no_recursion= +-prefix=NONE +-program_prefix=NONE +-program_suffix=NONE +-program_transform_name=s,x,x, +-silent= +-site= +-srcdir= +-target=NONE +-verbose= +-x_includes=NONE +-x_libraries=NONE +-bindir='${exec_prefix}/bin' +-sbindir='${exec_prefix}/sbin' +-libexecdir='${exec_prefix}/libexec' +-datadir='${prefix}/share' +-sysconfdir='${prefix}/etc' +-sharedstatedir='${prefix}/com' +-localstatedir='${prefix}/var' +-libdir='${exec_prefix}/lib' +-includedir='${prefix}/include' +-oldincludedir='/usr/include' +-infodir='${prefix}/info' +-mandir='${prefix}/man' +- +-# Initialize some other variables. +-subdirs= +-MFLAGS= MAKEFLAGS= +-SHELL=${CONFIG_SHELL-/bin/sh} +-# Maximum number of lines to put in a shell here document. +-ac_max_here_lines=12 +- +-ac_prev= +-for ac_option +-do +- +- # If the previous option needs an argument, assign it. +- if test -n "$ac_prev"; then +- eval "$ac_prev=\$ac_option" +- ac_prev= +- continue +- fi +- +- case "$ac_option" in +- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; +- *) ac_optarg= ;; +- esac +- +- # Accept the important Cygnus configure options, so we can diagnose typos. +- +- case "$ac_option" in +- +- -bindir | --bindir | --bindi | --bind | --bin | --bi) +- ac_prev=bindir ;; +- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) +- bindir="$ac_optarg" ;; +- +- -build | --build | --buil | --bui | --bu) +- ac_prev=build ;; +- -build=* | --build=* | --buil=* | --bui=* | --bu=*) +- build="$ac_optarg" ;; +- +- -cache-file | --cache-file | --cache-fil | --cache-fi \ +- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) +- ac_prev=cache_file ;; +- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ +- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) +- cache_file="$ac_optarg" ;; +- +- -datadir | --datadir | --datadi | --datad | --data | --dat | --da) +- ac_prev=datadir ;; +- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ +- | --da=*) +- datadir="$ac_optarg" ;; +- +- -disable-* | --disable-*) +- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` +- # Reject names that are not valid shell variable names. +- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then +- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } +- fi +- ac_feature=`echo $ac_feature| sed 's/-/_/g'` +- eval "enable_${ac_feature}=no" ;; +- +- -enable-* | --enable-*) +- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` +- # Reject names that are not valid shell variable names. +- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then +- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } +- fi +- ac_feature=`echo $ac_feature| sed 's/-/_/g'` +- case "$ac_option" in +- *=*) ;; +- *) ac_optarg=yes ;; +- esac +- eval "enable_${ac_feature}='$ac_optarg'" ;; +- +- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ +- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ +- | --exec | --exe | --ex) +- ac_prev=exec_prefix ;; +- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ +- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ +- | --exec=* | --exe=* | --ex=*) +- exec_prefix="$ac_optarg" ;; +- +- -gas | --gas | --ga | --g) +- # Obsolete; use --with-gas. +- with_gas=yes ;; +- +- -help | --help | --hel | --he) +- # Omit some internal or obsolete options to make the list less imposing. +- # This message is too long to be a string in the A/UX 3.1 sh. +- cat << EOF +-Usage: configure [options] [host] +-Options: [defaults in brackets after descriptions] +-Configuration: +- --cache-file=FILE cache test results in FILE +- --help print this message +- --no-create do not create output files +- --quiet, --silent do not print \`checking...' messages +- --version print the version of autoconf that created configure +-Directory and file names: +- --prefix=PREFIX install architecture-independent files in PREFIX +- [$ac_default_prefix] +- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX +- [same as prefix] +- --bindir=DIR user executables in DIR [EPREFIX/bin] +- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] +- --libexecdir=DIR program executables in DIR [EPREFIX/libexec] +- --datadir=DIR read-only architecture-independent data in DIR +- [PREFIX/share] +- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] +- --sharedstatedir=DIR modifiable architecture-independent data in DIR +- [PREFIX/com] +- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] +- --libdir=DIR object code libraries in DIR [EPREFIX/lib] +- --includedir=DIR C header files in DIR [PREFIX/include] +- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] +- --infodir=DIR info documentation in DIR [PREFIX/info] +- --mandir=DIR man documentation in DIR [PREFIX/man] +- --srcdir=DIR find the sources in DIR [configure dir or ..] +- --program-prefix=PREFIX prepend PREFIX to installed program names +- --program-suffix=SUFFIX append SUFFIX to installed program names +- --program-transform-name=PROGRAM +- run sed PROGRAM on installed program names +-EOF +- cat << EOF +-Host type: +- --build=BUILD configure for building on BUILD [BUILD=HOST] +- --host=HOST configure for HOST [guessed] +- --target=TARGET configure for TARGET [TARGET=HOST] +-Features and packages: +- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) +- --enable-FEATURE[=ARG] include FEATURE [ARG=yes] +- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] +- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) +- --x-includes=DIR X include files are in DIR +- --x-libraries=DIR X library files are in DIR +-EOF +- if test -n "$ac_help"; then +- echo "--enable and --with options recognized:$ac_help" +- fi +- exit 0 ;; +- +- -host | --host | --hos | --ho) +- ac_prev=host ;; +- -host=* | --host=* | --hos=* | --ho=*) +- host="$ac_optarg" ;; +- +- -includedir | --includedir | --includedi | --included | --include \ +- | --includ | --inclu | --incl | --inc) +- ac_prev=includedir ;; +- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ +- | --includ=* | --inclu=* | --incl=* | --inc=*) +- includedir="$ac_optarg" ;; +- +- -infodir | --infodir | --infodi | --infod | --info | --inf) +- ac_prev=infodir ;; +- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) +- infodir="$ac_optarg" ;; +- +- -libdir | --libdir | --libdi | --libd) +- ac_prev=libdir ;; +- -libdir=* | --libdir=* | --libdi=* | --libd=*) +- libdir="$ac_optarg" ;; +- +- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ +- | --libexe | --libex | --libe) +- ac_prev=libexecdir ;; +- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ +- | --libexe=* | --libex=* | --libe=*) +- libexecdir="$ac_optarg" ;; +- +- -localstatedir | --localstatedir | --localstatedi | --localstated \ +- | --localstate | --localstat | --localsta | --localst \ +- | --locals | --local | --loca | --loc | --lo) +- ac_prev=localstatedir ;; +- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ +- | --localstate=* | --localstat=* | --localsta=* | --localst=* \ +- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) +- localstatedir="$ac_optarg" ;; +- +- -mandir | --mandir | --mandi | --mand | --man | --ma | --m) +- ac_prev=mandir ;; +- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) +- mandir="$ac_optarg" ;; +- +- -nfp | --nfp | --nf) +- # Obsolete; use --without-fp. +- with_fp=no ;; +- +- -no-create | --no-create | --no-creat | --no-crea | --no-cre \ +- | --no-cr | --no-c) +- no_create=yes ;; +- +- -no-recursion | --no-recursion | --no-recursio | --no-recursi \ +- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) +- no_recursion=yes ;; +- +- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ +- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ +- | --oldin | --oldi | --old | --ol | --o) +- ac_prev=oldincludedir ;; +- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ +- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ +- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) +- oldincludedir="$ac_optarg" ;; +- +- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) +- ac_prev=prefix ;; +- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) +- prefix="$ac_optarg" ;; +- +- -program-prefix | --program-prefix | --program-prefi | --program-pref \ +- | --program-pre | --program-pr | --program-p) +- ac_prev=program_prefix ;; +- -program-prefix=* | --program-prefix=* | --program-prefi=* \ +- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) +- program_prefix="$ac_optarg" ;; +- +- -program-suffix | --program-suffix | --program-suffi | --program-suff \ +- | --program-suf | --program-su | --program-s) +- ac_prev=program_suffix ;; +- -program-suffix=* | --program-suffix=* | --program-suffi=* \ +- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) +- program_suffix="$ac_optarg" ;; +- +- -program-transform-name | --program-transform-name \ +- | --program-transform-nam | --program-transform-na \ +- | --program-transform-n | --program-transform- \ +- | --program-transform | --program-transfor \ +- | --program-transfo | --program-transf \ +- | --program-trans | --program-tran \ +- | --progr-tra | --program-tr | --program-t) +- ac_prev=program_transform_name ;; +- -program-transform-name=* | --program-transform-name=* \ +- | --program-transform-nam=* | --program-transform-na=* \ +- | --program-transform-n=* | --program-transform-=* \ +- | --program-transform=* | --program-transfor=* \ +- | --program-transfo=* | --program-transf=* \ +- | --program-trans=* | --program-tran=* \ +- | --progr-tra=* | --program-tr=* | --program-t=*) +- program_transform_name="$ac_optarg" ;; +- +- -q | -quiet | --quiet | --quie | --qui | --qu | --q \ +- | -silent | --silent | --silen | --sile | --sil) +- silent=yes ;; +- +- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) +- ac_prev=sbindir ;; +- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ +- | --sbi=* | --sb=*) +- sbindir="$ac_optarg" ;; +- +- -sharedstatedir | --sharedstatedir | --sharedstatedi \ +- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ +- | --sharedst | --shareds | --shared | --share | --shar \ +- | --sha | --sh) +- ac_prev=sharedstatedir ;; +- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ +- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ +- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ +- | --sha=* | --sh=*) +- sharedstatedir="$ac_optarg" ;; +- +- -site | --site | --sit) +- ac_prev=site ;; +- -site=* | --site=* | --sit=*) +- site="$ac_optarg" ;; +- +- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) +- ac_prev=srcdir ;; +- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) +- srcdir="$ac_optarg" ;; +- +- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ +- | --syscon | --sysco | --sysc | --sys | --sy) +- ac_prev=sysconfdir ;; +- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ +- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) +- sysconfdir="$ac_optarg" ;; +- +- -target | --target | --targe | --targ | --tar | --ta | --t) +- ac_prev=target ;; +- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) +- target="$ac_optarg" ;; +- +- -v | -verbose | --verbose | --verbos | --verbo | --verb) +- verbose=yes ;; +- +- -version | --version | --versio | --versi | --vers) +- echo "configure generated by autoconf version 2.13" +- exit 0 ;; +- +- -with-* | --with-*) +- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` +- # Reject names that are not valid shell variable names. +- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then +- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } +- fi +- ac_package=`echo $ac_package| sed 's/-/_/g'` +- case "$ac_option" in +- *=*) ;; +- *) ac_optarg=yes ;; +- esac +- eval "with_${ac_package}='$ac_optarg'" ;; +- +- -without-* | --without-*) +- ac_package=`echo $ac_option|sed -e 's/-*without-//'` +- # Reject names that are not valid shell variable names. +- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then +- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } +- fi +- ac_package=`echo $ac_package| sed 's/-/_/g'` +- eval "with_${ac_package}=no" ;; +- +- --x) +- # Obsolete; use --with-x. +- with_x=yes ;; +- +- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ +- | --x-incl | --x-inc | --x-in | --x-i) +- ac_prev=x_includes ;; +- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ +- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) +- x_includes="$ac_optarg" ;; +- +- -x-libraries | --x-libraries | --x-librarie | --x-librari \ +- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) +- ac_prev=x_libraries ;; +- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ +- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) +- x_libraries="$ac_optarg" ;; +- +- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } +- ;; +- +- *) +- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then +- echo "configure: warning: $ac_option: invalid host type" 1>&2 +- fi +- if test "x$nonopt" != xNONE; then +- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } +- fi +- nonopt="$ac_option" +- ;; +- +- esac +-done +- +-if test -n "$ac_prev"; then +- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +-fi +- +-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 +- +-# File descriptor usage: +-# 0 standard input +-# 1 file creation +-# 2 errors and warnings +-# 3 some systems may open it to /dev/tty +-# 4 used on the Kubota Titan +-# 6 checking for... messages and results +-# 5 compiler messages saved in config.log +-if test "$silent" = yes; then +- exec 6>/dev/null +-else +- exec 6>&1 +-fi +-exec 5>./config.log +- +-echo "\ +-This file contains any messages produced by compilers while +-running configure, to aid debugging if configure makes a mistake. +-" 1>&5 +- +-# Strip out --no-create and --no-recursion so they do not pile up. +-# Also quote any args containing shell metacharacters. +-ac_configure_args= +-for ac_arg +-do +- case "$ac_arg" in +- -no-create | --no-create | --no-creat | --no-crea | --no-cre \ +- | --no-cr | --no-c) ;; +- -no-recursion | --no-recursion | --no-recursio | --no-recursi \ +- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; +- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) +- ac_configure_args="$ac_configure_args '$ac_arg'" ;; +- *) ac_configure_args="$ac_configure_args $ac_arg" ;; +- esac +-done +- +-# NLS nuisances. +-# Only set these to C if already set. These must not be set unconditionally +-# because not all systems understand e.g. LANG=C (notably SCO). +-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +-# Non-C LC_CTYPE values break the ctype check. +-if test "${LANG+set}" = set; then LANG=C; export LANG; fi +-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +- +-# confdefs.h avoids OS command line length limits that DEFS can exceed. +-rm -rf conftest* confdefs.h +-# AIX cpp loses on an empty file, so make sure it contains at least a newline. +-echo > confdefs.h +- +-# A filename unique to this package, relative to the directory that +-# configure is in, which we can look for to find out if srcdir is correct. +-ac_unique_file=COPYING +- +-# Find the source files, if location was not specified. +-if test -z "$srcdir"; then +- ac_srcdir_defaulted=yes +- # Try the directory containing this script, then its parent. +- ac_prog=$0 +- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` +- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. +- srcdir=$ac_confdir +- if test ! -r $srcdir/$ac_unique_file; then +- srcdir=.. +- fi +-else +- ac_srcdir_defaulted=no +-fi +-if test ! -r $srcdir/$ac_unique_file; then +- if test "$ac_srcdir_defaulted" = yes; then +- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } +- else +- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } +- fi +-fi +-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +- +-# Prefer explicitly selected file to automatically selected ones. +-if test -z "$CONFIG_SITE"; then +- if test "x$prefix" != xNONE; then +- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" +- else +- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +- fi +-fi +-for ac_site_file in $CONFIG_SITE; do +- if test -r "$ac_site_file"; then +- echo "loading site script $ac_site_file" +- . "$ac_site_file" +- fi +-done +- +-if test -r "$cache_file"; then +- echo "loading cache $cache_file" +- . $cache_file +-else +- echo "creating cache $cache_file" +- > $cache_file +-fi +- +-ac_ext=c +-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +-cross_compiling=$ac_cv_prog_cc_cross +- +-ac_exeext= +-ac_objext=o +-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then +- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. +- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then +- ac_n= ac_c=' +-' ac_t=' ' +- else +- ac_n=-n ac_c= ac_t= +- fi +-else +- ac_n= ac_c='\c' ac_t= +-fi +- +- +- +- +- +- +- +-# Extract the first word of "gcc", so it can be a program name with args. +-set dummy gcc; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:553: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test -n "$CC"; then +- ac_cv_prog_CC="$CC" # Let the user override the test. +-else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_CC="gcc" +- break +- fi +- done +- IFS="$ac_save_ifs" +-fi +-fi +-CC="$ac_cv_prog_CC" +-if test -n "$CC"; then +- echo "$ac_t""$CC" 1>&6 +-else +- echo "$ac_t""no" 1>&6 +-fi +- +-if test -z "$CC"; then +- # Extract the first word of "cc", so it can be a program name with args. +-set dummy cc; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:583: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test -n "$CC"; then +- ac_cv_prog_CC="$CC" # Let the user override the test. +-else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_prog_rejected=no +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then +- ac_prog_rejected=yes +- continue +- fi +- ac_cv_prog_CC="cc" +- break +- fi +- done +- IFS="$ac_save_ifs" +-if test $ac_prog_rejected = yes; then +- # We found a bogon in the path, so make sure we never use it. +- set dummy $ac_cv_prog_CC +- shift +- if test $# -gt 0; then +- # We chose a different compiler from the bogus one. +- # However, it has the same basename, so the bogon will be chosen +- # first if we set CC to just the basename; use the full file name. +- shift +- set dummy "$ac_dir/$ac_word" "$@" +- shift +- ac_cv_prog_CC="$@" +- fi +-fi +-fi +-fi +-CC="$ac_cv_prog_CC" +-if test -n "$CC"; then +- echo "$ac_t""$CC" 1>&6 +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- if test -z "$CC"; then +- case "`uname -s`" in +- *win32* | *WIN32*) +- # Extract the first word of "cl", so it can be a program name with args. +-set dummy cl; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:634: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test -n "$CC"; then +- ac_cv_prog_CC="$CC" # Let the user override the test. +-else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_CC="cl" +- break +- fi +- done +- IFS="$ac_save_ifs" +-fi +-fi +-CC="$ac_cv_prog_CC" +-if test -n "$CC"; then +- echo "$ac_t""$CC" 1>&6 +-else +- echo "$ac_t""no" 1>&6 +-fi +- ;; +- esac +- fi +- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +-fi +- +-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +-echo "configure:666: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +- +-ac_ext=c +-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +-cross_compiling=$ac_cv_prog_cc_cross +- +-cat > conftest.$ac_ext << EOF +- +-#line 677 "configure" +-#include "confdefs.h" +- +-main(){return(0);} +-EOF +-if { (eval echo configure:682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- ac_cv_prog_cc_works=yes +- # If we can't run a trivial program, we are probably using a cross compiler. +- if (./conftest; exit) 2>/dev/null; then +- ac_cv_prog_cc_cross=no +- else +- ac_cv_prog_cc_cross=yes +- fi +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- ac_cv_prog_cc_works=no +-fi +-rm -fr conftest* +-ac_ext=c +-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +-ac_cpp='$CPP $CPPFLAGS' +-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +-cross_compiling=$ac_cv_prog_cc_cross +- +-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +-if test $ac_cv_prog_cc_works = no; then +- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +-fi +-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +-echo "configure:708: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +-cross_compiling=$ac_cv_prog_cc_cross +- +-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +-echo "configure:713: checking whether we are using GNU C" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +- ac_cv_prog_gcc=yes +-else +- ac_cv_prog_gcc=no +-fi +-fi +- +-echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +- +-if test $ac_cv_prog_gcc = yes; then +- GCC=yes +-else +- GCC= +-fi +- +-ac_test_CFLAGS="${CFLAGS+set}" +-ac_save_CFLAGS="$CFLAGS" +-CFLAGS= +-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +-echo "configure:741: checking whether ${CC-cc} accepts -g" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- echo 'void f(){}' > conftest.c +-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then +- ac_cv_prog_cc_g=yes +-else +- ac_cv_prog_cc_g=no +-fi +-rm -f conftest* +- +-fi +- +-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +-if test "$ac_test_CFLAGS" = set; then +- CFLAGS="$ac_save_CFLAGS" +-elif test $ac_cv_prog_cc_g = yes; then +- if test "$GCC" = yes; then +- CFLAGS="-g -O2" +- else +- CFLAGS="-g" +- fi +-else +- if test "$GCC" = yes; then +- CFLAGS="-O2" +- else +- CFLAGS= +- fi +-fi +- +-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +-echo "configure:773: checking whether ${MAKE-make} sets \${MAKE}" >&5 +-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftestmake <<\EOF +-all: +- @echo 'ac_maketemp="${MAKE}"' +-EOF +-# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +-if test -n "$ac_maketemp"; then +- eval ac_cv_prog_make_${ac_make}_set=yes +-else +- eval ac_cv_prog_make_${ac_make}_set=no +-fi +-rm -f conftestmake +-fi +-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- SET_MAKE= +-else +- echo "$ac_t""no" 1>&6 +- SET_MAKE="MAKE=${MAKE-make}" +-fi +- +-# Extract the first word of "ranlib", so it can be a program name with args. +-set dummy ranlib; ac_word=$2 +-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +-echo "configure:802: checking for $ac_word" >&5 +-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test -n "$RANLIB"; then +- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +-else +- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +- ac_dummy="$PATH" +- for ac_dir in $ac_dummy; do +- test -z "$ac_dir" && ac_dir=. +- if test -f $ac_dir/$ac_word; then +- ac_cv_prog_RANLIB="ranlib" +- break +- fi +- done +- IFS="$ac_save_ifs" +- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +-fi +-fi +-RANLIB="$ac_cv_prog_RANLIB" +-if test -n "$RANLIB"; then +- echo "$ac_t""$RANLIB" 1>&6 +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- +-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +-echo "configure:831: checking how to run the C preprocessor" >&5 +-# On Suns, sometimes $CPP names a directory. +-if test -n "$CPP" && test -d "$CPP"; then +- CPP= +-fi +-if test -z "$CPP"; then +-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- # This must be in double quotes, not single quotes, because CPP may get +- # substituted into the Makefile and "${CC-cc}" will confuse make. +- CPP="${CC-cc} -E" +- # On the NeXT, cc -E runs the code through the compiler's parser, +- # not just through cpp. +- cat > conftest.$ac_ext < +-Syntax Error +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- : +-else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- CPP="${CC-cc} -E -traditional-cpp" +- cat > conftest.$ac_ext < +-Syntax Error +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:869: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- : +-else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- CPP="${CC-cc} -nologo -E" +- cat > conftest.$ac_ext < +-Syntax Error +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- : +-else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- CPP=/lib/cpp +-fi +-rm -f conftest* +-fi +-rm -f conftest* +-fi +-rm -f conftest* +- ac_cv_prog_CPP="$CPP" +-fi +- CPP="$ac_cv_prog_CPP" +-else +- ac_cv_prog_CPP="$CPP" +-fi +-echo "$ac_t""$CPP" 1>&6 +- +-# If we find X, set shell vars x_includes and x_libraries to the +-# paths, otherwise set no_x=yes. +-# Uses ac_ vars as temps to allow command line to override cache and checks. +-# --without-x overrides everything else, but does not touch the cache. +-echo $ac_n "checking for X""... $ac_c" 1>&6 +-echo "configure:915: checking for X" >&5 +- +-# Check whether --with-x or --without-x was given. +-if test "${with_x+set}" = set; then +- withval="$with_x" +- : +-fi +- +-# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +-if test "x$with_x" = xno; then +- # The user explicitly disabled X. +- have_x=disabled +-else +- if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then +- # Both variables are already set. +- have_x=yes +- else +-if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- # One or both of the vars are not set, and there is no cached value. +-ac_x_includes=NO ac_x_libraries=NO +-rm -fr conftestdir +-if mkdir conftestdir; then +- cd conftestdir +- # Make sure to not put "make" in the Imakefile rules, since we grep it out. +- cat > Imakefile <<'EOF' +-acfindx: +- @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +-EOF +- if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then +- # GNU make sometimes prints "make[1]: Entering...", which would confuse us. +- eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` +- # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. +- for ac_extension in a so sl; do +- if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && +- test -f $ac_im_libdir/libX11.$ac_extension; then +- ac_im_usrlibdir=$ac_im_libdir; break +- fi +- done +- # Screen out bogus values from the imake configuration. They are +- # bogus both because they are the default anyway, and because +- # using them would break gcc on systems where it needs fixed includes. +- case "$ac_im_incroot" in +- /usr/include) ;; +- *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; +- esac +- case "$ac_im_usrlibdir" in +- /usr/lib | /lib) ;; +- *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; +- esac +- fi +- cd .. +- rm -fr conftestdir +-fi +- +-if test "$ac_x_includes" = NO; then +- # Guess where to find include files, by looking for this one X11 .h file. +- test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h +- +- # First, try using that file with no special directory specified. +-cat > conftest.$ac_ext < +-EOF +-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +-{ (eval echo configure:982: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +-if test -z "$ac_err"; then +- rm -rf conftest* +- # We can compile using X headers with no special include directory. +-ac_x_includes= +-else +- echo "$ac_err" >&5 +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- # Look for the header file in a standard set of common directories. +-# Check X11 before X11Rn because it is often a symlink to the current release. +- for ac_dir in \ +- /usr/X11/include \ +- /usr/X11R6/include \ +- /usr/X11R5/include \ +- /usr/X11R4/include \ +- \ +- /usr/include/X11 \ +- /usr/include/X11R6 \ +- /usr/include/X11R5 \ +- /usr/include/X11R4 \ +- \ +- /usr/local/X11/include \ +- /usr/local/X11R6/include \ +- /usr/local/X11R5/include \ +- /usr/local/X11R4/include \ +- \ +- /usr/local/include/X11 \ +- /usr/local/include/X11R6 \ +- /usr/local/include/X11R5 \ +- /usr/local/include/X11R4 \ +- \ +- /usr/X386/include \ +- /usr/x386/include \ +- /usr/XFree86/include/X11 \ +- \ +- /usr/include \ +- /usr/local/include \ +- /usr/unsupported/include \ +- /usr/athena/include \ +- /usr/local/x11r5/include \ +- /usr/lpp/Xamples/include \ +- \ +- /usr/openwin/include \ +- /usr/openwin/share/include \ +- ; \ +- do +- if test -r "$ac_dir/$x_direct_test_include"; then +- ac_x_includes=$ac_dir +- break +- fi +- done +-fi +-rm -f conftest* +-fi # $ac_x_includes = NO +- +-if test "$ac_x_libraries" = NO; then +- # Check for the libraries. +- +- test -z "$x_direct_test_library" && x_direct_test_library=Xt +- test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc +- +- # See if we find them without any special options. +- # Don't add to $LIBS permanently. +- ac_save_LIBS="$LIBS" +- LIBS="-l$x_direct_test_library $LIBS" +-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- LIBS="$ac_save_LIBS" +-# We can link X programs with no special library path. +-ac_x_libraries= +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- LIBS="$ac_save_LIBS" +-# First see if replacing the include by lib works. +-# Check X11 before X11Rn because it is often a symlink to the current release. +-for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ +- /usr/X11/lib \ +- /usr/X11R6/lib \ +- /usr/X11R5/lib \ +- /usr/X11R4/lib \ +- \ +- /usr/lib/X11 \ +- /usr/lib/X11R6 \ +- /usr/lib/X11R5 \ +- /usr/lib/X11R4 \ +- \ +- /usr/local/X11/lib \ +- /usr/local/X11R6/lib \ +- /usr/local/X11R5/lib \ +- /usr/local/X11R4/lib \ +- \ +- /usr/local/lib/X11 \ +- /usr/local/lib/X11R6 \ +- /usr/local/lib/X11R5 \ +- /usr/local/lib/X11R4 \ +- \ +- /usr/X386/lib \ +- /usr/x386/lib \ +- /usr/XFree86/lib/X11 \ +- \ +- /usr/lib \ +- /usr/local/lib \ +- /usr/unsupported/lib \ +- /usr/athena/lib \ +- /usr/local/x11r5/lib \ +- /usr/lpp/Xamples/lib \ +- /lib/usr/lib/X11 \ +- \ +- /usr/openwin/lib \ +- /usr/openwin/share/lib \ +- ; \ +-do +- for ac_extension in a so sl; do +- if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then +- ac_x_libraries=$ac_dir +- break 2 +- fi +- done +-done +-fi +-rm -f conftest* +-fi # $ac_x_libraries = NO +- +-if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then +- # Didn't find X anywhere. Cache the known absence of X. +- ac_cv_have_x="have_x=no" +-else +- # Record where we found X for the cache. +- ac_cv_have_x="have_x=yes \ +- ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +-fi +-fi +- fi +- eval "$ac_cv_have_x" +-fi # $with_x != no +- +-if test "$have_x" != yes; then +- echo "$ac_t""$have_x" 1>&6 +- no_x=yes +-else +- # If each of the values was on the command line, it overrides each guess. +- test "x$x_includes" = xNONE && x_includes=$ac_x_includes +- test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries +- # Update the cache value to reflect the command line values. +- ac_cv_have_x="have_x=yes \ +- ac_x_includes=$x_includes ac_x_libraries=$x_libraries" +- echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 +-fi +- +-if test "$no_x" = yes; then +- # Not all programs may use this symbol, but it does not hurt to define it. +- cat >> confdefs.h <<\EOF +-#define X_DISPLAY_MISSING 1 +-EOF +- +- X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +-else +- if test -n "$x_includes"; then +- X_CFLAGS="$X_CFLAGS -I$x_includes" +- fi +- +- # It would also be nice to do this for all -L options, not just this one. +- if test -n "$x_libraries"; then +- X_LIBS="$X_LIBS -L$x_libraries" +- # For Solaris; some versions of Sun CC require a space after -R and +- # others require no space. Words are not sufficient . . . . +- case "`(uname -sr) 2>/dev/null`" in +- "SunOS 5"*) +- echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 +-echo "configure:1164: checking whether -R must be followed by a space" >&5 +- ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" +- cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- ac_R_nospace=yes +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- ac_R_nospace=no +-fi +-rm -f conftest* +- if test $ac_R_nospace = yes; then +- echo "$ac_t""no" 1>&6 +- X_LIBS="$X_LIBS -R$x_libraries" +- else +- LIBS="$ac_xsave_LIBS -R $x_libraries" +- cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- ac_R_space=yes +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- ac_R_space=no +-fi +-rm -f conftest* +- if test $ac_R_space = yes; then +- echo "$ac_t""yes" 1>&6 +- X_LIBS="$X_LIBS -R $x_libraries" +- else +- echo "$ac_t""neither works" 1>&6 +- fi +- fi +- LIBS="$ac_xsave_LIBS" +- esac +- fi +- +- # Check for system-dependent libraries X programs must link with. +- # Do this before checking for the system-independent R6 libraries +- # (-lICE), since we may need -lsocket or whatever for X linking. +- +- if test "$ISC" = yes; then +- X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" +- else +- # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X +- # libraries were built with DECnet support. And karl@cs.umb.edu says +- # the Alpha needs dnet_stub (dnet does not exist). +- echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 +-echo "configure:1229: checking for dnet_ntoa in -ldnet" >&5 +-ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-ldnet $LIBS" +-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- if test $ac_cv_lib_dnet_dnet_ntoa = no; then +- echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 +-echo "configure:1270: checking for dnet_ntoa in -ldnet_stub" >&5 +-ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-ldnet_stub $LIBS" +-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- fi +- +- # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, +- # to get the SysV transport functions. +- # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) +- # needs -lnsl. +- # The nsl library prevents programs from opening the X display +- # on Irix 5.2, according to dickey@clark.net. +- echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 +-echo "configure:1318: checking for gethostbyname" >&5 +-if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.$ac_ext < +-/* Override any gcc2 internal prototype to avoid an error. */ +-/* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char gethostbyname(); +- +-int main() { +- +-/* The GNU C library defines this for functions which it implements +- to always fail with ENOSYS. Some functions are actually named +- something starting with __ and the normal name is an alias. */ +-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +-choke me +-#else +-gethostbyname(); +-#endif +- +-; return 0; } +-EOF +-if { (eval echo configure:1346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_func_gethostbyname=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_func_gethostbyname=no" +-fi +-rm -f conftest* +-fi +- +-if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- : +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- if test $ac_cv_func_gethostbyname = no; then +- echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +-echo "configure:1367: checking for gethostbyname in -lnsl" >&5 +-ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-lnsl $LIBS" +-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- fi +- +- # lieder@skyler.mavd.honeywell.com says without -lsocket, +- # socket/setsockopt and other routines are undefined under SCO ODT +- # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary +- # on later versions), says simon@lia.di.epfl.ch: it contains +- # gethostby* variants that don't use the nameserver (or something). +- # -lsocket must be given before -lnsl if both are needed. +- # We assume that if connect needs -lnsl, so does gethostbyname. +- echo $ac_n "checking for connect""... $ac_c" 1>&6 +-echo "configure:1416: checking for connect" >&5 +-if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.$ac_ext < +-/* Override any gcc2 internal prototype to avoid an error. */ +-/* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char connect(); +- +-int main() { +- +-/* The GNU C library defines this for functions which it implements +- to always fail with ENOSYS. Some functions are actually named +- something starting with __ and the normal name is an alias. */ +-#if defined (__stub_connect) || defined (__stub___connect) +-choke me +-#else +-connect(); +-#endif +- +-; return 0; } +-EOF +-if { (eval echo configure:1444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_func_connect=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_func_connect=no" +-fi +-rm -f conftest* +-fi +- +-if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- : +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- if test $ac_cv_func_connect = no; then +- echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 +-echo "configure:1465: checking for connect in -lsocket" >&5 +-ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- fi +- +- # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. +- echo $ac_n "checking for remove""... $ac_c" 1>&6 +-echo "configure:1508: checking for remove" >&5 +-if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.$ac_ext < +-/* Override any gcc2 internal prototype to avoid an error. */ +-/* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char remove(); +- +-int main() { +- +-/* The GNU C library defines this for functions which it implements +- to always fail with ENOSYS. Some functions are actually named +- something starting with __ and the normal name is an alias. */ +-#if defined (__stub_remove) || defined (__stub___remove) +-choke me +-#else +-remove(); +-#endif +- +-; return 0; } +-EOF +-if { (eval echo configure:1536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_func_remove=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_func_remove=no" +-fi +-rm -f conftest* +-fi +- +-if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- : +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- if test $ac_cv_func_remove = no; then +- echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 +-echo "configure:1557: checking for remove in -lposix" >&5 +-ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-lposix $LIBS" +-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- fi +- +- # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. +- echo $ac_n "checking for shmat""... $ac_c" 1>&6 +-echo "configure:1600: checking for shmat" >&5 +-if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- cat > conftest.$ac_ext < +-/* Override any gcc2 internal prototype to avoid an error. */ +-/* We use char because int might match the return type of a gcc2 +- builtin and then its argument prototype would still apply. */ +-char shmat(); +- +-int main() { +- +-/* The GNU C library defines this for functions which it implements +- to always fail with ENOSYS. Some functions are actually named +- something starting with __ and the normal name is an alias. */ +-#if defined (__stub_shmat) || defined (__stub___shmat) +-choke me +-#else +-shmat(); +-#endif +- +-; return 0; } +-EOF +-if { (eval echo configure:1628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_func_shmat=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_func_shmat=no" +-fi +-rm -f conftest* +-fi +- +-if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- : +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- if test $ac_cv_func_shmat = no; then +- echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 +-echo "configure:1649: checking for shmat in -lipc" >&5 +-ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-lipc $LIBS" +-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- fi +- fi +- +- # Check for libraries that X11R6 Xt/Xaw programs need. +- ac_save_LDFLAGS="$LDFLAGS" +- test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" +- # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to +- # check for ICE first), but we must link in the order -lSM -lICE or +- # we get undefined symbols. So assume we have SM if we have ICE. +- # These have to be linked with before -lX11, unlike the other +- # libraries we check for below, so use a different variable. +- # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. +- echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 +-echo "configure:1701: checking for IceConnectionNumber in -lICE" >&5 +-ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` +-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_save_LIBS="$LIBS" +-LIBS="-lICE $X_EXTRA_LIBS $LIBS" +-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=yes" +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -rf conftest* +- eval "ac_cv_lib_$ac_lib_var=no" +-fi +-rm -f conftest* +-LIBS="$ac_save_LIBS" +- +-fi +-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then +- echo "$ac_t""yes" 1>&6 +- X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +-else +- echo "$ac_t""no" 1>&6 +-fi +- +- LDFLAGS="$ac_save_LDFLAGS" +- +-fi +- +- +-echo $ac_n "checking for inline""... $ac_c" 1>&6 +-echo "configure:1746: checking for inline" >&5 +-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- ac_cv_c_inline=no +-for ac_kw in inline __inline__ __inline; do +- cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +- rm -rf conftest* +- ac_cv_c_inline=$ac_kw; break +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +-fi +-rm -f conftest* +-done +- +-fi +- +-echo "$ac_t""$ac_cv_c_inline" 1>&6 +-case "$ac_cv_c_inline" in +- inline | yes) ;; +- no) cat >> confdefs.h <<\EOF +-#define inline +-EOF +- ;; +- *) cat >> confdefs.h <&6 +-echo "configure:1786: checking size of unsigned char" >&5 +-if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_char'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test "$cross_compiling" = yes; then +- ac_cv_sizeof_unsigned_char=0 +-else +- cat > conftest.$ac_ext < +-#include +-main() +-{ +- FILE *f=fopen("conftestval", "w"); +- if (!f) exit(1); +- fprintf(f, "%d\n", sizeof(unsigned char)); +- exit(0); +-} +-EOF +-if { (eval echo configure:1806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +-then +- ac_cv_sizeof_unsigned_char=`cat conftestval` +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -fr conftest* +- ac_cv_sizeof_unsigned_char=0 +-fi +-rm -fr conftest* +-fi +- +-fi +-echo "$ac_t""$ac_cv_sizeof_unsigned_char" 1>&6 +-cat >> confdefs.h <&6 +-echo "configure:1826: checking size of unsigned short" >&5 +-if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_short'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test "$cross_compiling" = yes; then +- ac_cv_sizeof_unsigned_short=0 +-else +- cat > conftest.$ac_ext < +-#include +-main() +-{ +- FILE *f=fopen("conftestval", "w"); +- if (!f) exit(1); +- fprintf(f, "%d\n", sizeof(unsigned short)); +- exit(0); +-} +-EOF +-if { (eval echo configure:1846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +-then +- ac_cv_sizeof_unsigned_short=`cat conftestval` +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -fr conftest* +- ac_cv_sizeof_unsigned_short=0 +-fi +-rm -fr conftest* +-fi +- +-fi +-echo "$ac_t""$ac_cv_sizeof_unsigned_short" 1>&6 +-cat >> confdefs.h <&6 +-echo "configure:1866: checking size of unsigned int" >&5 +-if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_int'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test "$cross_compiling" = yes; then +- ac_cv_sizeof_unsigned_int=0 +-else +- cat > conftest.$ac_ext < +-#include +-main() +-{ +- FILE *f=fopen("conftestval", "w"); +- if (!f) exit(1); +- fprintf(f, "%d\n", sizeof(unsigned int)); +- exit(0); +-} +-EOF +-if { (eval echo configure:1886: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +-then +- ac_cv_sizeof_unsigned_int=`cat conftestval` +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -fr conftest* +- ac_cv_sizeof_unsigned_int=0 +-fi +-rm -fr conftest* +-fi +- +-fi +-echo "$ac_t""$ac_cv_sizeof_unsigned_int" 1>&6 +-cat >> confdefs.h <&6 +-echo "configure:1906: checking size of unsigned long" >&5 +-if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test "$cross_compiling" = yes; then +- ac_cv_sizeof_unsigned_long=0 +-else +- cat > conftest.$ac_ext < +-#include +-main() +-{ +- FILE *f=fopen("conftestval", "w"); +- if (!f) exit(1); +- fprintf(f, "%d\n", sizeof(unsigned long)); +- exit(0); +-} +-EOF +-if { (eval echo configure:1926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +-then +- ac_cv_sizeof_unsigned_long=`cat conftestval` +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -fr conftest* +- ac_cv_sizeof_unsigned_long=0 +-fi +-rm -fr conftest* +-fi +- +-fi +-echo "$ac_t""$ac_cv_sizeof_unsigned_long" 1>&6 +-cat >> confdefs.h <&6 +-echo "configure:1946: checking size of unsigned long long" >&5 +-if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long_long'+set}'`\" = set"; then +- echo $ac_n "(cached) $ac_c" 1>&6 +-else +- if test "$cross_compiling" = yes; then +- ac_cv_sizeof_unsigned_long_long=0 +-else +- cat > conftest.$ac_ext < +-#include +-main() +-{ +- FILE *f=fopen("conftestval", "w"); +- if (!f) exit(1); +- fprintf(f, "%d\n", sizeof(unsigned long long)); +- exit(0); +-} +-EOF +-if { (eval echo configure:1966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +-then +- ac_cv_sizeof_unsigned_long_long=`cat conftestval` +-else +- echo "configure: failed program was:" >&5 +- cat conftest.$ac_ext >&5 +- rm -fr conftest* +- ac_cv_sizeof_unsigned_long_long=0 +-fi +-rm -fr conftest* +-fi +- +-fi +-echo "$ac_t""$ac_cv_sizeof_unsigned_long_long" 1>&6 +-cat >> confdefs.h < confcache <<\EOF +-# This file is a shell script that caches the results of configure +-# tests run on this system so they can be shared between configure +-# scripts and configure runs. It is not useful on other systems. +-# If it contains results you don't want to keep, you may remove or edit it. +-# +-# By default, configure uses ./config.cache as the cache file, +-# creating it if it does not exist already. You can give configure +-# the --cache-file=FILE option to use a different cache file; that is +-# what configure does when it calls configure scripts in +-# subdirectories, so they share the cache. +-# Giving --cache-file=/dev/null disables caching, for debugging configure. +-# config.status only pays attention to the cache file if you give it the +-# --recheck option to rerun configure. +-# +-EOF +-# The following way of writing the cache mishandles newlines in values, +-# but we know of no workaround that is simple, portable, and efficient. +-# So, don't put newlines in cache variables' values. +-# Ultrix sh set writes to stderr and can't be redirected directly, +-# and sets the high bit in the cache file unless we assign to the vars. +-(set) 2>&1 | +- case `(ac_space=' '; set | grep ac_space) 2>&1` in +- *ac_space=\ *) +- # `set' does not quote correctly, so add quotes (double-quote substitution +- # turns \\\\ into \\, and sed turns \\ into \). +- sed -n \ +- -e "s/'/'\\\\''/g" \ +- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" +- ;; +- *) +- # `set' quotes correctly as required by POSIX, so do not add quotes. +- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' +- ;; +- esac >> confcache +-if cmp -s $cache_file confcache; then +- : +-else +- if test -w $cache_file; then +- echo "updating cache $cache_file" +- cat confcache > $cache_file +- else +- echo "not updating unwritable cache $cache_file" +- fi +-fi +-rm -f confcache +- +-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 +- +-test "x$prefix" = xNONE && prefix=$ac_default_prefix +-# Let make expand exec_prefix. +-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' +- +-# Any assignment to VPATH causes Sun make to only execute +-# the first set of double-colon rules, so remove it if not needed. +-# If there is a colon in the path, we need to keep it. +-if test "x$srcdir" = x.; then +- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +-fi +- +-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 +- +-DEFS=-DHAVE_CONFIG_H +- +-# Without the "./", some shells look in PATH for config.status. +-: ${CONFIG_STATUS=./config.status} +- +-echo creating $CONFIG_STATUS +-rm -f $CONFIG_STATUS +-cat > $CONFIG_STATUS </dev/null | sed 1q`: +-# +-# $0 $ac_configure_args +-# +-# Compiler output produced by configure, useful for debugging +-# configure, is in ./config.log if it exists. +- +-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +-for ac_option +-do +- case "\$ac_option" in +- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) +- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" +- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; +- -version | --version | --versio | --versi | --vers | --ver | --ve | --v) +- echo "$CONFIG_STATUS generated by autoconf version 2.13" +- exit 0 ;; +- -help | --help | --hel | --he | --h) +- echo "\$ac_cs_usage"; exit 0 ;; +- *) echo "\$ac_cs_usage"; exit 1 ;; +- esac +-done +- +-ac_given_srcdir=$srcdir +- +-trap 'rm -fr `echo " +-Makefile +-kernel/Makefile +- config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +-EOF +-cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +-$ac_vpsub +-$extrasub +-s%@SHELL@%$SHELL%g +-s%@CFLAGS@%$CFLAGS%g +-s%@CPPFLAGS@%$CPPFLAGS%g +-s%@CXXFLAGS@%$CXXFLAGS%g +-s%@FFLAGS@%$FFLAGS%g +-s%@DEFS@%$DEFS%g +-s%@LDFLAGS@%$LDFLAGS%g +-s%@LIBS@%$LIBS%g +-s%@exec_prefix@%$exec_prefix%g +-s%@prefix@%$prefix%g +-s%@program_transform_name@%$program_transform_name%g +-s%@bindir@%$bindir%g +-s%@sbindir@%$sbindir%g +-s%@libexecdir@%$libexecdir%g +-s%@datadir@%$datadir%g +-s%@sysconfdir@%$sysconfdir%g +-s%@sharedstatedir@%$sharedstatedir%g +-s%@localstatedir@%$localstatedir%g +-s%@libdir@%$libdir%g +-s%@includedir@%$includedir%g +-s%@oldincludedir@%$oldincludedir%g +-s%@infodir@%$infodir%g +-s%@mandir@%$mandir%g +-s%@CC@%$CC%g +-s%@SET_MAKE@%$SET_MAKE%g +-s%@RANLIB@%$RANLIB%g +-s%@CPP@%$CPP%g +-s%@X_CFLAGS@%$X_CFLAGS%g +-s%@X_PRE_LIBS@%$X_PRE_LIBS%g +-s%@X_LIBS@%$X_LIBS%g +-s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g +-s%@LINUX_SRC@%$LINUX_SRC%g +-s%@NETBSD_SRC@%$NETBSD_SRC%g +-s%@FREEBSD_SRC@%$FREEBSD_SRC%g +-s%@HOST_O@%$HOST_O%g +-s%@KERNEL_TARGET@%$KERNEL_TARGET%g +-s%@HOST_TARGET@%$HOST_TARGET%g +-s%@HOST_CLEAN@%$HOST_CLEAN%g +-s%@HOSTOS@%$HOSTOS%g +-s%@FULL_LINK@%$FULL_LINK%g +-s%@SUFFIX_LINE@%$SUFFIX_LINE%g +-s%@CPP_SUFFIX@%$CPP_SUFFIX%g +-s%@DASH@%$DASH%g +-s%@SLASH@%$SLASH%g +-s%@CXXFP@%$CXXFP%g +-s%@CFP@%$CFP%g +-s%@OFP@%$OFP%g +-s%@MAKELIB@%$MAKELIB%g +-s%@RMCOMMAND@%$RMCOMMAND%g +-s%@EXE@%$EXE%g +-s%@COMMAND_SEPARATOR@%$COMMAND_SEPARATOR%g +-s%@CD_UP_ONE@%$CD_UP_ONE%g +-s%@CD_UP_TWO@%$CD_UP_TWO%g +- +-CEOF +-EOF +- +-cat >> $CONFIG_STATUS <<\EOF +- +-# Split the substitutions into bite-sized pieces for seds with +-# small command number limits, like on Digital OSF/1 and HP-UX. +-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +-ac_file=1 # Number of current file. +-ac_beg=1 # First line for current file. +-ac_end=$ac_max_sed_cmds # Line after last line for current file. +-ac_more_lines=: +-ac_sed_cmds="" +-while $ac_more_lines; do +- if test $ac_beg -gt 1; then +- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file +- else +- sed "${ac_end}q" conftest.subs > conftest.s$ac_file +- fi +- if test ! -s conftest.s$ac_file; then +- ac_more_lines=false +- rm -f conftest.s$ac_file +- else +- if test -z "$ac_sed_cmds"; then +- ac_sed_cmds="sed -f conftest.s$ac_file" +- else +- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" +- fi +- ac_file=`expr $ac_file + 1` +- ac_beg=$ac_end +- ac_end=`expr $ac_end + $ac_max_sed_cmds` +- fi +-done +-if test -z "$ac_sed_cmds"; then +- ac_sed_cmds=cat +-fi +-EOF +- +-cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then +- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". +- case "$ac_file" in +- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` +- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; +- *) ac_file_in="${ac_file}.in" ;; +- esac +- +- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. +- +- # Remove last slash and all that follows it. Not all systems have dirname. +- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` +- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then +- # The file is in a subdirectory. +- test ! -d "$ac_dir" && mkdir "$ac_dir" +- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" +- # A "../" for each directory in $ac_dir_suffix. +- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` +- else +- ac_dir_suffix= ac_dots= +- fi +- +- case "$ac_given_srcdir" in +- .) srcdir=. +- if test -z "$ac_dots"; then top_srcdir=. +- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; +- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; +- *) # Relative path. +- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" +- top_srcdir="$ac_dots$ac_given_srcdir" ;; +- esac +- +- +- echo creating "$ac_file" +- rm -f "$ac_file" +- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." +- case "$ac_file" in +- *Makefile*) ac_comsub="1i\\ +-# $configure_input" ;; +- *) ac_comsub= ;; +- esac +- +- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` +- sed -e "$ac_comsub +-s%@configure_input@%$configure_input%g +-s%@srcdir@%$srcdir%g +-s%@top_srcdir@%$top_srcdir%g +-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +-fi; done +-rm -f conftest.s* +- +-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +-# NAME is the cpp macro being defined and VALUE is the value it is being given. +-# +-# ac_d sets the value in "#define NAME VALUE" lines. +-ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +-ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +-ac_dC='\3' +-ac_dD='%g' +-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +-ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +-ac_uB='\([ ]\)%\1#\2define\3' +-ac_uC=' ' +-ac_uD='\4%g' +-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +-ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +-ac_eB='$%\1#\2define\3' +-ac_eC=' ' +-ac_eD='%g' +- +-if test "${CONFIG_HEADERS+set}" != set; then +-EOF +-cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +-fi +-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". +- case "$ac_file" in +- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` +- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; +- *) ac_file_in="${ac_file}.in" ;; +- esac +- +- echo creating $ac_file +- +- rm -f conftest.frag conftest.in conftest.out +- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` +- cat $ac_file_inputs > conftest.in +- +-EOF +- +-# Transform confdefs.h into a sed script conftest.vals that substitutes +-# the proper values into config.h.in to produce config.h. And first: +-# Protect against being on the right side of a sed subst in config.status. +-# Protect against being in an unquoted here document in config.status. +-rm -f conftest.vals +-cat > conftest.hdr <<\EOF +-s/[\\&%]/\\&/g +-s%[\\$`]%\\&%g +-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +-s%ac_d%ac_u%gp +-s%ac_u%ac_e%gp +-EOF +-sed -n -f conftest.hdr confdefs.h > conftest.vals +-rm -f conftest.hdr +- +-# This sed command replaces #undef with comments. This is necessary, for +-# example, in the case of _POSIX_SOURCE, which is predefined and required +-# on some systems where configure will not decide to define it. +-cat >> conftest.vals <<\EOF +-s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +-EOF +- +-# Break up conftest.vals because some shells have a limit on +-# the size of here documents, and old seds have small limits too. +- +-rm -f conftest.tail +-while : +-do +- ac_lines=`grep -c . conftest.vals` +- # grep -c gives empty output for an empty file on some AIX systems. +- if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi +- # Write a limited-size here document to conftest.frag. +- echo ' cat > conftest.frag <> $CONFIG_STATUS +- sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS +- echo 'CEOF +- sed -f conftest.frag conftest.in > conftest.out +- rm -f conftest.in +- mv conftest.out conftest.in +-' >> $CONFIG_STATUS +- sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail +- rm -f conftest.vals +- mv conftest.tail conftest.vals +-done +-rm -f conftest.vals +- +-cat >> $CONFIG_STATUS <<\EOF +- rm -f conftest.frag conftest.h +- echo "/* $ac_file. Generated automatically by configure. */" > conftest.h +- cat conftest.in >> conftest.h +- rm -f conftest.in +- if cmp -s $ac_file conftest.h 2>/dev/null; then +- echo "$ac_file is unchanged" +- rm -f conftest.h +- else +- # Remove last slash and all that follows it. Not all systems have dirname. +- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` +- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then +- # The file is in a subdirectory. +- test ! -d "$ac_dir" && mkdir "$ac_dir" +- fi +- rm -f $ac_file +- mv conftest.h $ac_file +- fi +-fi; done +- +-EOF +-cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +- +-exit 0 +-EOF +-chmod +x $CONFIG_STATUS +-rm -fr confdefs* $ac_clean_files +-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +- +diff -Nur bochs-2.0.2+20030829.old/plex86/configure.in bochs-2.0.2+20030829/plex86/configure.in +--- bochs-2.0.2+20030829.old/plex86/configure.in 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/configure.in 1970-01-01 00:00:00.000000000 +0000 +@@ -1,169 +0,0 @@ +-dnl // Process this file with autoconf to produce a configure script. +- +-AC_PREREQ(2.4) +-AC_INIT(COPYING) +-AC_CONFIG_HEADER(config.h) +- +-changequote(<<, >>) +-changequote([, ]) +- +-AC_PROG_CC +-AC_PROG_MAKE_SET +-AC_PROG_RANLIB +- +-AC_PATH_XTRA +- +-AC_C_INLINE +-AC_CHECK_SIZEOF(unsigned char, 0) +-AC_CHECK_SIZEOF(unsigned short, 0) +-AC_CHECK_SIZEOF(unsigned int, 0) +-AC_CHECK_SIZEOF(unsigned long, 0) +-AC_CHECK_SIZEOF(unsigned long long, 0) +- +-dnl When compiling with gcc, use appropriate warning level +-if test "$GCC" = "yes"; then +- CFLAGS="$CFLAGS -Wall -Wstrict-prototypes" +-fi +-if test "$GXX" = "yes"; then +- CXXFLAGS="$CXXFLAGS -Wall -Wstrict-prototypes" +-fi +- +-AC_ARG_WITH(WinNT, +- [ --with-WinNT WinNT host], +- ) +- +-AC_ARG_WITH(BeOS, +- [ --with-BeOS BeOS host], +- ) +- +-AC_ARG_WITH(Linux, +- [ --with-Linux Linux host], +- ) +- +-AC_ARG_WITH(NetBSD, +- [ --with-NetBSD NetBSD host], +- ) +- +-AC_ARG_WITH(FreeBSD, +- [ --with-FreeBSD FreeBSD host], +- ) +- +-AC_ARG_WITH(null, +- [ --with-null No real host], +- ) +- +-AC_ARG_WITH(linux-source, +- [ --with-linux-source=dir Linux kernel source dir], +- [ LINUX_SRC="$withval" ], +- [ LINUX_SRC="/lib/modules/`uname -r`/build" ] +- ) +-AC_SUBST(LINUX_SRC) +- +-AC_ARG_WITH(netbsd-source, +- [ --with-netbsd-source=dir NetBSD kernel source dir], +- [ NETBSD_SRC="$withval" ], +- [ NETBSD_SRC="/sys" ] +- ) +-AC_SUBST(NETBSD_SRC) +- +-AC_ARG_WITH(freebsd-source, +- [ --with-freebsd-source=dir FreeBSD kernel source dir], +- [ FREEBSD_SRC="$withval" ], +- [ FREEBSD_SRC="/sys" ] +- ) +-AC_SUBST(FREEBSD_SRC) +- +-dnl // make sure Linux is default host if no other chosen +-if test "$with_Linux" != yes && \ +- test "$with_BeOS" != yes && \ +- test "$with_NetBSD" != yes && \ +- test "$with_FreeBSD" != yes && \ +- test "$with_null" != yes && \ +- test "$with_WinNT" != yes; then +- with_Linux=yes +-fi +- +-if test "$with_Linux" = yes; then +- HOST_O=host-linux.o +- KERNEL_TARGET=plex86.o +- HOST_TARGET=linux-target +- HOST_CLEAN=linux-clean +- HOSTOS=LINUX +- FULL_LINK= +-elif test "$with_BeOS" = yes; then +- HOST_O=host-beos.o +- KERNEL_TARGET=plex86 +- HOST_TARGET= +- HOST_CLEAN= +- HOSTOS=BEOS +- FULL_LINK= +-elif test "$with_NetBSD" = yes; then +- HOST_O=host-netbsd.o +- KERNEL_TARGET=plex86.o +- HOST_TARGET=netbsd-target +- HOST_CLEAN=netbsd-clean +- HOSTOS=NETBSD +- FULL_LINK= +-elif test "$with_FreeBSD" = yes; then +- HOST_O=host-freebsd.o +- KERNEL_TARGET=plex86.o +- HOST_TARGET=freebsd-target +- HOST_CLEAN=freebsd-clean +- HOSTOS=FREEBSD +- FULL_LINK= +-elif test "$with_null" = yes; then +- HOST_O=host-null.o +- KERNEL_TARGET=plex86.o +- HOST_TARGET=null-target +- HOST_CLEAN=null-clean +- HOSTOS=NULL +- FULL_LINK='$(CC) -o a.out plex86.o' +-else +- echo " " +- echo "ERROR: Your system is not supported yet" +- exit 1 +-fi +- +- +-dnl // code to test if CFLAGS is set. If not, use defaults +-AC_SUBST(HOST_O) +-AC_SUBST(KERNEL_TARGET) +-AC_SUBST(HOST_TARGET) +-AC_SUBST(HOST_CLEAN) +-AC_SUBST(HOSTOS) +-AC_SUBST(FULL_LINK) +- +-SUFFIX_LINE='.SUFFIXES: .cc' +-CPP_SUFFIX='cc' +-DASH="-" +-SLASH="/" +-CXXFP="" +-CFP="" +-OFP="-o " +-MAKELIB="ar rv \$@" +-RMCOMMAND="rm -f " +-EXE="" +-COMMAND_SEPARATOR="&& \\" +-CD_UP_ONE="echo done" +-CD_UP_TWO="echo done" +-INSTRUMENT_DIR='instrument/' +-VIDEO_OBJS='$(VIDEO_OBJS_VGA)' +- +-AC_SUBST(SUFFIX_LINE) +-AC_SUBST(CPP_SUFFIX) +-AC_SUBST(DASH) +-AC_SUBST(SLASH) +-AC_SUBST(CXXFP) +-AC_SUBST(CFP) +-AC_SUBST(OFP) +-AC_SUBST(MAKELIB) +-AC_SUBST(RMCOMMAND) +-AC_SUBST(EXE) +-AC_SUBST(COMMAND_SEPARATOR) +-AC_SUBST(CD_UP_ONE) +-AC_SUBST(CD_UP_TWO) +- +-AC_OUTPUT([ +-Makefile +-kernel/Makefile +-]) +diff -Nur bochs-2.0.2+20030829.old/plex86/descriptor.h bochs-2.0.2+20030829/plex86/descriptor.h +--- bochs-2.0.2+20030829.old/plex86/descriptor.h 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/descriptor.h 2003-08-29 14:31:40.000000000 +0000 +@@ -1,5 +1,5 @@ + /************************************************************************ +- * $Id: descriptor.h,v 1.1 2003/01/01 17:32:04 kevinlawton Exp $ ++ * $Id: descriptor.h,v 0.0 2002/07/21 23:14:54 DemonLord Exp $ + ************************************************************************ + * + * plex86: run multiple x86 operating systems concurrently +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/Makefile.in bochs-2.0.2+20030829/plex86/kernel/Makefile.in +--- bochs-2.0.2+20030829.old/plex86/kernel/Makefile.in 2003-01-02 02:08:22.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +@@ -1,127 +0,0 @@ +-# plex86: run multiple x86 operating systems concurrently +-# Copyright (C) 1999-2001 Kevin P. Lawton +-# +-# This library is free software; you can redistribute it and/or +-# modify it under the terms of the GNU Lesser General Public +-# License as published by the Free Software Foundation; either +-# version 2 of the License, or (at your option) any later version. +-# +-# This library is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-# Lesser General Public License for more details. +-# +-# You should have received a copy of the GNU Lesser General Public +-# License along with this library; if not, write to the Free Software +-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- +- +-CC = @CC@ +-CFLAGS = @CFLAGS@ +-LDFLAGS = @LDFLAGS@ +-KERNEL_TARGET = @KERNEL_TARGET@ +-HOST_TARGET = @HOST_TARGET@ +-HOST_CLEAN = @HOST_CLEAN@ +- +-srcdir = @srcdir@ +-VPATH = @srcdir@ +- +-LD = ld +- +-HOST_O = @HOST_O@ +- +-# extra kernel CFLAGS and LDFLAGS for each host OS +-KCFLAGS_LINUX = -fno-strength-reduce -fomit-frame-pointer \ +- -malign-loops=2 -malign-jumps=2 -malign-functions=2 \ +- -D__KERNEL__ -I@LINUX_SRC@/include -DCPU=586 -DMODULE +-KLDFLAGS_LINUX = -r +- +- +-KCFLAGS_NULL = -fno-strength-reduce -fomit-frame-pointer \ +- -malign-loops=2 -malign-jumps=2 -malign-functions=2 \ +- -D__KERNEL__ -DCPU=586 +-KLDFLAGS_NULL = -r +- +- +-KCFLAGS_NETBSD = -fno-strength-reduce -nostdinc -fomit-frame-pointer \ +- -malign-loops=2 -malign-jumps=2 -malign-functions=2 \ +- -D_KERNEL -I@NETBSD_SRC@ -I@NETBSD_SRC@/arch -I. -D_LKM +-KLDFLAGS_NETBSD = -r +- +- +-KCFLAGS_FREEBSD = -fno-strength-reduce -nostdinc -fomit-frame-pointer \ +- -malign-loops=2 -malign-jumps=2 -malign-functions=2 \ +- -D_KERNEL -I@FREEBSD_SRC@ -I@FREEBSD_SRC@/sys -I. -D_LKM \ +- -DFREEBSD_PLEX86_DEBUG +-KLDFLAGS_FREEBSD = -r +- +-KCFLAGS_BEOS = +-KLDFLAGS_BEOS = -nostdlib /boot/develop/lib/x86/_KERNEL_ +- +-KLDFLAGS = $(KLDFLAGS_@HOSTOS@) +- +-ALL_CFLAGS = $(CFLAGS) $(KCFLAGS_@HOSTOS@) -I$(srcdir)/include -I$(srcdir)/.. +- +- +-.c.o: +- $(CC) -c $(ALL_CFLAGS) $< +-.S.o: +- $(CC) -c $(ALL_CFLAGS) -D__ASSEMBLY__ $< +- +-main_target: $(HOST_TARGET) $(KERNEL_TARGET) +- @FULL_LINK@ +- +-$(KERNEL_TARGET): $(HOST_O) monitor-host.o \ +- nexus.o print-mon.o \ +- util-nexus.o \ +- fault-mon.o panic-mon.o \ +- paging-mon.o monitor-mon.o +- $(LD) $(KLDFLAGS) $^ -o $@ +- +-clean: $(HOST_CLEAN) main_clean +- +-main_clean: +- /bin/rm -f *.o *.s $(KERNEL_TARGET) a.out +- +-dist-clean: clean +- /bin/rm -f Makefile +- +-# Linux specific targets +-linux-target: +- +-linux-clean: +- +-# Null specific targets +-null-target: +- +-null-clean: +- +- +-# NetBSD specific targets +-netbsd-target: netbsd-machine +- +-netbsd-machine: +- ln -sf @NETBSD_SRC@/arch/i386/include machine +- +-netbsd-clean: +- /bin/rm -f machine +- +-# FreeBSD specific targets +-freebsd-target: freebsd-machine +- [ -r opt_posix.h ] || touch opt_posix.h +- +-freebsd-machine: +- ln -sf @FREEBSD_SRC@/i386/include machine +- +-freebsd-clean: +- /bin/rm -f opt_posix.h +- /bin/rm -f machine +- +-# BeOS specific targets +-beos-install: $(KERNEL_TARGET) +- cp -f $(KERNEL_TARGET) /boot/home/config/add-ons/kernel/drivers/bin +- mkdir -p /boot/home/config/add-ons/kernel/drivers/dev/misc +- ln -sf ../../bin/$(KERNEL_TARGET) /boot/home/config/add-ons/kernel/drivers/dev/misc/$(KERNEL_TARGET) +- +-Makefile: Makefile.in ../config.status +- cd ..; CONFIG_FILES=kernel/Makefile CONFIG_HEADERS= $(SHELL) config.status +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/fault-mon.c bochs-2.0.2+20030829/plex86/kernel/fault-mon.c +--- bochs-2.0.2+20030829.old/plex86/kernel/fault-mon.c 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/fault-mon.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,306 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * fault-mon.c: fault/int handlers for VM monitor - monitor space. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +-#include "plex86.h" +-#define IN_MONITOR_SPACE +-#include "monitor.h" +- +- +- +- +- +-/* The monitor stack frame. When an exception or interrupt occurrs +- * during the execution of either guest or monitor code, the following +- * values are pushed. +- * +- * ss +- * esp +- * eflags Values pushed by the CPU and interrupt stub. To simplify +- * cs things, the stub pushes an error of zero for those +- * eip events which don't naturally cause an error push, and +- * error also pushes the vector of the exception/interrupt. +- * vector +- * +- * eax +- * ecx +- * edx General registers, pushed with a PUSHA instruction, +- * ebx by code below. +- * +- * ebp +- * esi +- * edi +- * +- * es +- * ds Segment selectors, pushed by code below. +- * fs +- * gs +- */ +- +-void handleMonFault(guest_context_t *monContext); +- +- static inline +-Bit32u readCR2(void) +-{ +- Bit32u cr2; +- asm volatile ("movl %%cr2, %0" : "=r" (cr2)); +- return( cr2 ); +-} +- +- +-asm ( +-".text \n\t" +- +-/* __handle_fault: This is called by all of the monitor's fault handler +- * stubs. A fault could have originated from execution of the guest +- * (due to virtualization conditions or natural fault generation) or +- * from the monitor (currently only due to bugs in the monitor). +- */ +-".globl __handle_fault \n\t" +-"__handle_fault: \n\t" +-" pushal \n\t" /* Save general registers */ +-" pushl %es \n\t" /* Save segment registers */ +-" pushl %ds \n\t" +-" pushl %fs \n\t" +-" pushl %gs \n\t" +-" movl 60(%esp), %eax \n\t" /* CS pushed by CPU from fault */ +-" andl $3, %eax \n\t" /* Check CS.RPL bits */ +-" jz __fault_from_mon \n\t" /* RPL0 means from monitor */ +- +-/* We have determined that the fault was from guest code. Prepare +- * to call the monitor C code to do most of the fault handling. +- */ +-"__fault_from_guest: \n\t" +-" movl %ss, %eax \n\t" /* Copy SS into DS/ES */ +-" movl %eax, %ds \n\t" +-" movl %eax, %es \n\t" +-" cld \n\t" /* gcc-compiled code needs this */ +-" pushl %esp \n\t" /* Push pointer to saved guest context for C call.*/ +-" call handleGuestFault\n\t" /* Call the C monitor fault handler. */ +-" addl $4, %esp \n\t" /* Remove arg from stack. */ +-".globl __ret_to_guest \n\t" /* Fault handled, work back to guest. */ +-"__ret_to_guest: \n\t" +-/* Return to the guest. Restore registers from the monitor stack. */ +-" popl %gs \n\t" /* Restore guest segments */ +-" popl %fs \n\t" +-" popl %ds \n\t" +-" popl %es \n\t" +-" popal \n\t" /* Restore guest general registers */ +-" addl $8, %esp \n\t" /* Ignore vector and error dwords */ +-" iret \n\t" /* Resume execution of guest */ +- +- +-"__fault_from_mon: \n\t" +-" cld \n\t" /* gcc-compiled code needs this */ +-" pushl %esp \n\t" /* Push pointer to context. */ +-" call handleMonFault \n\t" /* Call C code for real work */ +-" addl $4, %esp \n\t" +-/* Return to monitor. Restore state from the monitor stack. */ +-"__ret_to_monitor: \n\t" +-" popl %gs \n\t" /* Restore monitor segments */ +-" popl %fs \n\t" +-" popl %ds \n\t" +-" popl %es \n\t" +-" popal \n\t" /* Restore monitor general registers */ +-" addl $8, %esp \n\t" /* ignore vector and error dwords */ +-" iret \n\t" /* Resume execution of monitor */ +- +- +-/* +- * Hardware interrupt handler stub +- */ +-".globl __handle_int \n\t" /* Return to monitor code */ +-"__handle_int: \n\t" +-" pushal \n\t" /* Save guest general registers */ +-" pushl %es \n\t" /* Save guest segment registers */ +-" pushl %ds \n\t" +-" pushl %fs \n\t" +-" pushl %gs \n\t" +- +-" movl %ss, %eax \n\t" /* Copy SS into DS/ES */ +-" movl %eax, %ds \n\t" +-" movl %eax, %es \n\t" +-" cld \n\t" /* gcc-compiled code needs this */ +-" pushl %esp \n\t" +-" call handleInt \n\t" /* monitor interrupt handler */ +-" addl $4, %esp \n\t" +-" cmpl $0x1, %eax \n\t" /* Was interrupt generated from monitor code? */ +-" je __ret_to_monitor\n\t" /* Yes, so return to monitor code */ +-" jmp __ret_to_guest \n\t" /* No, so return to guest code */ +-); +- +- +- +- unsigned +-handleInt(guest_context_t *context) +-/* +- * handleInt(): Redirect a hardware interrupt back to the host +- */ +-{ +- nexus_t *nexus = (nexus_t *) (((Bit32u) context) & 0xfffff000); +- vm_t *vm = (vm_t *) nexus->vm; +- unsigned from_monitor; +- Bit64u t1; +- +- t1 = vm_rdtsc(); +- +- if ( (context->cs & 0x0003) == 0x0003 ) { +- /* End of elapsed guest execution duration. Add elapsed */ +- /* cycles to time framework. */ +- vm->system.cyclesElapsed += (t1 - vm->system.t0); +- +- from_monitor = 0; /* Event from guest code */ +- } +- else { +- from_monitor = 1; /* Event from monitor code */ +- } +- +- /* Interrupts are off naturally here. */ +- vm->mon_request = MonReqRedirect; +- vm->redirect_vector = context->vector; +- vm->guest.__mon2host(); +- return(from_monitor); +-} +- +- +- void +-handleGuestFault(guest_context_t *context) +-/* Handle a fault from the guest. Called from the assembly stub +- * __handle_fault. +- */ +-{ +- nexus_t *nexus = (nexus_t *) (((Bit32u) context) & 0xfffff000); +- vm_t *vm = (vm_t *) nexus->vm; +- Bit32u cr2 = readCR2(); +- Bit64u t1; +- +- /* End of elapsed guest execution duration */ +- t1 = vm_rdtsc(); +- vm->system.cyclesElapsed += (t1 - vm->system.t0); +- +-#warning "Delete these checks" +-#if ANAL_CHECKS +- if ( !context->eflags.fields.if_ ) +- monpanic(vm, "handleGuestFault: guest IF=0.\n"); +- if ( context->eflags.fields.vm ) +- monpanic(vm, "handleGuestFault: eflags.VM=1.\n"); +-#endif +- +- STI(); +- +- switch ( context->vector ) { +- case ExceptionDB: /* 1 */ +- monpanic(vm, "handleGuestFault: #DB, method=%u not coded\n", +- vm->executeMethod); +-#if 0 +- if (vm->executeMethod == RunGuestNMethodBreakpoint) { +- /* Breakpoint generated because we requested it via TF=1 */ +- } +- else { +- monpanic(vm, "handleGuestFault: #DB, method=%u not coded\n", +- vm->executeMethod); +- } +-#endif +- break; +- +- case ExceptionBR: /* 5 */ +-monpanic(vm, "handleGuestFault: BR unfinished.\n"); +- /* BOUND instruction fault; array index not in bounds */ +-monpanic(vm, "handleGuestFault: emulate_exception was here.\n"); +- /*emulate_exception(vm, context->vector, 0);*/ +- break; +- +- case ExceptionDE: /* 0 */ +- case ExceptionBP: /* 3 */ +- case ExceptionOF: /* 4 */ +- case ExceptionNM: /* 7 */ +- case ExceptionMF: /* 16 */ +- toHostGuestFault(vm, context->vector); +- /*monpanic(vm, "handleGuestFault: DE/BP/OF/NM/MF unfinished.\n");*/ +- /*monpanic(vm, "handleGuestFault: %u\n", context->vector);*/ +- /* emulate_interrupt(vm, context->vector); */ +- break; +- +- case ExceptionNP: /* 11 */ +- case ExceptionSS: /* 12 */ +- case ExceptionAC: /* 17 */ +-monpanic(vm, "handleGuestFault: NP/SS/AC unfinished.\n"); +- /* use emulate_xyz() */ +- /*interrupt(vm, context->vector, 0, 1, context->error); */ +- monpanic(vm, "handleGuestFault: %u\n", context->vector); +- break; +- +- case ExceptionUD: /* 6 */ +- case ExceptionGP: /* 13 */ +- toHostGuestFault(vm, context->vector); +- break; +- +- case ExceptionPF: /* 14 */ +- guestPageFault(vm, context, cr2); +- break; +- +- default: +- monpanic(vm, "handleGuestFault: Unhandled Fault: %u\n", context->vector); +- break; +- } +-} +- +- void +-handleMonFault(guest_context_t *monContext) +-{ +- nexus_t *nexus = (nexus_t *) (((Bit32u) monContext) & 0xfffff000); +- vm_t *vm = (vm_t *) nexus->vm; +- +- if (vm->inMonFault) +- monpanic(vm, "handleMonFault called recursively.\n"); +- vm->inMonFault = 1; +-monpanic(vm, "handleMonFault: vector=%u\n", monContext->vector); +- +- /* Fault occurred inside monitor code. */ +- +- switch ( monContext->vector ) { +- case ExceptionPF: +- case ExceptionGP: +- { +- Bit32u cr2; +- /*unsigned us, rw;*/ +- +- cr2 = readCR2(); +- STI(); +- +- if (monContext->error & 0x8) /* If RSVD bits used in PDir */ +- monpanic(vm, "handleMF: RSVD\n"); +- /*us = G_GetCPL(vm)==3;*/ +- /*rw = (monContext->error >> 1) & 1;*/ +- monpanic(vm, "handleMF: \n"); +- break; +- } +- +- default: +- monpanic(vm, "hMF: vector=%u\n", monContext->vector); +- break; +- } +- +- /*vm->abort_code = 1;*/ +- /*monpanic_nomess(vm);*/ +- CLI(); +- vm->inMonFault = 0; +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/freebsd/Makefile bochs-2.0.2+20030829/plex86/kernel/freebsd/Makefile +--- bochs-2.0.2+20030829.old/plex86/kernel/freebsd/Makefile 2003-01-01 17:32:05.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/freebsd/Makefile 1970-01-01 00:00:00.000000000 +0000 +@@ -1,6 +0,0 @@ +-# FreeBSD Kernel module makefile +- +-SRCS= ../plex86.o +-KMOD= plex86 +- +-.include +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/host-beos.c bochs-2.0.2+20030829/plex86/kernel/host-beos.c +--- bochs-2.0.2+20030829.old/plex86/kernel/host-beos.c 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/host-beos.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,219 +0,0 @@ +-#include +-#include +-#include +-#include +- +-#include +-#include +-#include +- +-#include "plex86.h" +-#include "monitor.h" +- +- +-#define read_flags() ({ \ +- unsigned int __dummy; \ +- __asm__( \ +- "pushfl\n\t" \ +- "popl %0\n\t" \ +- :"=r" (__dummy)); \ +- __dummy; \ +-}) +-#define write_flags(x) \ +- __asm__("push %0\n\tpopfl\n\t": :"r" (x)) +- +- +- +-struct cookie { +- sem_id sem; +- +- int mon_ok; +- +- uint32 irq_cnt[17]; +-}; +- +-static status_t +-driver_open(const char *name, ulong flags, void **_cookie) +-{ +- struct cookie *cookie; +- status_t err; +- +- cookie = calloc(sizeof(*cookie), 1); +- if (!cookie) +- return ENOMEM; +- cookie->sem = create_sem(1, "plex86 mutex"); +- if (cookie->sem < 0) { +- err = cookie->sem; +- goto err1; +- } +- *_cookie = cookie; +- return B_OK; +- +-err1: +- free(cookie); +- return err; +-} +- +-static status_t +-driver_close(void *cookie) +-{ +- return B_OK; +-} +- +-static status_t +-driver_free(void *_cookie) +-{ +- struct cookie *cookie = (struct cookie *)_cookie; +- delete_sem(cookie->sem); +- free(cookie); +- return B_OK; +-} +- +-static status_t +-driver_read(void *cookie, off_t pos, void *buf, size_t *count) +-{ +- return B_OK; +-} +- +- +-static status_t +-driver_write(void *cookie, off_t pos, const void *buf, size_t *count) +-{ +- return B_OK; +-} +- +-static status_t +-driver_ioctl(void *_cookie, ulong cmd, void *buf, size_t len) +-{ +- struct cookie *cookie = (struct cookie *)_cookie; +- uint32 cr0, arg, eflags_orig; +- uchar soft_int_vector; +- status_t err; +- +- arg = *(uint32 *)buf; +- +- switch (cmd) { +- /* Allocate unpaged memory for the VM. */ +- /* arg is the number of megabytes to allocate */ +- /* Memory returned must not be pageable by the */ +- /* host OS, since the VM monitor will run in this */ +- /* memory as well. Perhaps later, we can let */ +- /* the guest OS run in paged memory and reflect */ +- /* the page faults back to the host OS. */ +- case 0x6b02: +- acquire_sem(cookie->sem); +- init_monitor(MASTER_PIC_BASE_VECTOR, SLAVE_PIC_BASE_VECTOR, IRQ16_BASE_VECTOR); +- cookie->mon_ok = 1; +- release_sem(cookie->sem); +- return B_OK; +- +- case 0x6b03: +- /* linux-specific hack, unnecessary under BeOS */ +- return B_OK; +- +- /* run guest context for a time slice */ +- case 0x6b04: +- { +- cpu_status ps; +- +- acquire_sem(cookie->sem); +- +- if (!cookie->mon_ok) { +- release_sem(cookie->sem); +- return EPERM; +- } +- +- ps = disable_interrupts(); +- +- /* clear NT/IF/TF */ +- eflags_orig = read_flags(); +- write_flags(eflags_orig & ~0x00004300); +- +- __host2guest(); +- +- write_flags(eflags_orig & ~0x00000200); +- +- restore_interrupts(ps); +- +- switch ( monitor_info.ret_because ) { +- case RET_BECAUSE_IRQ: +- /* reported vector is actually the IRQ# */ +- +- soft_int_vector = MASTER_PIC_BASE_VECTOR + monitor_info.vector; +- soft_int(soft_int_vector); +- cookie->irq_cnt[monitor_info.vector]++; +- dprintf("plex86: irq %u\n", monitor_info.vector); +- err = B_OK; +- break; +- +- case RET_BECAUSE_INT: +- dprintf("plex86: int %u\n", monitor_info.vector); +- err = EFAULT; +- break; +- +- case RET_BECAUSE_EXC: +- dprintf("plex86: exc %u\n", monitor_info.vector); +- err = EFAULT; +- break; +- +- case RET_BECAUSE_TEST: +- dprintf("plex86: test\n"); +- err = B_OK; +- break; +- +- default: +- dprintf("plex86: unknown ret_because\n"); +- err = B_OK; +- break; +- } +- +- release_sem(cookie->sem); +- return err; +- } +- +- case 0x6b05: /* tear down VM environment */ +- acquire_sem(cookie->sem); +- cookie->mon_ok = 0; +- release_sem(cookie->sem); +- return B_OK; +- } +- +- return ENOSYS; +-} +- +-device_hooks driver_device = { +- driver_open, +- driver_close, +- driver_free, +- driver_ioctl, +- driver_read, +- driver_write +-}; +- +-status_t +-init_driver (void) +-{ +- return B_OK; +-} +- +-void +-uninit_driver(void) +-{ +-} +- +-const char ** +-publish_devices(void) +-{ +- static const char *driver_names[] = { +- "misc/plex86", +- NULL +- }; +- return (const char **)driver_names; +-} +- +-device_hooks * +-find_device(const char *name) +-{ +- return &driver_device; +-} +- +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/host-freebsd.c bochs-2.0.2+20030829/plex86/kernel/host-freebsd.c +--- bochs-2.0.2+20030829.old/plex86/kernel/host-freebsd.c 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/host-freebsd.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,569 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * +- * Copyright (C) 2000 Frank van der Linden (fvdl@wasabisystems.com) +- * Copyright (C) 2000 Alexander Langer +- * +- * License as published by the Free Software Foundation; either version 2 of +- * the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, but WITHOUT +- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +- * License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public License +- * along with this library; if not, write to the Free Software Foundation, +- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#define DIAGNOSTIC 1 +-#define CDEV_MAJOR 20 +-#define timer_t __bsd_timer_t +-#define write_eflags __freebsd_write_eflags +-#define read_eflags __freebsd_read_eflags +- +-/* XXX recheck, which includes are needed */ +-#include +-#include +-#include +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +- +-#include +- +-#undef timer_t +-#undef write_eflags +-#undef read_eflags +- +-#include "plex86.h" +-#define IN_HOST_SPACE +-#include "monitor.h" +- +-static MALLOC_DEFINE(M_PLEX86, "plex86", "Plex86 mem"); +- +-static d_open_t plex86_open; +-static d_close_t plex86_close; +-static d_mmap_t plex86_mmap; +-static d_ioctl_t plex86_ioctl; +- +-static unsigned retrieve_phy_pages(Bit32u *, int, void *, unsigned, int); +-static vm_t *find_vm(struct proc * p); +-static void register_vm(vm_t * vm, struct proc * p); +-static void unregister_all(struct proc * p); +- +-static struct cdevsw plex86_cdevsw = { +- /* open */ plex86_open, +- /* close */ plex86_close, +- /* read */ noread, +- /* write */ nowrite, +- /* ioctl */ plex86_ioctl, +- /* poll */ nopoll, +- /* mmap */ plex86_mmap, +- /* strat */ nostrategy, +- /* name */ "plex86", +- /* major */ CDEV_MAJOR, +- /* dump */ nodump, +- /* psize */ nopsize, +- /* flags */ 0, +- /* bmaj */ -1 +-}; +- +-/* For use with make_dev/destroy_dev */ +-static dev_t plex86_dev; +- +-static struct plex86_softc { +- int sc_open; +-} plex86sc; +- +-monitor_pages_t monitor_pages; +- +-/* +- * Hash table stuff to maintain proc <-> vm mapping. 23 entries should be +- * plenty.. unless someone plans to run more than 23 guest OSs.. +- * +- * Note that a process can only open the device once with this scheme. +- */ +- +-LIST_HEAD(plex86_hashhead, plex86_vmentry); +- +-struct plex86_vmentry { +- pid_t vm_pid; +- vm_t *vm_vm; +- LIST_ENTRY(plex86_vmentry) vm_entry; +-}; +- +-struct plex86_hashhead *plex86_hashtbl; +-u_long plex86_hashmask; +- +-#define PLEX86_VMHASHSIZE 23 +-#define PLEX86_VMHASH(p) ((u_long)((p)->p_pid) & plex86_hashmask) +- +-static int +-plex86_open(dev_t dev, int flags, int fmt, struct proc * p) +-{ +- vm_t *vm; +- +- if (suser_xxx(p->p_ucred, p, p->p_acflag) != 0) +- return (EPERM); +- +- vm = find_vm(p); +- if (vm == NULL) { +- vm = malloc(sizeof(vm_t), M_PLEX86, M_WAITOK); +- if (vm == NULL) +- return EIO; +- memset(vm, 0, sizeof(vm_t)); +- register_vm(vm, p); +- plex86sc.sc_open++; +- } else +- return (EBUSY); +- +- /* Kernel independent device open code. */ +- hostDeviceOpenInit(vm); +- +-#ifdef FREEBSD_PLEX86_DEBUG +- printf("plex86: pid %u opened device, vm %p\n", p->p_pid, vm); +-#endif +- +- return (0); +-} +- +-int +-plex86_close(dev_t dev, int flags, int fmt, struct proc * p) +-{ +- unregister_all(p); +- plex86sc.sc_open = 0; +-#ifdef FREEBSD_PLEX86_DEBUG +- printf("plex86: pid %u closed device\n", p->p_pid); +-#endif +- return (0); +-} +- +-int +-plex86_mmap(dev_t dev, vm_offset_t offset, int nprot) +-{ +- struct proc *p = curproc; +- int page; +- vm_offset_t endguestoff; +- vm_t *vm; +- +- vm = find_vm(p); +- if (vm == NULL) +- return (ENXIO); +- +-#warning "kludge to mmap message buffer" +- endguestoff = (vm_offset_t) (vm->pages.guest_n_megs * 1024 * 1024); +- if (offset >= endguestoff && nprot == PROT_READ) { +- page = (offset - endguestoff) / PAGE_SIZE; +- return (vm->pages.log_buffer[page]); +- } +- page = offset / PAGE_SIZE; +- if (page < 0 || page > vm->pages.guest_n_pages) { +- log(LOG_WARNING, "plex86: mmap: offset %lx out of range\n", +- (unsigned long) offset); +- return -1; +- } +- return vm->pages.guest[page]; +-} +- +-int +-plex86_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, +- struct proc * p) +-{ +- int error; +- vm_t *vm; +- +- vm = find_vm(p); +- if (vm == NULL) +- return EINVAL; +- +- switch (cmd) { +- case PLEX86_ALLOCVPHYS: +- { +- unsigned arg = *((unsigned *) data); +- guest_cpu_t guest_cpu; +- +- if (vm->mon_state != MON_STATE_UNINITIALIZED || +- vm->pages.guest_n_megs != 0) +- return EBUSY; +- if (arg > PLEX86_MAX_PHY_MEGS || arg < 4 || (arg & ~0x3) != arg) +- return EINVAL; +- +- /* Allocate memory */ +- error = allocVmPages(vm, arg); +- if (error != 0) { +- log(LOG_WARNING, "plex86: allocVmPages failed (%d)\n", +- error); +- return ENOMEM; +- } +- if (init_guest_phy_mem(vm) != 0) { +- log(LOG_ERR, "plex86: init_guest_phy_mem failed\n"); +- unallocVmPages(vm); +- return EFAULT; +- } +- getCpuResetValues(&guest_cpu); +- log(LOG_WARNING, "plex86: cpu.cr0 = 0x%x\n", guest_cpu.cr0); +- if (!init_monitor(vm, 0, 0, &guest_cpu) || +- !setGuestCPU(vm, 0, &guest_cpu) || +- !mapMonitor(vm, guest_cpu.eflags, 0)) { +- log(LOG_ERR, "plex86: init_monitor failed\n"); +- unallocVmPages(vm); +- return EFAULT; +- } +- break; +- } +- +- case PLEX86_TEARDOWN: +- unallocVmPages(vm); +- break; +- +- case PLEX86_ALLOCINT: +- return EINVAL; +- case PLEX86_RELEASEINT: +- return EINVAL; +- case PLEX86_PRESCANDEPTH: +- { +- unsigned long arg = *(unsigned long *) data; +- +- if ((arg < PrescanDepthMin) || (arg > PrescanDepthMax)) { +- log(LOG_WARNING, "plex86: Requested prescan depth %lu" +- " out of range [%u..%u]\n", arg, PrescanDepthMin, +- PrescanDepthMax); +- return EINVAL; +- } +- vm->prescanDepth = (unsigned) arg; +- break; +- } +- case PLEX86_SETINTR: +- ioctlSetIntr(vm, *(unsigned long *) data); +- break; +- case PLEX86_SET_A20: +- { +- unsigned long arg = *(unsigned long *) data; +- if (!ioctlSetA20E(vm, arg)) +- return EINVAL; +- break; +- } +- case PLEX86_MESSAGEQ: +- { +- vm_messages_t msg; +- +- if (vm->mon_state != MON_STATE_RUNNABLE) +- return EINVAL; +- +- error = copyin(*(void **) data, &msg.header, sizeof msg.header); +- if (error != 0) +- return error; +- +- if ((msg.header.msg_len + sizeof(msg.header)) > sizeof(msg)) +- return EINVAL; +- +- if (msg.header.msg_len != 0) { +- error = copyin(&((vm_messages_t *) * (void **) data)->msg, +- &msg.msg, msg.header.msg_len); +- if (error != 0) +- return error; +- } +- if (ioctlMessageQ(vm, &msg)) { +- log(LOG_WARNING, "plex86: ioctlMessageQ failed\n"); +- return EINVAL; +- } +- error = copyout(&msg, *(void **) data, +- sizeof(msg.header) + msg.header.msg_len); +- return error; +- } +- case PLEX86_RESET: +- break; +- +- case PLEX86_PHYMEM_MOD: +- break; +- case PLEX86_FORCE_INT: +- if (vm->mon_state != MON_STATE_RUNNABLE) +- return -EINVAL; +- vm->dbg_force_int = 0x100 | (unsigned) data; +- break; +- case PLEX86_PRESCANRING3: +- { +- unsigned long arg = *(unsigned long *) data; +- if (arg > PrescanRing3On) { +- log(LOG_WARNING, +- "plex86: Requested PrescanRing3 val(%lu) OOB\n", +- arg); +- return EINVAL; +- } +- vm->prescanRing3 = arg; +- break; +- } +- +- default: +- log(LOG_WARNING, "plex86: unknown ioctl %lx\n", cmd); +- return EINVAL; +- } +- return 0; +-} +- +-static void +-register_vm(vm_t * vm, struct proc * p) +-{ +- struct plex86_hashhead *php; +- struct plex86_vmentry *vhp; +- +- php = &plex86_hashtbl[PLEX86_VMHASH(p)]; +-#if DIAGNOSTIC +- for (vhp = php->lh_first; vhp != NULL; vhp = vhp->vm_entry.le_next) { +- if (vhp->vm_pid == p->p_pid) +- panic("plex86: vm already registered, pid %u\n", +- p->p_pid); +- } +-#endif +- vhp = malloc(sizeof(struct plex86_vmentry), M_PLEX86, M_WAITOK); +- vhp->vm_pid = p->p_pid; +- vhp->vm_vm = vm; +- LIST_INSERT_HEAD(php, vhp, vm_entry); +-} +- +-static void +-unregister_vm(vm_t * vm, struct proc * p) +-{ +- struct plex86_hashhead *php; +- struct plex86_vmentry *vhp; +- +- php = &plex86_hashtbl[PLEX86_VMHASH(p)]; +- for (vhp = php->lh_first; vhp != NULL; vhp = vhp->vm_entry.le_next) { +- if (vhp->vm_pid == p->p_pid) { +- LIST_REMOVE(vhp, vm_entry); +- free(vhp->vm_vm, M_PLEX86); +- free(vhp, M_PLEX86); +- break; +- } +- } +-} +- +-static void +-unregister_all(struct proc * p) +-{ +- int i; +- struct plex86_hashhead *php; +- struct plex86_vmentry *vhp; +- +- php = &plex86_hashtbl[PLEX86_VMHASH(p)]; +- if (php == NULL) +- return; +- for (vhp = php->lh_first; vhp != NULL; +- vhp = vhp->vm_entry.le_next) { +-#ifdef FREEBSD_PLEX86_DEBUG +- printf("plex86: unregister vm %p, pid %u\n", +- vhp->vm_vm, vhp->vm_pid); +-#endif +- LIST_REMOVE(vhp, vm_entry); +- if (vhp->vm_vm != NULL) +- free(vhp->vm_vm, M_PLEX86); +- if (vhp != NULL) +- free(vhp, M_PLEX86); +- } +-} +- +-static vm_t * +-find_vm(struct proc * p) +-{ +- struct plex86_hashhead *php; +- struct plex86_vmentry *vhp; +- +- php = &plex86_hashtbl[PLEX86_VMHASH(p)]; +- for (vhp = php->lh_first; vhp != NULL; vhp = vhp->vm_entry.le_next) { +- if (vhp->vm_pid == p->p_pid) +- return vhp->vm_vm; +- } +- +- return NULL; +-} +- +-static unsigned +-retrieve_phy_pages(Bit32u * page, int max_pages, void *addr_v, unsigned size, +- int aligned) +-{ +- Bit32u start_addr; +- unsigned n_pages, i; +- +- if (!aligned) +- start_addr = (Bit32u) addr_v & ~(PAGE_SIZE - 1); +- else { +- start_addr = (Bit32u) addr_v; +- if (start_addr & (PAGE_SIZE - 1)) { +- log(LOG_WARNING, "plex86: retrieve_phy_pages: address " +- "%p not aligned\n", addr_v); +- return 0; +- } +- } +- +- n_pages = (size + PAGE_SIZE - 1) / PAGE_SIZE; +- if (n_pages > max_pages) { +- log(LOG_WARNING, "plex86: retrieve_phy_pages: page list " +- "too small\n"); +- return (0); +- } +- for (i = 0; i < n_pages; i++) { +- page[i] = kvtop((vm_offset_t) start_addr) / PAGE_SIZE; +- start_addr += PAGE_SIZE; +- } +- +- return n_pages; +-} +- +-unsigned +-host_idle(void) +-{ +-#if defined(want_resched) +- if (want_resched) { +-#endif +- yield(curproc, NULL); /* XXX */ +- need_resched(); /* XXX */ +-#if defined(want_resched) +- } +-#endif +- printf("resched done\n"); +- return (CURSIG(curproc) == 0); +-} +- +-void * +-host_alloc(unsigned long size) +-{ +- /* +- * XXX - it wants this page-aligned apparently. +- */ +- if (size <= (PAGE_SIZE / 2)) +- size = PAGE_SIZE; +- return (malloc(size, M_PLEX86, M_WAITOK)); +-} +- +-void +-host_free(void *ptr) +-{ +- free(ptr, M_PLEX86); +-} +- +-unsigned +-host_map(Bit32u * page, int max_pages, void *ptr, unsigned size) +-{ +- return retrieve_phy_pages(page, max_pages, ptr, size, 1); +-} +- +-void * +-host_alloc_page(void) +-{ +- return malloc(PAGE_SIZE, M_PLEX86, M_WAITOK); +-} +- +-void +-host_free_page(void *ptr) +-{ +- return free(ptr, M_PLEX86); +-} +- +-Bit32u +-host_map_page(void *ptr) +-{ +- Bit32u u; +- +- if (ptr == NULL) +- return 0; +- u = kvtop(ptr) / PAGE_SIZE; +-#if FREEBSD_PLEX86_DEBUG +- printf("host_map_page(%p) -> %x\n", ptr, u); +-#endif +- return u; +-} +- +-void +-hostprint(char *fmt,...) +-{ +- va_list args; +- int ret; +- unsigned char buffer[256]; +- +- va_start(args, fmt); +- ret = vsnprintf(buffer, 256, fmt, args); +- if (ret == -1) +- log(LOG_WARNING, +- "plex86: hostprint: vsnprintf returns error.\n"); +- else +- log(LOG_WARNING, "plex86: %s\n", buffer); +-} +- +-static int +-plex86_modevent(module_t mod, int type, void *data) +-{ +- linker_file_t lf; +- int error = 0; +- +- switch (type) { +- case MOD_LOAD: +- plex86_hashtbl = NULL; +- +- lf = linker_find_file_by_name("plex86"); +- if (lf == NULL) { +- printf("plex86: can't find linker_file 'plex86'\n"); +- return (ENXIO); +- } +- monitor_pages.startOffset = lf->address; +- monitor_pages.startOffsetPageAligned = +- monitor_pages.startOffset & 0xfffff000; +- +- if ((monitor_pages.n_pages = retrieve_phy_pages(monitor_pages.page, +- PLEX86_MAX_MONITOR_PAGES, +- lf->address, +- lf->size, +- 0)) == 0) { +- log(LOG_WARNING, "plex86: could not store physical " +- "addresses for monitor pages\n"); +- return (ENXIO); +- } +- plex86_hashtbl = hashinit(PLEX86_VMHASHSIZE, +- M_PLEX86, &plex86_hashmask); +- +- if (!hostModuleInit()) { +- log(LOG_WARNING, "hostModuleInit error\n"); +- error = EINVAL; +- } +- +- plex86_dev = make_dev(&plex86_cdevsw, 0 /* minor */ , UID_ROOT, +- GID_WHEEL, 0600, "plex86"); +- +- printf("plex86: Module loaded.\n"); +- return (0); +- break; +- case MOD_UNLOAD: +- if (plex86sc.sc_open != 0) +- return (EBUSY); +- +- destroy_dev(plex86_dev); +- +- if (plex86_hashtbl != NULL) { +- free(plex86_hashtbl, M_PLEX86); +- } +- printf("plex86: Module unloaded.\n"); +- break; +- +- default: +- error = ENXIO; +- break; +- } +- return (error); +-} +- +-MODULE_VERSION(plex86, 1); +-DEV_MODULE(plex86, plex86_modevent, 0); +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/host-linux.c bochs-2.0.2+20030829/plex86/kernel/host-linux.c +--- bochs-2.0.2+20030829.old/plex86/kernel/host-linux.c 2003-01-10 04:27:51.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/host-linux.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,800 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * host-linux.c: Linux specific VM host driver functionality +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#include "plex86.h" +-#define IN_HOST_SPACE +-#include "monitor.h" +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +- +-#ifndef VERSION_CODE +-# define VERSION_CODE(vers,rel,seq) ( ((vers)<<16) | ((rel)<<8) | (seq) ) +-#endif +- +- +-#if LINUX_VERSION_CODE < VERSION_CODE(2,4,20) +-/* I use get_user_pages() to find and pin physical pages of memory +- * underlying the guest physical memory malloc()'d from user space. +- * This became an exported symbol available for kernel modules +- * as of 2.4.20. You will have to recode some functions for +- * lesser kernels. +- */ +-# error "Currently, you need Linux kernel 2.4.20 or above." +-#endif +- +- +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,0) +-# include +-#endif +- +-#include +- +- +- +-/************************************************************************/ +-/* Compatibility macros & convenience functions for older kernels */ +-/************************************************************************/ +- +-#ifndef EXPORT_NO_SYMBOLS +-# define EXPORT_NO_SYMBOLS register_symtab(NULL) +-#endif +- +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,29) +-# define proc_register_dynamic proc_register +-#endif +- +-#if LINUX_VERSION_CODE < VERSION_CODE(2,2,0) +-#define NEED_RESCHED need_resched +-#else +-#define NEED_RESCHED current->need_resched +-#endif +- +- +- +-/* Instrumentation of how many hardware interrupts were redirected +- * to the host, while the VM monitor/guest was running. This can be +- * written to by multiple contexts, so it needs SMP protection. +- */ +-static atomic_t interruptRedirCount[256]; +- +- +- +-#if LINUX_VERSION_CODE < VERSION_CODE(2,1,0) +- static inline unsigned long +-copy_from_user(void *to, const void *from, unsigned long n) +-{ +- int i; +- if ( (i = verify_area(VERIFY_READ, from, n)) != 0 ) +- return i; +- memcpy_fromfs(to, from, n); +- return 0; +-} +- static inline unsigned long +-copy_to_user(void *to, const void *from, unsigned long n) +-{ +- int i; +- if ( (i = verify_area(VERIFY_WRITE, to, n)) != 0 ) +- return i; +- memcpy_tofs(to, from, n); +- return 0; +-} +-#endif +- +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,18) && !defined(THIS_MODULE) +-/* Starting with version 2.1.18, the __this_module symbol is present, +- * but the THIS_MODULE #define was introduced much later ... +- */ +-#define THIS_MODULE (&__this_module) +-#endif +- +- +-/************************************************************************/ +-/* Declarations */ +-/************************************************************************/ +- +-/* Use dynamic major number allocation. (Set non-zero for static allocation) */ +-#define PLEX86_MAJOR 0 +-static int plex_major = PLEX86_MAJOR; +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,18) +-MODULE_PARM(plex_major, "i"); +-MODULE_PARM_DESC(plex_major, "major number (default " __MODULE_STRING(PLEX86_MAJOR) ")"); +-#endif +- +-/* The kernel segment base. */ +-#if LINUX_VERSION_CODE < VERSION_CODE(2,1,0) +-# define KERNEL_OFFSET 0xc0000000 +-#else +-# define KERNEL_OFFSET 0x00000000 +-#endif +- +- +-/* File operations. */ +-static int plex86_ioctl(struct inode *, struct file *, unsigned int, +- unsigned long); +-static int plex86_open(struct inode *, struct file *); +- +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,31) +-static int plex86_release(struct inode *, struct file *); +-#else +-static void plex86_release(struct inode *, struct file *); +-#endif +- +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,0) +-static int plex86_mmap(struct file * file, struct vm_area_struct * vma); +-#else +-static int plex86_mmap(struct inode * inode, struct file * file, +- struct vm_area_struct * vma); +-#endif +- +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,9) +-/* New License scheme. */ +-#ifdef MODULE_LICENSE +-MODULE_LICENSE("GPL"); /* Close enough. Keeps kernel from complaining. */ +-#endif +-#endif +- +- +- +-/************************************************************************/ +-/* Structures / Variables */ +-/************************************************************************/ +- +-static int retrieveKernelModulePages(void); +-static unsigned retrievePhyPages(Bit32u *page, int max_pages, void *addr, +- unsigned size); +- +- +- +-static struct file_operations plex86_fops = { +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,4,0) +- owner: THIS_MODULE, +-#endif +- mmap: plex86_mmap, +- ioctl: plex86_ioctl, +- open: plex86_open, +- release: plex86_release, +- }; +- +- +-#ifdef CONFIG_DEVFS_FS +-#include +-devfs_handle_t my_devfs_entry; +-#endif +- +-/* For the /proc/driver/plex86 entry. */ +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,4,0) /* XXX - How far back? */ +-int plex86_read_procmem(char *, char **, off_t, int); +-#else +-int plex86_read_procmem(char *, char **, off_t, int, int); +-#endif +- +-#if LINUX_VERSION_CODE < VERSION_CODE(2,3,25) +-static struct proc_dir_entry plex86_proc_entry = { +- 0, /* dynamic inode */ +- 6, "driver/plex86", /* len, name */ +- S_IFREG | S_IRUGO, /* mode */ +- 1, 0, 0, +- 0, +- NULL, +- &plex86_read_procmem, /* read function */ +- }; +-#endif +- +-#if CONFIG_X86_PAE +-# error "CONFIG_X86_PAE defined for this kernel, but unhandled in plex86" +-#endif +- +-/************************************************************************/ +-/* Main kernel module code */ +-/************************************************************************/ +- +- int +-init_module(void) +-{ +- int err; +- +- /* Initialize structures which are not specific to each VM. These +- * are things which are set only once upon kernel module initialization. +- */ +- memset(&kernelModulePages, 0, sizeof(kernelModulePages)); +- memset(&interruptRedirCount, 0, sizeof(interruptRedirCount)); +- +- /* Register the device with the kernel. */ +- err = register_chrdev(plex_major, "plex86", &plex86_fops); +- if (err < 0) { +- printk(KERN_WARNING "plex86: can't get major %d\n", plex_major); +- return(err); +- } +- /* If this was a dynamic allocation, save the major for +- * the release code +- */ +- if(!plex_major) +- plex_major = err; +- +- /* Register the /proc entry. */ +-#ifdef CONFIG_PROC_FS +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,3,25) +- if (!create_proc_info_entry("driver/plex86", 0, NULL, plex86_read_procmem)) +- printk(KERN_ERR "plex86: registering /proc/driver/plex86 failed\n"); +-#else +- proc_register_dynamic(&proc_root, &plex86_proc_entry); +-#endif +-#endif +- +- /* Register /dev/misc/plex86 with devfs. */ +-#ifdef CONFIG_DEVFS_FS +- my_devfs_entry = devfs_register(NULL, "misc/plex86", +- DEVFS_FL_DEFAULT, +- plex_major, 0 /* minor mode*/, +- S_IFCHR | 0666, &plex86_fops, +- NULL /* "info" */); +- if (!my_devfs_entry) +- printk(KERN_ERR "plex86: registering misc/plex86 devfs entry failed\n"); +-#endif +- +- /* Retrieve the monitor physical pages. */ +- if ( !retrieveKernelModulePages() ) { +- printk(KERN_ERR "plex86: retrieveKernelModulePages returned error\n"); +- err = -EINVAL; +- goto fail_retrieve_pages; +- } +- +- /* Kernel independent code to be run when kernel module is loaded. */ +- if ( !hostModuleInit() ) { +- printk(KERN_ERR "plex86: genericModuleInit returned error\n"); +- err = -EINVAL; +- goto fail_cpu_capabilities; +- } +- +- /* Success. */ +- EXPORT_NO_SYMBOLS; +- return(0); +- +-fail_cpu_capabilities: +-fail_retrieve_pages: +- /* Unregister /proc entry. */ +-#ifdef CONFIG_PROC_FS +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,3,25) +- remove_proc_entry("driver/plex86", NULL); +-#else +- proc_unregister(&proc_root, plex86_proc_entry.low_ino); +-#endif +-#endif +- +- /* Unregister device. */ +- unregister_chrdev(plex_major, "plex86"); +- return err; +-} +- +- void +-cleanup_module(void) +-{ +- /* Unregister device. */ +- unregister_chrdev(plex_major, "plex86"); +- +- /* Unregister /proc entry. */ +-#ifdef CONFIG_PROC_FS +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,3,25) +- remove_proc_entry("driver/plex86", NULL); +-#else +- proc_unregister(&proc_root, plex86_proc_entry.low_ino); +-#endif +-#endif +- +-#ifdef CONFIG_DEVFS_FS +- devfs_unregister(my_devfs_entry); +-#endif +-} +- +- +- +-/************************************************************************/ +-/* Open / Release a VM */ +-/************************************************************************/ +- +- int +-plex86_open(struct inode *inode, struct file *filp) +-{ +- vm_t *vm; +-#if LINUX_VERSION_CODE < VERSION_CODE(2,4,0) +- MOD_INC_USE_COUNT; +-#endif +- +- /* Allocate a VM structure. */ +- if ( (vm = hostOSAllocZeroedMem(sizeof(vm_t))) == NULL ) +- return -ENOMEM; +- filp->private_data = vm; +- +- /* Kernel independent device open code. */ +- hostDeviceOpen(vm); +- +- return(0); +-} +- +- +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,31) +- int +-#else +- void +-#endif +-plex86_release(struct inode *inode, struct file *filp) +-{ +- vm_t *vm = (vm_t *)filp->private_data; +- filp->private_data = NULL; +- +- /* Free the virtual memory. */ +- hostUnallocVmPages( vm ); +- +- /* Free the VM structure. */ +- memset( vm, 0, sizeof(*vm) ); +- vfree( vm ); +- +-#if LINUX_VERSION_CODE < VERSION_CODE(2,4,0) +- MOD_DEC_USE_COUNT; +-#endif +- +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,31) +- return(0); +-#endif +-} +- +- +- int +-plex86_ioctl(struct inode *inode, struct file *filp, +- unsigned int cmd, unsigned long arg) +-{ +- vm_t *vm = (vm_t *)filp->private_data; +- int ret; +- +- /* Call non host-specific ioctl() code which calls back to this +- * module only when it needs host-specific features. +- */ +- ret = hostIoctlGeneric(vm, inode, filp, cmd, arg); +- +- /* Convert from plex86 errno codes to host-specific errno codes. Not +- * very exciting. +- */ +- if ( ret < 0 ) +- ret = - hostOSConvertPlex86Errno(- ret); +- return( ret ); +-} +- +- +- int +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,1,0) +-plex86_mmap(struct file * file, struct vm_area_struct * vma) +-#else +-plex86_mmap(struct inode * inode, struct file * file, struct vm_area_struct * vma) +-#endif +-{ +- vm_t *vm = (vm_t *)file->private_data; +- UNUSED(vm); +- return -EINVAL; +-} +- +- +-/************************************************************************/ +-/* Status reporting: /proc code */ +-/************************************************************************/ +- +- int +-plex86_read_procmem(char *buf, char **start, off_t offset, +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,4,0) +- int len +-#else +- int len, int unused +-#endif +- ) +-{ +- unsigned i; +- len = 0; +- len += sprintf(buf, "monitor-->host interrupt reflection counts\n"); +- for (i=0; i<256; i++) { +- int count; +- count = atomic_read( &interruptRedirCount[i] ); +- if (count) +- len += sprintf(buf+len, " 0x%2x:%10u\n", i, count); +- } +- return(len); +-} +- +- +- int +-retrieveKernelModulePages(void) +-{ +- /* +- * Retrieve start address and size of this module. +- * +- * Note that with old kernels, we cannot access the module info (size), +- * hence we rely on the fact that Linux lets at least one page of +- * virtual address space unused after the end of the module. +- */ +-#ifdef THIS_MODULE +- Bit32u driverStartAddr = (Bit32u) THIS_MODULE; +- unsigned size = THIS_MODULE->size; +-#else +- Bit32u driverStartAddr = (Bit32u) &mod_use_count_; +- unsigned size = 0; /* Actual size determined below */ +-#endif +- Bit32u driverStartAddrPageAligned = driverStartAddr & ~0xfff; +- +- int nPages; +- +- if (driverStartAddr != driverStartAddrPageAligned) { +- /* Pretend this kernel module starts at the beginning of the page. */ +- /* If size is known, we have to add the extra offset from the beginning +- * of the page. +- */ +- if (size) +- size += (driverStartAddr & 0xfff); +- } +- +- nPages = retrievePhyPages(kernelModulePages.ppi, Plex86MaxKernelModulePages, +- (void *) driverStartAddrPageAligned, size); +- if (nPages == 0) { +- printk(KERN_ERR "plex86: retrieveKernelModulePages: retrieve returned error.\n"); +- return( 0 ); /* Error. */ +- } +- printk(KERN_WARNING "plex86: %u monitor pages located\n", nPages); +- +- kernelModulePages.startOffset = driverStartAddr; +- kernelModulePages.startOffsetPageAligned = driverStartAddrPageAligned; +- kernelModulePages.nPages = nPages; +- return( 1 ); /* OK. */ +-} +- +- +- unsigned +-retrievePhyPages(Bit32u *page, int max_pages, void *addr_v, unsigned size) +-{ +- /* +- * Grrr. There doesn't seem to be an exported mechanism to retrieve +- * the physical pages underlying a vmalloc()'ed area. We do it the +- * hard way ... +- */ +- pageEntry_t *host_pgd; +- Bit32u host_cr3; +- Bit32u addr; // start_addr; +- unsigned n_pages; +- int i; +- +- addr = (Bit32u) addr_v; +- if ( addr & 0xfff ) { +- printk(KERN_ERR "plex86: retrievePhyPages: not page aligned!\n"); +- return 0; +- } +- +- if (!addr) { +- printk(KERN_ERR "plex86: retrievePhyPages: addr NULL!\n"); +- return 0; +- } +- +- if (size == 0) { +- /* Size unknown. Determine by cycling through page tables until +- * we find one which is not present. We will assume that means +- * the end of the data structure. Set the number of pages to +- * cycle through, to one more than the maximum requested. This +- * way we'll look through enough pages. +- */ +- n_pages = max_pages + 1; +- } +- else { +- n_pages = BytesToPages(size); +- if ( n_pages > max_pages ) { +- printk(KERN_ERR "plex86: retrievePhyPages: n=%u > max=%u\n", +- n_pages, max_pages); +- return 0; +- } +- } +- +- asm volatile ("movl %%cr3, %0" : "=r" (host_cr3)); +- host_pgd = (pageEntry_t *)(phys_to_virt(host_cr3 & ~0xfff)); +- +- for (i = 0; i < n_pages; i++) { +- Bit32u laddr; +- unsigned long lpage; +- pgd_t *pgdPtr; pmd_t *pmdPtr; pte_t *ptePtr; +- pgd_t pgdVal; pmd_t pmdVal; pte_t pteVal; +- +- laddr = KERNEL_OFFSET + ((Bit32u) addr); +- +- lpage = VMALLOC_VMADDR(laddr); +- +- /* About to traverse the page tables. We need to lock others +- * out of them briefly. Newer Linux versions can do a fine-grained +- * lock on the page tables themselves. Older ones have to do +- * a "big kernel lock". +- */ +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,3,10) +- spin_lock(&init_mm.page_table_lock); +-#else +- lock_kernel(); /* Big kernel lock. */ +-#endif +- pgdPtr = pgd_offset(&init_mm, lpage); +- pmdPtr = pmd_offset(pgdPtr, lpage); +- ptePtr = pte_offset(pmdPtr, lpage); +- +- pgdVal = *pgdPtr; +- pmdVal = *pmdPtr; +- pteVal = *ptePtr; +- +-#if LINUX_VERSION_CODE >= VERSION_CODE(2,3,10) +- spin_unlock(&init_mm.page_table_lock); +-#else +- unlock_kernel(); /* Big kernel unlock. */ +-#endif +- +- if ( !(pgdVal.pgd & 1) || +- !(pmdVal.pmd & 1) || +- !(pteVal.pte_low & 1) ) { +- if (size == 0) +- return i; /* Report number of pages until area ended. */ +- printk(KERN_ERR "plex86: retrievePhyPages: " +- "PDE.P==0: i=%u, n=%u laddr=0x%x\n", i, n_pages, laddr); +- return 0; /* Error, ran into unmapped page in memory range. */ +- } +- +- /* Abort if our page list is too small. */ +- if (i >= max_pages) { +- printk(KERN_WARNING "plex86: page list is too small!\n"); +- printk(KERN_WARNING "plex86: n_pages=%u, max_pages=%u\n", +- n_pages, max_pages); +- return 0; +- } +- /* Get physical page address for this virtual page address. */ +- page[i] = pte_val(pteVal) >> 12; +- /* Increment to the next virtual page address. */ +- addr += 4096; +- } +- return(n_pages); +-} +- +- +- +-/************************************************************************ +- * The requisite host-specific functions. An implementation of each of +- * these functions needs to be offered for each host-XYZ.c file. +- ************************************************************************/ +- +- +- unsigned +-hostOSIdle(void) +-{ +- if (NEED_RESCHED) +- schedule(); +- +- /* return !current_got_fatal_signal(); */ +- return( ! signal_pending(current) ); +-} +- +- void * +-hostOSAllocZeroedMem(unsigned long size) +-{ +- void *ptr; +- +- ptr = vmalloc(size); +- if ( ((Bit32u) ptr) & 0x00000fff ) +- return( 0 ); /* Error. */ +- +- /* Zero pages. This also demand maps the pages in, which we need +- * since we'll cycle through all the pages to get the physical +- * address mappings. +- */ +- mon_memzero(ptr, size); +- return( ptr ); +-} +- +- void +-hostOSFreeMem(void *ptr) +-{ +- vfree(ptr); +-} +- +- void * +-hostOSAllocZeroedPage(void) +-{ +- return( (void *) get_zeroed_page(GFP_KERNEL) ); +-} +- +- void +-hostOSFreePage(void *ptr) +-{ +- free_page( (Bit32u)ptr ); +-} +- +- +- unsigned +-hostOSGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr, unsigned size) +-{ +- return( retrievePhyPages(page, max_pages, ptr, size) ); +-} +- +- Bit32u +-hostOSGetAllocedPagePhyPage(void *ptr) +-{ +- if (!ptr) return 0; +- /* return MAP_NR(ptr); */ +- return(__pa(ptr) >> PAGE_SHIFT); +-} +- +- void +-hostOSPrint(char *fmt, ...) +-{ +-#warning "Fix hostPrint" +-#if 0 +- va_list args; +- int ret; +- unsigned char buffer[256]; +- +- va_start(args, fmt); +- ret = mon_vsnprintf(buffer, 256, fmt, args); +- if (ret == -1) { +- printk(KERN_ERR "plex86: hostPrint: vsnprintf returns error.\n"); +- } +- else { +- printk(KERN_WARNING "plex86: %s\n", buffer); +- } +-#endif +-} +- +- +- int +-hostOSConvertPlex86Errno(unsigned ret) +-{ +- switch (ret) { +- case 0: return(0); +- case Plex86ErrnoEBUSY: return(EBUSY); +- case Plex86ErrnoENOMEM: return(ENOMEM); +- case Plex86ErrnoEFAULT: return(EFAULT); +- case Plex86ErrnoEINVAL: return(EINVAL); +- case Plex86ErrnoEACCES: return(EACCES); +- case Plex86ErrnoEAGAIN: return(EAGAIN); +- default: +- printk(KERN_ERR "plex86: ioctlAllocVPhys: case %u\n", ret); +- return(EINVAL); +- } +-} +- +- +- Bit32u +-hostOSKernelOffset(void) +-{ +- return( KERNEL_OFFSET ); +-} +- +- void +-hostOSModuleCountReset(vm_t *vm, void *inode, void *filp) +-{ +-#if LINUX_VERSION_CODE < VERSION_CODE(2,4,0) +- while (MOD_IN_USE) { +- MOD_DEC_USE_COUNT; +- } +- +- MOD_INC_USE_COUNT; /* bump back to 1 so release can decrement */ +-#endif +-} +- +- unsigned long +-hostOSCopyFromUser(void *to, void *from, unsigned long len) +-{ +- return( copy_from_user(to, from, len) ); +-} +- +- unsigned long +-hostOSCopyToUser(void *to, void *from, unsigned long len) +-{ +- return( copy_to_user(to, from, len) ); +-} +- +- Bit32u +-hostOSGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr, +- Bit32u *ppi, Bit32u *kernelAddr) +-{ +- int ret; +- struct page **pagePtr; +- struct page *page; +- +- pagePtr = (struct page **) osSpecificPtr; +- ret = get_user_pages(current, +- current->mm, +- (unsigned long) userAddr, +- 1, /* 1 page. */ +- 1, /* 'write': intent to write. */ +- 0, /* 'force': ? */ +- pagePtr, +- NULL /* struct vm_area_struct *[] */ +- ); +- if (ret != 1) { +- printk(KERN_ERR "plex86: hostGetAndPinUserPages: failed.\n"); +- return(0); /* Error. */ +- } +- +- page = *pagePtr; /* The returned "struct page *" value. */ +- +- /* Now that we have a list of "struct page *", one for each physical +- * page of memory of the user space process's requested area, we can +- * calculate the physical page address by simple pointer arithmetic +- * based on "mem_map". +- */ +- *ppi = page - mem_map; +- if (kernelAddr) { +- /* Caller wants a kernel address returned which maps to this physical +- * address. +- */ +- *kernelAddr = (Bit32u) kmap( page ); +-#warning "FIXME: Check return value here." +-#warning "Also, conditionally compile for version and high memory support." +- } +- return(1); /* OK. */ +-} +- +- void +-hostOSUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr, +- Bit32u ppi, Bit32u *kernelAddr, unsigned dirty) +-{ +-#if 0 +- /* Here is some sample code from Linux 2.4.18, mm/memory.c:__free_pte() */ +- struct page *page = pte_page(pte); +- if ((!VALID_PAGE(page)) || PageReserved(page)) +- return; +- if (pte_dirty(pte)) +- set_page_dirty(page); +- free_page_and_swap_cache(page); +-#endif +- +- struct page *page; +- +- page = (struct page *) osSpecificPtr; +- /* If a kernel address is passed, that means that previously we created +- * a mapping for this physical page in the kernel address pace. +- * We should unmap it. Only really useful for pages allocated from +- * high memory. +- */ +- if (kernelAddr) +- kunmap(page); +- +- /* If the page was dirtied due to the guest running in the VM, we +- * need to tell the kernel about that since it is not aware of +- * the VM page tables. +- */ +- if (dirty) +- set_page_dirty(page); +- +- /* Release/unpin the page. */ +- put_page(page); +-} +- +- void +-hostOSInstrumentIntRedirCount(unsigned interruptVector) +-{ +- atomic_inc( &interruptRedirCount[interruptVector] ); +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/host-netbsd.c bochs-2.0.2+20030829/plex86/kernel/host-netbsd.c +--- bochs-2.0.2+20030829.old/plex86/kernel/host-netbsd.c 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/host-netbsd.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,566 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * +- * Copyright (C) 2000 Frank van der Linden (fvdl@wasabisystems.com) +- * +- * host-netbsd.c: NetBSD-specific code for kernel module. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +-/* XXXX stuff that conflicts with NetBSD namespace */ +- +-#define timer_t __bsd_timer_t +-#define write_eflags __netbsd_write_eflags +-#define read_eflags __netbsd_read_eflags +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#undef NETBSD_PLEX86_DEBUG +- +-#if __NetBSD_Version__ > 105009900 +-#include +-#include +-#else +-#include +-#endif +- +-#undef timer_t +-#undef write_eflags +-#undef read_eflags +- +-#include "plex86.h" +-#define IN_HOST_SPACE +-#include "monitor.h" +- +-int plex86_open(dev_t dev, int oflags, int devtype, struct proc *p); +-int plex86_close(dev_t dev, int cflags, int devtype, struct proc *p); +-paddr_t plex86_mmap(dev_t dev, off_t offset, int length); +-int plex86_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, +- struct proc *p); +- +-static int plex86_handle(struct lkm_table *, int); +-static vm_t *find_vm(struct proc *); +-static void register_vm(vm_t *, struct proc *); +-static void unregister_all(void); +-#if 0 +-static void unregister_vm(vm_t *, struct proc *); +-#endif +- +-static unsigned retrieve_phy_pages(Bit32u *, int, void *, unsigned, int); +- +-static struct cdevsw plex86dev = { +- plex86_open, plex86_close, +- (dev_type_read((*))) enodev, (dev_type_write((*))) enodev, +- plex86_ioctl, (dev_type_stop((*))) enodev, 0, +- seltrue, plex86_mmap, 0 +-}; +- +-static struct plex86_softc { +- int sc_open; +-} plex86sc; +- +-MOD_DEV("plex86", LM_DT_CHAR, -1, &plex86dev) +- +-monitor_pages_t monitor_pages; +- +-/* +- * Hash table stuff to maintain proc <-> vm mapping. +- * 23 entries should be plenty.. unless someone plans to run more than +- * 23 guest OSs.. +- * +- * Note that a process can only open the device once with this scheme. +- */ +- +-LIST_HEAD(plex86_hashhead, plex86_vmentry); +- +-struct plex86_vmentry { +- pid_t vm_pid; +- vm_t *vm_vm; +- LIST_ENTRY(plex86_vmentry) vm_entry; +-}; +- +-struct plex86_hashhead *plex86_hashtbl; +-u_long plex86_hashmask; +- +-#define PLEX86_VMHASHSIZE 23 +-#define PLEX86_VMHASH(p) ((u_long)((p)->p_pid) & plex86_hashmask) +- +-int +-plex86_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) +-{ +- DISPATCH(lkmtp, cmd, ver, plex86_handle, plex86_handle, plex86_handle) +-} +- +-static int +-plex86_handle(struct lkm_table *lkmtp, int cmd) +-{ +- int error = 0; +- +- switch (cmd) { +- case LKM_E_LOAD: +- if (lkmexists(lkmtp)) +- return EEXIST; +- monitor_pages.startOffset = lkmtp->area; +- monitor_pages.startOffsetPageAligned = +- monitor_pages.startOffset & 0xfffff000; +- monitor_pages.n_pages = lkmtp->size / PAGE_SIZE; +- if (retrieve_phy_pages(monitor_pages.page, +- PLEX86_MAX_MONITOR_PAGES, (void *)lkmtp->area, +- lkmtp->size, 0) == 0) { +- log(LOG_WARNING, "plex86: could not store physical " +- "addresses for monitor pages\n"); +- return EIO; +- } +-#if __NetBSD_Version__ > 105009900 +- plex86_hashtbl = hashinit(PLEX86_VMHASHSIZE, HASH_LIST, +- M_DEVBUF, M_WAITOK, &plex86_hashmask); +-#else +- plex86_hashtbl = hashinit(PLEX86_VMHASHSIZE, M_DEVBUF, +- M_WAITOK, &plex86_hashmask); +-#endif +- if (!hostModuleInit()) { +- log(LOG_WARNING, "hostModuleInit error\n"); +- error = EINVAL; +- } +- +- break; +- +- case LKM_E_UNLOAD: +- if (plex86sc.sc_open != 0) +- return EBUSY; +- free(plex86_hashtbl, M_DEVBUF); +- break; +- +- case LKM_E_STAT: +- break; +- +- default: +- error = EIO; +- break; +- } +- return error; +-} +- +-int +-plex86_open(dev_t dev, int oflags, int devtype, struct proc *p) +-{ +- vm_t *vm; +- +- if (suser(p->p_ucred, &p->p_acflag) != 0) +- return EPERM; +- +- vm = find_vm(p); +- if (vm == NULL) { +- vm = malloc(sizeof (vm_t), M_DEVBUF, M_WAITOK); +- if (vm == NULL) +- return EIO; +- memset(vm, 0, sizeof(vm_t)); +- register_vm(vm, p); +- plex86sc.sc_open++; +- } else +- return EBUSY; +- +- /* Kernel independent device open code. */ +- hostDeviceOpenInit(vm); +- +-#ifdef NETBSD_PLEX86_DEBUG +- printf("plex86: pid %u opened device, vm %p\n", p->p_pid, vm); +-#endif +- return 0; +-} +- +-int +-plex86_close(dev_t dev, int cflags, int devtype, struct proc *p) +-{ +- unregister_all(); +- plex86sc.sc_open = 0; +-#ifdef NETBSD_PLEX86_DEBUG +- printf("plex86: pid %u closed device\n", p->p_pid); +-#endif +- return 0; +-} +- +-paddr_t +-plex86_mmap(dev_t dev, off_t offset, int prot) +-{ +- struct proc *p = curproc; +- vm_t *vm; +- int page; +- off_t endguestoff; +- +- vm = find_vm(p); +- if (vm == NULL) +- return ENXIO; +-#if 1 +-#warning "kludge to mmap message buffer" +- endguestoff = (off_t)(vm->pages.guest_n_megs * 1024 * 1024); +- if (offset >= endguestoff && prot == PROT_READ) { +- page = (offset - endguestoff) / PAGE_SIZE; +- return vm->pages.log_buffer[page]; +- } +-#endif +- +- page = offset / PAGE_SIZE; +- if (page < 0 || page > vm->pages.guest_n_pages) { +- log(LOG_WARNING, "plex86: mmap: offset %lx out of range\n", +- (unsigned long)offset); +- return -1; +- } +- +- return vm->pages.guest[page]; +-} +- +-int +-plex86_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, +- struct proc *p) +-{ +- int error; +- vm_t *vm; +- +- vm = find_vm(p); +- if (vm == NULL) +- return EINVAL; +- +- switch (cmd) { +- case PLEX86_ALLOCVPHYS: +- { +- unsigned long arg = *((unsigned long*)data); +- guest_cpu_t guest_cpu; +- +- if (vm->mon_state != MON_STATE_UNINITIALIZED || +- vm->pages.guest_n_megs != 0) +- return EBUSY; +- printf("plex86_ioctl: ALLOCVPHYS: requested size %lu\n", +- arg); +- if (arg > PLEX86_MAX_PHY_MEGS || arg < 4 || (arg & ~0x3) != arg) +- return EINVAL; +- +- /* Allocate memory */ +- error = allocVMPages(vm, arg); +- if (error != 0) { +- log(LOG_WARNING, "plex86: allocVMPages failed (%d)\n", +- error); +- return ENOMEM; +- } +- +- if (init_guest_phy_mem(vm) != 0) { +- log(LOG_ERR, "plex86: init_guest_phy_mem failed\n"); +- unallocVMPages(vm); +- return EFAULT; +- } +- +- getCpuResetValues(&guest_cpu); +- log(LOG_WARNING, "plex86: cpu.cr0 = 0x%x\n", guest_cpu.cr0); +- if (!init_monitor(vm, 0, 0, &guest_cpu) || +- !setGuestCPU(vm, 0, &guest_cpu) || +- !mapMonitor(vm, guest_cpu.eflags, 0)) { +- log(LOG_ERR, "plex86: init_monitor failed\n"); +- unallocVMPages(vm); +- return EFAULT; +- } +- break; +- } +- +- case PLEX86_TEARDOWN: +- unallocVMPages(vm); +- break; +- +- case PLEX86_ALLOCINT: +- return EINVAL; +- case PLEX86_RELEASEINT: +- return EINVAL; +- case PLEX86_PRESCANDEPTH: +- { +- unsigned long arg = *(unsigned long *)data; +- +- if ((arg < PrescanDepthMin) || (arg > PrescanDepthMax)) { +- log(LOG_WARNING, "plex86: Requested prescan depth %lu" +- " out of range [%u..%u]\n", arg, PrescanDepthMin, +- PrescanDepthMax); +- return EINVAL; +- } +- vm->prescanDepth = (unsigned)arg; +- break; +- } +- case PLEX86_SETINTR: +- ioctlSetIntr(vm, *(unsigned long *)data); +- break; +- case PLEX86_SET_A20: +- { +- unsigned long arg = *(unsigned long *)data; +- if (!ioctlSetA20E(vm, arg)) +- return EINVAL; +- break; +- } +- case PLEX86_MESSAGEQ: +- { +- vm_messages_t msg; +- +- if (vm->mon_state != MON_STATE_RUNNABLE) +- return EINVAL; +- +- error = copyin(*(void **)data, &msg.header, sizeof msg.header); +- if (error != 0) +- return error; +- +- if ((msg.header.msg_len + sizeof(msg.header)) > sizeof(msg)) +- return EINVAL; +- +- if (msg.header.msg_len != 0) { +- error = copyin(&((vm_messages_t *)*(void **)data)->msg, +- &msg.msg, msg.header.msg_len); +- if (error != 0) +- return error; +- } +- +-#warning "deal with LDT %gs and %fs that the NetBSD kernel uses" +- /* XXXX */ +- __asm("movl $0, %eax"); +- __asm("movl %eax, %gs"); +- __asm("movl %eax, %fs"); +- +- if (ioctlMessageQ(vm, &msg)) { +- log(LOG_WARNING, "plex86: ioctlMessageQ failed\n"); +- return EINVAL; +- } +- +- error = copyout(&msg, *(void **)data, +- sizeof (msg.header) + msg.header.msg_len); +- return error; +- } +- case PLEX86_RESET: +- break; +- case PLEX86_PHYMEM_MOD: +- break; +- case PLEX86_FORCE_INT: +- if (vm->mon_state != MON_STATE_RUNNABLE) +- return -EINVAL; +- vm->dbg_force_int = 0x100 | (unsigned)data; +- break; +- case PLEX86_PRESCANRING3: +- { +- unsigned long arg = *(unsigned long *)data; +- if (arg > PrescanRing3On) { +- log(LOG_WARNING, +- "plex86: Requested PrescanRing3 val(%lu) OOB\n", +- arg); +- return EINVAL; +- } +- vm->prescanRing3 = arg; +- break; +- } +- case PLEX86_GENERIC: +- return 0; +- +- default: +- log(LOG_WARNING, "plex86: unknown ioctl %lx\n", cmd); +- return EINVAL; +- } +- return 0; +-} +- +-static void +-register_vm(vm_t *vm, struct proc *p) +-{ +- struct plex86_hashhead *php; +- struct plex86_vmentry *vhp; +- +- php = &plex86_hashtbl[PLEX86_VMHASH(p)]; +-#ifdef DIAGNOSTIC +- for (vhp = php->lh_first; vhp != NULL; vhp = vhp->vm_entry.le_next) { +- if (vhp->vm_pid == p_pid) +- panic("plex86: vm already registered, pid %u\n", +- p->pid); +- } +-#endif +- vhp = malloc(sizeof (struct plex86_vmentry), M_DEVBUF, M_WAITOK); +- vhp->vm_pid = p->p_pid; +- vhp->vm_vm = vm; +- LIST_INSERT_HEAD(php, vhp, vm_entry); +-} +- +-#if 0 +-static void +-unregister_vm(vm_t *vm, struct proc *p) +-{ +- struct plex86_hashhead *php; +- struct plex86_vmentry *vhp; +- +- php = &plex86_hashtbl[PLEX86_VMHASH(p)]; +- for (vhp = php->lh_first; vhp != NULL; vhp = vhp->vm_entry.le_next) { +- if (vhp->vm_pid == p->p_pid) { +- LIST_REMOVE(vhp, vm_entry); +- free(vhp->vm_vm, M_DEVBUF); +- free(vhp, M_DEVBUF); +- break; +- } +- } +-} +-#endif +- +-static void +-unregister_all(void) +-{ +- int i; +- struct plex86_hashhead *php; +- struct plex86_vmentry *vhp; +- +- for (i = 0; i < PLEX86_VMHASHSIZE; i++) { +- php = &plex86_hashtbl[i]; +- for (vhp = php->lh_first; vhp != NULL; +- vhp = vhp->vm_entry.le_next) { +-#ifdef NETBSD_PLEX86_DEBUG +- printf("plex86: unregister vm %p, pid %u\n", +- vhp->vm_vm, vhp->vm_pid); +-#endif +- LIST_REMOVE(vhp, vm_entry); +- free(vhp->vm_vm, M_DEVBUF); +- free(vhp, M_DEVBUF); +- } +- } +-} +- +-static vm_t * +-find_vm(struct proc *p) +-{ +- struct plex86_hashhead *php; +- struct plex86_vmentry *vhp; +- +- php = &plex86_hashtbl[PLEX86_VMHASH(p)]; +- for (vhp = php->lh_first; vhp != NULL; vhp = vhp->vm_entry.le_next) { +- if (vhp->vm_pid == p->p_pid) +- return vhp->vm_vm; +- } +- +- return NULL; +-} +- +-static unsigned +-retrieve_phy_pages(Bit32u *page, int max_pages, void *addr_v, unsigned size, +- int aligned) +-{ +- Bit32u start_addr; +- unsigned n_pages, i; +- +- if (!aligned) +- start_addr = (Bit32u)addr_v & ~(PAGE_SIZE-1); +- else { +- start_addr = (Bit32u)addr_v; +- if (start_addr & (PAGE_SIZE -1)) { +- log(LOG_WARNING, "plex86: retrieve_phy_pages: address " +- "%p not aligned\n", addr_v); +- return 0; +- } +- } +- +- n_pages = (size + PAGE_SIZE - 1) / PAGE_SIZE; +- if (n_pages > max_pages) { +- log(LOG_WARNING, "plex86: retrieve_phy_pages: page list " +- "too small\n"); +- return 0; +- } +- +- for (i = 0; i < n_pages; i++) { +- page[i] = vtophys((vaddr_t)start_addr) / PAGE_SIZE; +- start_addr += PAGE_SIZE; +- } +- +- return n_pages; +-} +- +-unsigned +-host_idle(void) +-{ +- if (want_resched) +- yield(); +- return (CURSIG(curproc) == 0); +-} +- +-void * +-host_alloc(unsigned long size) +-{ +- /* +- * XXX - it wants this page-aligned apparently. +- */ +- if (size <= (PAGE_SIZE / 2)) +- size = PAGE_SIZE; +- return malloc(size, M_DEVBUF, M_WAITOK); +-} +- +-void +-host_free(void *ptr) +-{ +- free(ptr, M_DEVBUF); +-} +- +-unsigned +-host_map(Bit32u *page, int max_pages, void *ptr, unsigned size) +-{ +- return retrieve_phy_pages(page, max_pages, ptr, size, 1); +-} +- +-void * +-host_alloc_page(void) +-{ +- return malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK); +-} +- +-void +-host_free_page(void *ptr) +-{ +- return free(ptr, M_DEVBUF); +-} +- +-Bit32u +-host_map_page(void *ptr) +-{ +- Bit32u u; +- +- if (ptr == NULL) +- return 0; +- u = vtophys(ptr) / PAGE_SIZE; +- /* printf("host_map_page(%p) -> %x\n", ptr, u); */ +- return u; +-} +- +-void +-hostprint(char *fmt, ...) +-{ +- va_list args; +- int ret; +- unsigned char buffer[256]; +- +- va_start(args, fmt); +- ret = mon_vsnprintf(buffer, 256, fmt, args); +- if (ret == -1) +- log(LOG_WARNING, +- "plex86: hostprint: vsnprintf returns error.\n"); +- else +- log(LOG_WARNING, "plex86: %s\n", buffer); +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/host-null.c bochs-2.0.2+20030829/plex86/kernel/host-null.c +--- bochs-2.0.2+20030829.old/plex86/kernel/host-null.c 2003-01-10 04:27:51.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/host-null.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,161 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * host-null.c: host OS specific stubs. These provide a reference for +- * ports of plex86 to various host OSes. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#include "plex86.h" +-#define IN_HOST_SPACE +-#include "monitor.h" +- +-/* Note: for comments on what various functions are expected to do, as +- * well as a reference implemntation, read the 'host-linux.c' file. +- * It's likely the most up-to-date. +- */ +- +- +-/* OS specific includes here. */ +- +- +-/* Some declarations for the entry points etc here. */ +- +- +- +- +-kernelModulePages_t kernelModulePages; +- +-#define NULL 0 +- +- int +-main(int argc, char *argv[]) +-{ +- vm_t *vm = NULL; +- +- hostModuleInit(); +- hostDeviceOpen(vm); +- hostIoctlGeneric(vm, NULL, NULL, 0, 0); +- return(0); +-} +- +- void +-hostOSReservePhyPages(vm_t *vm, Bit32u *hostPhyPages, unsigned nPages) +-{ +-} +- +- void +-hostOSUnreservePhyPages(vm_t *vm, Bit32u *hostPhyPages, unsigned nPages) +-{ +-} +- +- +- +- unsigned +-hostOSIdle(void) +-{ +- return 0; +-} +- +- void * +-hostOSAllocZeroedMem(unsigned long size) +-{ +- return 0; +-} +- +- void +-hostOSFreeMem(void *ptr) +-{ +-} +- +- void * +-hostOSAllocZeroedPage(void) +-{ +- return 0; +-} +- +- void +-hostOSFreePage(void *ptr) +-{ +-} +- +- +- unsigned +-hostOSGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr, unsigned size) +-{ +- return 0; +-} +- +- Bit32u +-hostOSGetAllocedPagePhyPage(void *ptr) +-{ +- return 0; +-} +- +- void +-hostOSPrint(char *fmt, ...) +-{ +-} +- +- +- int +-hostOSConvertPlex86Errno(unsigned ret) +-{ +- return 0; +-} +- +- +- Bit32u +-hostOSKernelOffset(void) +-{ +- return 0; +-} +- +- void +-hostOSModuleCountReset(vm_t *vm, void *inode, void *filp) +-{ +-} +- +- unsigned long +-hostOSCopyFromUser(void *to, void *from, unsigned long len) +-{ +- return 0; +-} +- +- unsigned long +-hostOSCopyToUser(void *to, void *from, unsigned long len) +-{ +- return 0; +-} +- +- Bit32u +-hostOSGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr, +- Bit32u *ppi, Bit32u *kernelAddr) +-{ +- return 0; +-} +- +- void +-hostOSUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr, +- Bit32u ppi, Bit32u *kernelAddr, unsigned dirty) +-{ +-} +- +- void +-hostOSInstrumentIntRedirCount(unsigned interruptVector) +-{ +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/include/descriptor2.h bochs-2.0.2+20030829/plex86/kernel/include/descriptor2.h +--- bochs-2.0.2+20030829.old/plex86/kernel/include/descriptor2.h 2003-01-01 17:32:05.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/include/descriptor2.h 1970-01-01 00:00:00.000000000 +0000 +@@ -1,66 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * descriptor2.h: defines for descriptors and selectors +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +-#ifndef __DESCRIPTOR2_H__ +-#define __DESCRIPTOR2_H__ +- +- +-typedef struct +-{ +- Bit16u offset_low; +- selector_t selector; +- unsigned count:5; +- unsigned RESERVED:3; +- unsigned type:5; +- unsigned dpl:2; +- unsigned p:1; +- Bit16u offset_high; +-} __attribute__ ((packed)) gate_t; +- +- +-#define SET_INT_GATE(d, S,O,P,DPL, D) {\ +- d.selector = (S);\ +- d.offset_high = (O) >> 16;\ +- d.offset_low = (O) & 0xffff;\ +- d.RESERVED = 0;\ +- d.type = ((D)<<3) | 0x6;\ +- d.dpl = (DPL);\ +- d.p = (P);\ +-} +- +-#define SET_TRAP_GATE(d, S,O,P,DPL, D) {\ +- d.selector = (S);\ +- d.offset_high = (O) >> 16;\ +- d.offset_low = (O) & 0xffff;\ +- d.RESERVED = 0;\ +- d.type = ((D)<<3) | 0x7;\ +- d.dpl = (DPL);\ +- d.p = (P);\ +-} +- +-typedef struct +-{ +- Bit32u offset; +- Bit16u selector; +-} __attribute ((packed)) far_jmp_info_t; +- +-#endif /* __DESCRIPTOR2_H__ */ +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/include/eflags.h bochs-2.0.2+20030829/plex86/kernel/include/eflags.h +--- bochs-2.0.2+20030829.old/plex86/kernel/include/eflags.h 2003-01-01 17:32:05.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/include/eflags.h 1970-01-01 00:00:00.000000000 +0000 +@@ -1,78 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * eflags.h: Bitfields of EFLAGS registers +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef __EFLAGS_H__ +-#define __EFLAGS_H__ +- +-/* +- * the eflags field looks like this: +- * bit: 0 1 2 3 4 5 6 7 8 9 A B C/D E F 10 11 12 13 14 15 16 +- * flg: CF 1 PF 0 AF 0 ZF SF TF IF DF OF IOPL NT 0 RF VM AC VIF VIP ID 0 +- */ +- +-#define FLG_CF (1<<0) +-#define FLG_PF (1<<2) +-#define FLG_AF (1<<4) +-#define FLG_ZF (1<<6) +-#define FLG_SF (1<<7) +-#define FLG_TF (1<<8) +-#define FLG_IF (1<<9) +-#define FLG_DF (1<<10) +-#define FLG_OF (1<<11) +-#define FLG_IOPL (3<<12) +-#define FLG_NT (1<<14) +-#define FLG_RF (1<<16) +-#define FLG_VM (1<<17) +-#define FLG_AC (1<<18) +-#define FLG_VIF (1<<19) +-#define FLG_VIP (1<<20) +-#define FLG_ID (1<<21) +- +- +-typedef union { +- struct { +- Bit8u cf:1; +- Bit8u R1:1; +- Bit8u pf:1; +- Bit8u R3:1; +- Bit8u af:1; +- Bit8u R5:1; +- Bit8u zf:1; +- Bit8u sf:1; +- Bit8u tf:1; +- Bit8u if_:1; +- Bit8u df:1; +- Bit8u of:1; +- Bit8u iopl:2; +- Bit8u nt:1; +- Bit8u R15:1; +- Bit8u rf:1; +- Bit8u vm:1; +- Bit8u ac:1; +- Bit8u vif:1; +- Bit8u vip:1; +- Bit8u id:1; +- Bit16u R31_22:10; +- } __attribute__ ((packed)) fields; +- Bit32u raw; +- } __attribute__ ((packed)) eflags_t; +- +-#endif /* __EFLAGS_H__ */ +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/include/guest_context.h bochs-2.0.2+20030829/plex86/kernel/include/guest_context.h +--- bochs-2.0.2+20030829.old/plex86/kernel/include/guest_context.h 2003-01-01 17:32:05.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/include/guest_context.h 1970-01-01 00:00:00.000000000 +0000 +@@ -1,59 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * guest_context.h: monitor stack frame after exception/interrupt +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef __GUEST_CONTEXT_H__ +-#define __GUEST_CONTEXT_H__ +- +-#include "eflags.h" +- +-/* This is the guest context (from ring3) pushed on the monitor stack (ring0) +- * during an exception/interrupt. Part is pushed automatically by the +- * CPU, part by the interrupt handling code. +- * +- * Values are pushed starting with the end of this structure, towards +- * the beginning, since stack pushes descend in address. +- */ +-typedef struct { +- Bit32u gs; +- Bit32u fs; +- Bit32u ds; +- Bit32u es; +- +- Bit32u edi; +- Bit32u esi; +- Bit32u ebp; +- Bit32u dummy_esp; +- Bit32u ebx; +- Bit32u edx; +- Bit32u ecx; +- Bit32u eax; +- +- Bit32u vector; +- Bit32u error; +- +- Bit32u eip; +- Bit32u cs; +- eflags_t eflags; +- Bit32u esp; +- Bit32u ss; +- } guest_context_t; +- +-#endif /* __GUEST_CONTEXT_H__ */ +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/include/monitor.h bochs-2.0.2+20030829/plex86/kernel/include/monitor.h +--- bochs-2.0.2+20030829.old/plex86/kernel/include/monitor.h 2003-01-10 04:27:51.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/include/monitor.h 1970-01-01 00:00:00.000000000 +0000 +@@ -1,709 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * monitor.h: main VM monitor defines +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef __MONITOR_H__ +-#define __MONITOR_H__ +- +-#if defined(__NetBSD__) || defined(__FreeBSD__) +-#include +-#else +-#include +-#endif +- +- +-#include "descriptor.h" +-#include "descriptor2.h" +-#include "tss.h" +-#include "paging.h" +-#include "eflags.h" +-#include "guest_context.h" +- +-#ifndef UNUSED +-# define UNUSED(x) ((void)(x)) +-#endif +- +- +-/* Method1: push event info (CPU pushes error code before) */ +-typedef struct +-{ +- Bit8u pushl; /* Always 0x68 == pushl */ +- Bit32u vector; /* Interrupt vector number */ +- Bit8u jmp; /* Always 0xe9 == jmp */ +- Bit32u reloc; /* Relative offset of destination */ +-} __attribute__ ((packed)) idt_method1_t; +- +-/* Method2: push a dummy error first, then event info */ +-typedef struct +-{ +- Bit8u pushla; /* Always 0x68 == pushl */ +- Bit32u dummy; /* Dummy error code */ +- Bit8u pushlb; /* Always 0x68 == pushl */ +- Bit32u vector; /* Interrupt vector number */ +- Bit8u jmp; /* Always 0xe9 == jmp */ +- Bit32u reloc; /* Relative offset of destination */ +-} __attribute__ ((packed)) idt_method2_t; +- +-typedef union +-{ +- idt_method1_t m1; +- idt_method2_t m2; +-} idt_stub_t; +- +- +-/* Nexus fields. This C structure maps to identical assembly */ +-/* fields in nexus.S. Make sure to update both! These fields */ +-/* are accessible to the nexus code during the transition from */ +-/* host<->guest and are stored in a single page. */ +- +-typedef struct { +- /* guest pointer to vm_t structure. */ +- void *vm; +- +- /* These fields are only used by the transition code. */ +- /* They hold all info necessary to switch back to the host. */ +- gdt_info_t host_gdt_info; +- gdt_info_t host_idt_info; +- far_jmp_info_t host_jmp_info; +- far_jmp_info_t host_stack_info; +- Bit16u host_ldt_sel; +- Bit16u host_tss_sel; +- Bit32u host_cr0; +- Bit32u host_cr2; +- Bit32u host_cr3; +- Bit32u host_cr4; +- +- /* These fields are filled by the host-side code, and used */ +- /* by the transition code. They contain all info necessary */ +- /* to switch to the monitor/guest address space. */ +- /* This info changes whenever the monitor migrates. */ +- gdt_info_t mon_gdt_info; +- gdt_info_t mon_idt_info; +- far_jmp_info_t mon_jmp_info; +- far_jmp_info_t mon_stack_info; +- Bit16u mon_ldt_sel; +- Bit16u mon_tss_sel; +- Bit32u mon_base; +- Bit32u mon_cr0; +- Bit32u mon_cr3; +- Bit32u mon_cr4; +- Bit32u mon_eflags; +- +- /* These fields contain info used by the transition code to */ +- /* create the temporary identity mapping. They never change. */ +- pageEntry_t transition_pde; +- pageEntry_t *transition_pde_p_host; +- pageEntry_t *transition_pde_p_mon; +- Bit32u transition_laddr; +-} __attribute__ ((packed)) nexus_t; +- +- +-/* For reference, the following describes where bits from the guest */ +-/* eflags register are stored/managed. */ +-/* */ +-/* Key: */ +-/* g: Flag value as requested by guest */ +-/* V: Virtualized flag value, as loaded in eflags when guest is executing */ +-/* ?: Unhandled yet, request of set bit causes panic for now */ +-/* */ +-/* === ======= ====== ======= ======= ======= */ +-/* |I|V|V|A|V|R|0|N|IO|O|D|I|T|S|Z|0|A|0|P|1|C| flag */ +-/* |D|I|I|C|M|F| |T|PL|F|F|F|F|F|F| |F| |F| |F| */ +-/* | |P|F| | | | | | | | | | | | | | | | | | | */ +-/* |g|?|?|g|V|g|g|g|VV|g|g|V|g|g|g|g|g|g|g|g|g| context->eflags */ +-/* | |?|?| |g| | | |gg| | |g| | | | | | | | | | veflags */ +- +-/* #define VirtualizedEflags 0x001a3200 */ +-#define VirtualizedEflags 0x001a3300 +- +- +-/* I define the 'nexus' as the set of data structures which */ +-/* must exist in the current linear guest address space. The */ +-/* host linear address space is not available while the current */ +-/* guest code is running, since we are using a completely */ +-/* different set of page mappings for the guest. However, */ +-/* at some point an exception/interrupt will occur. The */ +-/* interrupt mechanisms require that several structures exist in */ +-/* the current linear address space in order to service such */ +-/* an event. These data structures make up part of our VM, */ +-/* a thin layer which exists in the guest. Following is a */ +-/* list of what data structures compose this 'nexus': */ +-/* */ +-/* - IDT (max 2048 bytes) */ +-/* - GDT (max 65536 bytes) */ +-/* - LDT (max 65536 bytes) */ +-/* - TSS (max 8328 = 104 + 32 int redir + 8192 I/O permissions) */ +-/* - kernel stack page */ +-/* - transition code (host <--> guest) */ +-/* - interrupt handler stubs */ +-/* - Page Tables; PDE & PTE pages. */ +- +-/* +- * Sizes of various nexus data structures used by the monitor +- */ +- +-#define PLEX86_MAX_PHY_MEGS 32 +-#define PAGESIZE 4096 +- +-#define IDT_STUB_SIZE 15 +-#define BytesToPages(b) ( ((b)+4095) >> 12 ) +- +-#define MON_IDT_SIZE (8*256) +-#define MON_GDT_SIZE (8*512) +-#define MON_LDT_SIZE (8*1) +-#define MON_IDT_STUBS_SIZE (IDT_STUB_SIZE*256) +-#define MON_TSS_SIZE (104) +- +-#define MON_IDT_PAGES BytesToPages(MON_IDT_SIZE) +-#define MON_GDT_PAGES BytesToPages(MON_GDT_SIZE) +-#define MON_LDT_PAGES BytesToPages(MON_LDT_SIZE) +-#define MON_IDT_STUBS_PAGES BytesToPages(MON_IDT_STUBS_SIZE) +-#define MON_TSS_PAGES BytesToPages(MON_TSS_SIZE) +- +-#define MAX_MON_GUEST_PAGES (PLEX86_MAX_PHY_MEGS * 256) +-/* +++ MON_PAGE_TABLES is kind of random */ +-#define MON_PAGE_TABLES (10*((PLEX86_MAX_PHY_MEGS+3) >> 2)) +- +-#define MAX_VM_STRUCT_PAGES (68) +- +-#define LOG_BUFF_PAGES 1 +-#define LOG_BUFF_SIZE ((LOG_BUFF_PAGES)*4096) +- +-/* +- * Pages allocated for the VM by the host kernel driver. +- * N Megs of physical memory are allocated, per the user's +- * request, for the guest OS/application code. +- * Additionally, some other overhead pages are allocated +- * for structures such as the page directory, page tables, +- * and other virtualized facilities. +- */ +- +-typedef struct { +- /* requested size of the guest[] array in megs and pages */ +- unsigned guest_n_megs; +- unsigned guest_n_pages; +- unsigned guest_n_bytes; +- +- /* pages comprising the vm_t struct itself. */ +- Bit32u vm[MAX_VM_STRUCT_PAGES]; +- +- /* for the monitor's page directory */ +- Bit32u page_dir; +- +- /* for the monitor's page table */ +- Bit32u page_tbl[MON_PAGE_TABLES]; +- +- /* Map of the linear addresses of page tables currently */ +- /* mapped into the monitor space. */ +- Bit32u page_tbl_laddr_map; +- +- /* for the extra page table that maps our nexus code and structures */ +- Bit32u nexus_page_tbl; +- +- /* For the CPU state passed between user and kernel/monitor space. */ +- Bit32u guest_cpu; +- void *guest_cpu_hostOSPtr; +- +- /* We need a Page Table for identity mapping the transition code */ +- /* between host and monitor spaces. */ +- Bit32u transition_PT; +- +- Bit32u log_buffer[LOG_BUFF_PAGES]; +- void *log_buffer_hostOSPtr[LOG_BUFF_PAGES]; +- +- /* Physical addresses of host pages which comprise the actual */ +- /* monitor structures. These will be mapped into the current */ +- /* guest task's linear address space as well. */ +- Bit32u nexus; +- Bit32u idt[MON_IDT_PAGES]; +- Bit32u gdt[MON_GDT_PAGES]; +- Bit32u ldt[MON_LDT_PAGES]; +- Bit32u tss[MON_TSS_PAGES]; +- Bit32u idt_stubs[MON_IDT_STUBS_PAGES]; +- } vm_pages_t; +- +- +-typedef struct { +- pageEntry_t *page_dir; +- page_t *page_tbl; +- unsigned *page_tbl_laddr_map; +- page_t *nexus_page_tbl; +- guest_cpu_t *guest_cpu; +- page_t *transition_PT; +- unsigned char *log_buffer; +- Bit8u *code_phy_page; /* only use in mon space */ +- Bit8u *tmp_phy_page0; /* only use in mon space */ +- Bit8u *tmp_phy_page1; /* only use in mon space */ +- +- nexus_t *nexus; +- /* Pointer into the monitor stack, so we can easily retrieve the */ +- /* stack snapshot upon interrupt/exception. */ +- guest_context_t *guest_context; +- gate_t *idt; +- descriptor_t *gdt; +- descriptor_t *ldt; +- tss_t *tss; +- idt_stub_t *idt_stubs; +- } vm_addr_t; +- +- +-/* These bits define the possible usage and attributes assigned */ +-/* to a particular guest physical page. These are useful for keeping */ +-/* track of what kinds of system structures are contained in a page */ +-/* at a given time, and if the page has associated cached code */ +-/* information in the prescan logic. We can also tag particular */ +-/* pages with other more static attributes. */ +- +-typedef union { +- struct { +- Bit32u access_perm:2; /* */ +- Bit32u lmap_count:2; /* */ +- Bit32u ptbl:1; /* page table */ +- Bit32u pdir:1; /* page directory */ +- Bit32u spare0:1; /* (spare) */ +- Bit32u memMapIO:1; /* MemMapIO */ +- Bit32u RO:1; /* RO */ +- Bit32u allocated:1; /* Allocated */ +- Bit32u pinned:1; /* Pinned by host OS. */ +- Bit32u spare1:1; /* (spare) */ +- Bit32u laddr_backlink:20; /* 1st unvirtualized laddr backlink */ +- } __attribute__ ((packed)) fields; +- Bit32u raw; +- } __attribute__ ((packed)) phy_page_attr_t; +- +-typedef struct { +- phy_page_attr_t attr; +- Bit64u tsc; /* for comparing to CR3 timestamp counter */ +- +- Bit32u hostPPI; +- } __attribute__ ((packed)) phyPageInfo_t; +- +-/* Possible values of the access_perm field above. */ +-#define PagePermRW 0 +-#define PagePermRO 1 +-#define PagePermEmulate 2 +-#define PagePermNA PagePermEmulate /* No Access is synomym */ +- +- +-/* Bitmasks to access fields in structure above. */ +-#define PageUsagePTbl 0x010 +-#define PageUsagePDir 0x020 +- +-#define PageUsageMemMapIO 0x080 +-#define PageUsageRO 0x100 +-#define PageUsageAllocated 0x200 +-#define PageUsageSwappable 0x400 +- +-/* Group of attributes which retain their value, even when CR3 */ +-/* is reloaded and the page mappings are flushed. */ +-#define PageUsageSticky \ +- ( PageUsageMemMapIO | PageUsageRO | \ +- PageUsageAllocated | PageUsageSwappable ) +- +-/* Group of attributes which are not compatible with a Page Table */ +-/* occupying a physical page. */ +-#define PageBadUsage4PTbl \ +- ( PageUsagePDir | PageUsageMemMapIO | PageUsageRO ) +- +-/* Group of attributes which are not compatible with a Page Directory */ +-/* occupying a physical page. Keep in mind, when the PDir is marked, */ +-/* no other dynamic bits will be set. */ +-#define PageBadUsage4PDir \ +- ( PageUsageMemMapIO | PageUsageRO ) +- +-#define PageUsageCausesNA \ +- ( PageUsagePTbl | PageUsagePDir | PageUsageMemMapIO ) +-#define PageUsageCausesRO \ +- ( PageUsageRO ) +- +-#define PDEUnhandled 0x000001d8 +-#define PTEUnhandled 0x00000198 +- +- +-#define ExceptionDE 0 /* Divide Error (fault) */ +-#define ExceptionDB 1 /* Debug (fault/trap) */ +-#define ExceptionBP 3 /* Breakpoint (trap) */ +-#define ExceptionOF 4 /* Overflow (trap) */ +-#define ExceptionBR 5 /* BOUND (fault) */ +-#define ExceptionUD 6 +-#define ExceptionNM 7 +-#define ExceptionDF 8 +-#define ExceptionTS 10 +-#define ExceptionNP 11 +-#define ExceptionSS 12 +-#define ExceptionGP 13 +-#define ExceptionPF 14 +-#define ExceptionMF 16 +-#define ExceptionAC 17 +- +- +-#define CR0_PE (1<<0) +-#define CR0_MP (1<<1) +-#define CR0_EM (1<<2) +-#define CR0_TS (1<<3) +-#define CR0_ET (1<<4) +-#define CR0_NE (1<<5) +-#define CR0_WP (1<<16) +-#define CR0_AM (1<<18) +-#define CR0_NW (1<<29) +-#define CR0_CD (1<<30) +-#define CR0_PG (1<<31) +- +-/* +- * Complete state of the VM (Virtual Machine). +- */ +-typedef struct { +- Bit32u guestPhyMemAddr; /* Ptr to malloced memory from user space. */ +- +- /* Store eflags values of the guest which are virtualized to +- * run in the monitor +- */ +- eflags_t veflags; +- +- unsigned executeMethod; +- unsigned vmState; +- +- unsigned mon_request; +- unsigned guestFaultNo; +- Bit32u pinReqPPI; +- +- unsigned redirect_vector; +- +- Bit32u kernel_offset; +- +-#define MonitorSpace 0 +-#define UserSpace 1 +-#define HostSpace 2 +- +- volatile unsigned inMonFault; +- +- /* Extra info on aborts, especially when a message can't +- * be printed out +- */ +- unsigned abort_code; +- +- struct { +- Bit64u t0; /* TSC before excecution of guest code */ +- Bit64u cyclesElapsed; /* Cycles of guest execution */ +- unsigned a20Enable; /* A20 line enabled? */ +- Bit32u a20AddrMask; /* mask to apply to phy address */ +- Bit32u a20IndexMask; /* mask to apply to phy address */ +- } system; +- +- cpuid_info_t guestCPUIDInfo; +- +-/* This macro yields a physical address after applying the A20 line +- * enable mask to the original physical address. +- */ +-#define A20Addr(vm, paddr) ( (paddr) & ((vm)->system.a20AddrMask) ) +-#define A20PageIndex(vm, pi) ( (pi) & ((vm)->system.a20IndexMask) ) +- +- /* Keep an index of the next available Page Table */ +- unsigned ptbl_laddr_map_i; +- +- Bit32u mon_pde_mask; /* Upper 10 bits of monitor lin addr space */ +- Bit32u mon_pdi; /* Same value shifted down 22 bits. */ +- Bit64u vpaging_tsc; /* time stamp of last page mappings flush */ +- +- /* We need to keep track of what each of the guest's physical */ +- /* pages contains, and maintain some additional attributes. */ +- /* We determine which kinds of information reside in the page, */ +- /* dynamically. */ +- phyPageInfo_t pageInfo[MAX_MON_GUEST_PAGES]; +- +- /* This is a hack for now. I need to store the "struct page *" +- * information returned by get_user_pages() in the Linux kernel. +- * Should clean this up. +- */ +- void *hostStructPagePtr[MAX_MON_GUEST_PAGES]; +- +- /* A revolving queue, which stores information on guest physical memory +- * pages which are currently pinned. Only a certain number of pages +- * may be pinned at any one time. This is a really simplistic +- * strategy - when the Q is full, the page which was pinned the +- * longest time ago is unpinned to make room. It's a +- * "least recently pinned" strategy. +- */ +-#define MaxPhyPagesPinned 1024 /* 4Megs of pinned pages max per VM. */ +- struct { +- unsigned nEntries; /* Number of entries in table. */ +- unsigned tail; +- Bit32u ppi[MaxPhyPagesPinned]; /* Physical Page Index of pinned guest page. */ +- } guestPhyPagePinQueue; +- +- struct { +- volatile unsigned event; /* Any log event occurred. */ +- /* Inactive, OK to dump to host and change */ +- volatile unsigned locked; +- /* Number of times buffer wrapped since last print to kernel */ +- /* debug facility */ +- volatile unsigned offset; /* Current index within buffer */ +- volatile unsigned error; /* Error printing. (ex. string too long) */ +- } log_buffer_info; +- +- vm_pages_t pages; /* memory pages allocated by the host */ +- +- /* Host specific fields. These fields should NOT be accessed */ +- /* from code which may execute in either host or monitor/guest */ +- /* spaces, unless you need to _specifically_ manipulate a */ +- /* host-specific field. */ +- struct { +- vm_addr_t addr; /* addresses of data structures in host space */ +- void (*__host2mon)(void); /* Host to guest nexus entry point */ +- pageEntry_t nexus_pde; /* PDE pointing to nexus page table */ +- } host; +- +- /* Guest specific fields. These fields should NOT be accessed */ +- /* from code which may execute in either host or monitor/guest */ +- /* spaces, unless you need to _specifically_ manipulate a */ +- /* guest-specific field. */ +- struct { +- vm_addr_t addr; /* addresses of data structures in guest space */ +- void (*__mon2host)(void); /* monitor to host entry point */ +- } guest; +- } vm_t; +- +- +-extern char __nexus_start, __nexus_end, __mon_cs; +-extern char __host2mon, __mon2host, __handle_fault, __handle_int; +-extern char __ret_to_guest; +- +- +- +-/* +- * This structure describes the pages containing the code/data +- * of the monitor itself (inside the kernel module) +- */ +- +-#define Plex86MaxKernelModulePages 128 +- +-typedef struct { +- /* Virtual address space occupied by the kernel module. */ +- Bit32u startOffset; +- Bit32u startOffsetPageAligned; +- unsigned nPages; /* Number of pages. */ +- +- /* A list of the Physical Page Indeces of the pages comprising the +- * kernel module. A PPI is just the physical page address >> 12. +- */ +- Bit32u ppi[Plex86MaxKernelModulePages]; +- } kernelModulePages_t; +- +-extern kernelModulePages_t kernelModulePages; +-extern cpuid_info_t hostCpuIDInfo; +- +- +- +-#if !defined(IN_HOST_SPACE) && !defined(IN_MONITOR_SPACE) +-#error "No space defined for this file" +-#endif +- +- +-#if defined(IN_HOST_SPACE) || defined(IN_MONITOR_SPACE) +- +-void mon_memzero(void *ptr, int size); +-void mon_memcpy(void *dst, void *src, int size); +-void *mon_memset(void *s, unsigned c, unsigned n); +- +-/* +- * We need to set the monitor CS/DS base address so that the module pages, +- * which are mapped starting at linear address 'laddr' into the guest address +- * space, reside at the same offset relative to the monitor CS base as they +- * reside relative to the kernel CS base in the host address space. This way, +- * we can execute the (non-relocatable) module code within the guest address +- * space ... +- */ +-#define MON_BASE_FROM_LADDR(laddr) \ +- ((laddr) - kernelModulePages.startOffsetPageAligned) +- +- +-/* ============================================================ +- * These are the functions which are available in either of the +- * host or monitor/guest spaces. +- */ +- +- +-/* Access to label offsets in nexus.S... From the host address perspective */ +-#define HOST_NEXUS_OFFSET(vm, field) \ +- ( ((Bit32u)vm->host.addr.nexus) + \ +- (((Bit32u) &field) - ((Bit32u) &__nexus_start)) ) +- +-/* From the monitor/guest address perspective. */ +-#define MON_NEXUS_OFFSET(vm, field) \ +- ( ((Bit32u)vm->guest.addr.nexus) + \ +- (((Bit32u) &field) - ((Bit32u) &__nexus_start)) ) +- +- static __inline__ Bit64u +-vm_rdtsc(void) { +- Bit64u ret; +- asm volatile ( +- "rdtsc" +- : "=A" (ret) +- ); +- return ret; +- } +-#endif /* {HOST, MONITOR} */ +- +- +- +- +-#ifdef IN_HOST_SPACE +-/* ========================================================== +- * These are the functions which are available to the monitor +- * running in the host space. +- */ +- +- +-/* +- * Generate a software interrupt +- */ +- +-#define soft_int(n) \ +- asm volatile ( \ +- " movb %b0, __soft_int_vector \n\t" \ +- " jmp __soft_int_n \n\t" \ +- "__soft_int_n: \n\t" \ +- " sti \n\t" \ +- " .byte 0xcd \n\t" \ +- "__soft_int_vector: \n\t" \ +- " .byte 0x00 \n\t" \ +- : \ +- : "r" ((Bit8u) (n) ) \ +- : "memory" \ +- ) +- +-#define Plex86ErrnoEBUSY 1 +-#define Plex86ErrnoENOMEM 2 +-#define Plex86ErrnoEFAULT 3 +-#define Plex86ErrnoEINVAL 4 +-#define Plex86ErrnoEACCES 5 +-#define Plex86ErrnoEAGAIN 6 +- +-#define vm_save_flags(x) \ +- asm volatile("pushfl ; popl %0": "=g" (x): :"memory") +- +-#define vm_restore_flags(x) \ +- asm volatile("pushl %0 ; popfl": :"g" (x): "memory", "cc") +- +- +-int hostInitMonitor(vm_t *); +-unsigned hostMapMonitor(vm_t *); +-unsigned hostInitGuestPhyMem(vm_t *); +-void hostUnallocVmPages(vm_t *); +-int hostAllocVmPages(vm_t *, plex86IoctlRegisterMem_t *registerMsg); +-void hostInitShadowPaging(vm_t *vm); +-void hostDeviceOpen(vm_t *); +-unsigned hostModuleInit(void); +-unsigned hostGetCpuCapabilities(void); +-int hostIoctlGeneric(vm_t *vm, void *inode, void *filp, +- unsigned int cmd, unsigned long arg); +-int hostIoctlExecute(vm_t *vm, plex86IoctlExecute_t *executeMsg); +-int hostIoctlRegisterMem(vm_t *vm, plex86IoctlRegisterMem_t *registerMsg); +-void hostCopyGuestStateToUserSpace(vm_t *vm); +-void hostReleasePinnedUserPages(vm_t *vm); +-unsigned hostHandlePagePinRequest(vm_t *vm, Bit32u reqPPI); +- +-/* These are the functions that the host-OS-specific file of the +- * plex86 device driver must define. +- */ +-unsigned hostOSIdle(void); +-void *hostOSAllocZeroedMem(unsigned long size); +-void hostOSFreeMem(void *ptr); +-void *hostOSAllocZeroedPage(void); +-void hostOSFreePage(void *ptr); +-unsigned hostOSGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr, +- unsigned size); +-Bit32u hostOSGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr, +- Bit32u *ppi, Bit32u *kernelAddr); +-void hostOSUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr, +- Bit32u ppi, Bit32u *kernelAddr, unsigned dirty); +-Bit32u hostOSGetAllocedPagePhyPage(void *ptr); +-void hostOSPrint(char *fmt, ...); +-Bit32u hostOSKernelOffset(void); +-int hostOSConvertPlex86Errno(unsigned ret); +-void hostOSModuleCountReset(vm_t *vm, void *inode, void *filp); +-void hostOSInstrumentIntRedirCount(unsigned interruptVector); +-unsigned long hostOSCopyFromUser(void *to, void *from, unsigned long len); +-unsigned long hostOSCopyToUser(void *to, void *from, unsigned long len); +- +-#endif /* HOST Space */ +- +- +- +- +-#ifdef IN_MONITOR_SPACE +-/* ========================================================== +- * These are the functions which are available to the monitor +- * running in the monitor/guest space. +- */ +- +-void sysFlushPrintBuf(vm_t *); +-void sysRemapMonitor(vm_t *); +-int monprint(vm_t *, char *fmt, ...); +-int mon_vsnprintf(char *str, unsigned size, const char *fmt, +- va_list args); +-void resetPrintBuf(vm_t *); +- +-/* Translate from guest laddr to monitor laddr. */ +-#define Guest2Monitor(vm, laddr) ( ((Bit32u) (laddr)) - \ +- vm->guest.addr.nexus->mon_base ) +- +-void monpanic(vm_t *, char *fmt, ...) __attribute__ ((noreturn)); +-void monpanic_nomess(vm_t *); +- +-void toHostGuestFault(vm_t *, unsigned fault); +-void toHostPinUserPage(vm_t *, Bit32u ppi); +- +-void guestPageFault(vm_t *, guest_context_t *context, Bit32u cr2); +-void *open_guest_phy_page(vm_t *, Bit32u ppage_index, Bit8u *mon_offset); +-void close_guest_phy_page(vm_t *, Bit32u ppage_index); +- +-#define MapLinOK 0 +-#define MapLinMonConflict 1 +-#define MapLinAlreadyMapped 2 +-#define MapLinPPageOOB 3 +-#define MapLinException 4 +-#define MapLinEmulate 5 +-unsigned mapGuestLinAddr(vm_t *, Bit32u guest_laddr, +- Bit32u *guest_ppage_index, unsigned us, +- unsigned rw, Bit32u attr, Bit32u *error); +-unsigned addPageAttributes(vm_t *, Bit32u ppi, Bit32u attr); +-phyPageInfo_t *getPageUsage(vm_t *, Bit32u ppage_index); +-void virtualize_lconstruct(vm_t *, Bit32u l0, Bit32u l1, unsigned perm); +- +-unsigned getMonPTi(vm_t *, unsigned pdi, unsigned source); +-#define invlpg_mon_offset(mon_offset) \ +- asm volatile ("invlpg (%0)": :"r" (mon_offset): "memory") +- +-/* For now nothing, but we should conditionally compile in code +- * to panic when the expression is not true. +- */ +- +-#define VM_ASSERT(vm, expression) \ +- if ( !(expression) ) \ +- monpanic(vm, "Assertion (%s) failed at %s:%u", \ +- #expression, __FILE__, __LINE__) +- +-#define CLI() asm volatile ("cli": : : "memory") +-#define STI() asm volatile ("sti": : : "memory") +- +-#endif /* MONITOR Space. */ +- +-#endif /* __MONITOR_H__ */ +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/include/paging.h bochs-2.0.2+20030829/plex86/kernel/include/paging.h +--- bochs-2.0.2+20030829.old/plex86/kernel/include/paging.h 2003-01-01 17:32:05.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/include/paging.h 1970-01-01 00:00:00.000000000 +0000 +@@ -1,51 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * paging.h: defines for x86 paging structures +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef __PAGING_H__ +-#define __PAGING_H__ +- +-#define PG_D 0x00000040 +-#define PG_A 0x00000020 +- +-/* Page Directory/Table format */ +-typedef union { +- Bit32u raw; +- struct { +- Bit32u P:1; +- Bit32u RW:1; +- Bit32u US:1; +- Bit32u PWT:1; +- Bit32u PCD:1; +- Bit32u A:1; +- Bit32u D:1; +- Bit32u PS:1; +- Bit32u G:1; +- Bit32u avail:3; +- Bit32u base:20; +- } __attribute__ ((packed)) fields; +- } __attribute__ ((packed)) pageEntry_t; +- +-typedef union { +- Bit8u bytes[4096]; +- pageEntry_t pte[1024]; +- } page_t; +- +-#endif /* __PAGING_H__ */ +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/include/tss.h bochs-2.0.2+20030829/plex86/kernel/include/tss.h +--- bochs-2.0.2+20030829.old/plex86/kernel/include/tss.h 2003-01-01 17:32:05.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/include/tss.h 1970-01-01 00:00:00.000000000 +0000 +@@ -1,50 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * tss.h: defines for x86 hardware tasking structures +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef __TSS_H__ +-#define __TSS_H__ +- +-typedef struct +-{ +- Bit16u back, RESERVED0; /* Backlink */ +- Bit32u esp0; /* The CK stack pointer */ +- Bit16u ss0, RESERVED1; /* The CK stack selector */ +- Bit32u esp1; /* The parent KL stack pointer */ +- Bit16u ss1, RESERVED2; /* The parent KL stack selector */ +- Bit32u esp2; /* Unused */ +- Bit16u ss2, RESERVED3; /* Unused */ +- Bit32u cr3; /* The page directory pointer */ +- Bit32u eip; /* The instruction pointer */ +- Bit32u eflags; /* The flags */ +- Bit32u eax, ecx, edx, ebx; /* The general purpose registers */ +- Bit32u esp, ebp, esi, edi; /* The special purpose registers */ +- Bit16u es, RESERVED4; /* The extra selector */ +- Bit16u cs, RESERVED5; /* The code selector */ +- Bit16u ss, RESERVED6; /* The application stack selector */ +- Bit16u ds, RESERVED7; /* The data selector */ +- Bit16u fs, RESERVED8; /* And another extra selector */ +- Bit16u gs, RESERVED9; /* ... and another one */ +- Bit16u ldt, RESERVED10; /* The local descriptor table */ +- Bit16u trap; /* The trap flag (for debugging) */ +- Bit16u io; /* The I/O Map base address */ +-} __attribute__ ((packed)) tss_t; +- +-#endif /* __TSS_H__ */ +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/monitor-host.c bochs-2.0.2+20030829/plex86/kernel/monitor-host.c +--- bochs-2.0.2+20030829.old/plex86/kernel/monitor-host.c 2003-01-10 04:27:51.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/monitor-host.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,1886 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * monitor-host.c: This file contains the top-level monitor code, +- * accessible from the host space. (kernel independent code) +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +-#include "plex86.h" +-#define IN_HOST_SPACE +-#include "monitor.h" +- +- +-/* ===================================================================== +- * Plex86 module global variables. This should be the _only_ place +- * where globals are declared. Since plex86 supports multiple VMs, almost +- * all data is stored per-VM. For the few variables which are global +- * to all VMs, we have to be careful to access them in SMP friendly ways. +- * The ones which are written upon kernel module initialization are fine, +- * since they are only written once. +- * ===================================================================== +- */ +- +-/* Info regarding the physical pages that comprise the kernel module, +- * including physical page information. This is written (once) at +- * kernel module initialization time. Thus there are no SMP access issues. +- */ +-kernelModulePages_t kernelModulePages; +- +-/* Information of the host processor as returned by the CPUID +- * instruction. This is written (once) at kernel module initialization time. +- * Thus there no are SMP access issues. +- */ +-cpuid_info_t hostCpuIDInfo; +- +- +-/* Some constants used by the VM logic. Since they're "const", there are +- * no problems with SMP access. +- */ +-static const selector_t nullSelector = { raw: 0 }; +-static const descriptor_t nullDescriptor = { +- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +- }; +- +- +- +- +-static int hostInitIDTSlot(vm_t *vm, unsigned vec, int type); +-static void hostMapMonPages(vm_t *vm, Bit32u *, unsigned, Bit32u *, page_t *, +- unsigned user, unsigned writable, char *name); +-#if ANAL_CHECKS +-static void hostMapBlankPage(vm_t *vm, Bit32u *laddr_p, page_t *pageTable); +-#endif +- +-#define RW0 0 +-#define RW1 1 +-#define US0 0 +-#define US1 1 +- +-#define IDT_INTERRUPT 0 +-#define IDT_EXCEPTION_ERROR 1 +-#define IDT_EXCEPTION_NOERROR 2 +- +- +- +- +- +- unsigned +-hostModuleInit(void) +-{ +- /* Kernel independent stuff to do at kernel module load time. */ +- +- if (!hostGetCpuCapabilities()) { +- hostOSPrint("getCpuCapabilities returned error\n"); +- return(0); /* Fail. */ +- } +- else { +-#if 0 +- hostOSPrint("ptype:%u, family:%u, model:%u stepping:%u\n", +- hostCpuIDInfo.procSignature.fields.procType, +- hostCpuIDInfo.procSignature.fields.family, +- hostCpuIDInfo.procSignature.fields.model, +- hostCpuIDInfo.procSignature.fields.stepping); +-#endif +- } +- +- /* xxx Should check that host CS.base is page aligned here. */ +- +-#if 1 +- { +- Bit32u cr0; +- +- asm volatile ( "movl %%cr0, %0" : "=r" (cr0) ); +- hostOSPrint("host CR0=0x%x\n", cr0); +- } +-#endif +- +- return(1); /* Pass. */ +-} +- +- void +-hostDeviceOpen(vm_t *vm) +-{ +- /* Kernel independent stuff to do at device open time. */ +- +- /* Zero out entire VM structure. */ +- mon_memzero( vm, sizeof(vm_t) ); +- +- vm->vmState = VMStateFDOpened; +-} +- +- int +-hostInitMonitor(vm_t *vm) +-{ +- unsigned pdi, pti; +- unsigned int i; +- Bit32u nexus_size; +- page_t *pageTable; +- Bit32u laddr, base; +- int r; +- +- vm->kernel_offset = hostOSKernelOffset(); +- +- vm->system.a20Enable = 1; /* Start with A20 line enabled. */ +- vm->system.a20AddrMask = 0xffffffff; /* All address lines contribute. */ +- vm->system.a20IndexMask = 0x000fffff; /* All address lines contribute. */ +- +- /* Initialize nexus */ +- mon_memzero(vm->host.addr.nexus, 4096); +- +- /* Copy transition code (nexus) into code page allocated for this VM. */ +- nexus_size = ((Bit32u) &__nexus_end) - ((Bit32u) &__nexus_start); +- if (nexus_size > 4096) +- goto error; +- mon_memcpy(vm->host.addr.nexus, &__nexus_start, nexus_size); +- +- +- /* Init the convenience pointers. */ +- +- /* Pointer to host2mon routine inside nexus page */ +- vm->host.__host2mon = (void (*)(void)) HOST_NEXUS_OFFSET(vm, __host2mon); +- +- /* Pointer to guest context on monitor stack */ +- vm->host.addr.guest_context = (guest_context_t *) +- ( (Bit32u)vm->host.addr.nexus + PAGESIZE - sizeof(guest_context_t) ); +- +- /* Zero out various monitor data structures */ +- mon_memzero(vm->host.addr.log_buffer, 4096*LOG_BUFF_PAGES); +- mon_memzero(&vm->log_buffer_info, +- sizeof(vm->log_buffer_info)); +- mon_memzero(vm->host.addr.page_dir, 4096); +- mon_memzero(vm->host.addr.guest_cpu, 4096); +- mon_memzero(vm->host.addr.idt, MON_IDT_PAGES*4096); +- mon_memzero(vm->host.addr.gdt, MON_GDT_PAGES*4096); +- mon_memzero(vm->host.addr.ldt, MON_LDT_PAGES*4096); +- mon_memzero(vm->host.addr.tss, MON_TSS_PAGES*4096); +- mon_memzero(vm->host.addr.idt_stubs, MON_IDT_STUBS_PAGES*4096); +- +- vm->guestPhyPagePinQueue.nEntries = 0; +- vm->guestPhyPagePinQueue.tail = 0; +- +- /* +- * ================ +- * Nexus Page Table +- * ================ +- * +- * All structures needed by the monitor inside the guest environment +- * (code to perform the transition between host<-->guest, fault handler +- * code, various processor data structures like page directory, GDT, +- * IDT, TSS etc.) are mapped into a single Page Table. +- * +- * This allows us to migrate the complete nexus to anywhere in the +- * guest address space by just updating a single (unused) page directory +- * entry in the monitor/guest page directory to point to this nexus +- * page table. +- * +- * To simplify nexus migration, we try to avoid storing guest linear +- * addresses to nexus structures as far as possible. Instead, we use +- * offsets relative to the monitor code/data segments. As we update +- * the base of these segments whenever the monitor migrates, the net +- * effect is that those *offsets* remain valid across nexus migration. +- */ +- +- /* Fill in the PDE flags. The US bit is set to 1 (user access). +- * All of the US bits in the monitor PTEs are set to 0 (system access). +- */ +- vm->host.nexus_pde.fields.base = vm->pages.nexus_page_tbl; +- vm->host.nexus_pde.fields.avail = 0; +- vm->host.nexus_pde.fields.G = 0; /* not global */ +- vm->host.nexus_pde.fields.PS = 0; /* 4K pages */ +- vm->host.nexus_pde.fields.D = 0; /* (unused in pde) */ +- vm->host.nexus_pde.fields.A = 0; /* not accessed */ +- vm->host.nexus_pde.fields.PCD = 0; /* normal caching */ +- vm->host.nexus_pde.fields.PWT = 0; /* normal write-back */ +- vm->host.nexus_pde.fields.US = 1; /* user access (see above) */ +- vm->host.nexus_pde.fields.RW = 1; /* read or write */ +- vm->host.nexus_pde.fields.P = 1; /* present in memory */ +- +- /* Clear Page Table. */ +- pageTable = vm->host.addr.nexus_page_tbl; +- mon_memzero(pageTable, 4096); +- +- /* xxx Comment here */ +- laddr = 0; +- base = MON_BASE_FROM_LADDR(laddr); +- +- hostMapMonPages(vm, kernelModulePages.ppi, kernelModulePages.nPages, &laddr, +- pageTable, US0, RW1, "Monitor code/data pages"); +- +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- +- vm->guest.addr.nexus = (nexus_t *) (laddr - base); +- hostMapMonPages(vm, &vm->pages.nexus, 1, &laddr, pageTable, US0, RW1, "Nexus"); +- vm->guest.addr.guest_context = (guest_context_t *) +- ( (Bit32u)vm->guest.addr.nexus + PAGESIZE - sizeof(guest_context_t) ); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- vm->host.addr.nexus->vm = (void *) (laddr - base); +- hostMapMonPages(vm, vm->pages.vm, BytesToPages(sizeof(*vm)), +- &laddr, pageTable, US0, RW1, "VM structure"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- vm->guest.addr.idt = (gate_t *) (laddr - base); +- hostMapMonPages(vm, vm->pages.idt, MON_IDT_PAGES, &laddr, pageTable, US0, RW1, +- "IDT"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- vm->guest.addr.gdt = (descriptor_t *) (laddr - base); +- hostMapMonPages(vm, vm->pages.gdt, MON_GDT_PAGES, &laddr, pageTable, US0, RW1, +- "GDT"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- vm->guest.addr.ldt = (descriptor_t *) (laddr - base); +- hostMapMonPages(vm, vm->pages.ldt, MON_LDT_PAGES, &laddr, pageTable, US0, RW1, +- "LDT"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- vm->guest.addr.tss = (tss_t *) (laddr - base); +- hostMapMonPages(vm, vm->pages.tss, MON_TSS_PAGES, &laddr, pageTable, US0, RW1, +- "TSS"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- vm->guest.addr.idt_stubs = (idt_stub_t *) (laddr - base); +- hostMapMonPages(vm, vm->pages.idt_stubs, MON_IDT_STUBS_PAGES, &laddr, +- pageTable, US0, RW1, "IDT stubs"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- /* Monitor Page Directory */ +- vm->guest.addr.page_dir = (pageEntry_t *) (laddr - base); +- hostMapMonPages(vm, &vm->pages.page_dir, 1, &laddr, pageTable, US0, RW1, +- "Monitor Page Directory"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- /* Nexus Page Table */ +- vm->guest.addr.nexus_page_tbl = (page_t *) (laddr - base); +- hostMapMonPages(vm, &vm->pages.nexus_page_tbl, 1, &laddr, pageTable, US0, RW1, +- "Nexus Page Table"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- /* Map virtualized guest page tables into monitor. */ +- vm->guest.addr.page_tbl = (page_t *) (laddr - base); +- hostMapMonPages(vm, vm->pages.page_tbl, MON_PAGE_TABLES, +- &laddr, pageTable, US0, RW1, "Guest Page Tables"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- /* Map of linear addresses of page tables mapped into monitor */ +- vm->guest.addr.page_tbl_laddr_map = (unsigned *) (laddr - base); +- hostMapMonPages(vm, &vm->pages.page_tbl_laddr_map, 1, &laddr, pageTable, +- US0, RW1, "Page Table Laddr Map"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- /* Guest CPU state (mapped RW into user space also). */ +- vm->guest.addr.guest_cpu = (guest_cpu_t *) (laddr - base); +- hostMapMonPages(vm, &vm->pages.guest_cpu, 1, &laddr, +- pageTable, US0, RW1, "Guest CPU State"); +- +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- /* +- * We need a buffer to implement a debug print facility which +- * can work in either host or monitor space. Map the buffer +- * into monitor/guest space. +- */ +- vm->guest.addr.log_buffer = (unsigned char *) (laddr - base); +- hostMapMonPages(vm, vm->pages.log_buffer, LOG_BUFF_PAGES, &laddr, +- pageTable, US0, RW1, "Log Buffer"); +- +- { +- /* The physical addresses of the following pages are not */ +- /* yet established. Pass dummy info until they are mapped. */ +- Bit32u tmp[1]; +- tmp[0] = 0; +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- /* Window into the guest's current physical code page */ +- vm->guest.addr.code_phy_page = (unsigned char *) (laddr - base); +- hostMapMonPages(vm, tmp, 1, &laddr, pageTable, US0, RW1, "Code Phy Page"); +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- /* Temporary window into a guest physical page, for accessing */ +- /* guest GDT, IDT, etc info. */ +- vm->guest.addr.tmp_phy_page0 = (unsigned char *) (laddr - base); +- hostMapMonPages(vm, tmp, 1, &laddr, pageTable, US0, RW1, "Tmp Phy Page0"); +- +- vm->guest.addr.tmp_phy_page1 = (unsigned char *) (laddr - base); +- hostMapMonPages(vm, tmp, 1, &laddr, pageTable, US0, RW1, "Tmp Phy Page1"); +- } +- +-#if ANAL_CHECKS +- hostMapBlankPage(vm, &laddr, pageTable); +-#endif +- +- hostOSPrint("Using %u/1024 PTE slots in 4Meg monitor range.\n", +- (laddr >> 12) & 0x3ff); +- +- /* Pointer to mon2host routine inside nexus page */ +- vm->guest.__mon2host = (void (*)(void)) MON_NEXUS_OFFSET(vm, __mon2host); +- +- +- /* +- * ===================== +- * Transition Page Table +- * ===================== +- * +- * To aid in the transition between host<-->monitor/guest spaces, +- * we need to have an address identity map situation for at least +- * one page; the page containing the transition code. As we do +- * not know in advance whether this linear address range is in use +- * by the guest as well, we set aside a complete additional Page +- * Table, which contains only a single PTE pointing to the nexus page. +- * +- * To create the identity map, we simply change the corresponding +- * monitor page directory entry to point to this transition Page Table. +- * This happens transparently inside the host<-->guest transition code; +- * both the guest/monitor code and the host side code never see this +- * transition page table entered into the page directory! +- * +- * NOTE: We need to ensure that the nexus page table never spans the +- * same 4Meg linear address space region as this page table! +- * As we are free to choose the nexus linear address, this is +- * not a problem. +- */ +- +- /* Get full linear address of nexus code page, as seen in host space. */ +- laddr = (Bit32u)vm->host.addr.nexus + vm->kernel_offset; +- pdi = laddr >> 22; +- pti = (laddr >> 12) & 0x3ff; +- +- /* +- * We need to be able to access the PDE in the monitor page directory +- * that corresponds to this linear address from both host and monitor +- * address spaces. +- */ +- vm->host.addr.nexus->transition_pde_p_host = vm->host.addr.page_dir + pdi; +- vm->host.addr.nexus->transition_pde_p_mon = (pageEntry_t *) +- (((Bit32u)vm->guest.addr.page_dir) + (pdi << 2)); +- vm->host.addr.nexus->transition_laddr = laddr; +- +- /* Fill in the PDE flags */ +- vm->host.addr.nexus->transition_pde.fields.base = vm->pages.transition_PT; +- vm->host.addr.nexus->transition_pde.fields.avail = 0; +- vm->host.addr.nexus->transition_pde.fields.G = 0; /* not global */ +- vm->host.addr.nexus->transition_pde.fields.PS = 0; /* 4K pages */ +- vm->host.addr.nexus->transition_pde.fields.D = 0; /* (unused in pde) */ +- vm->host.addr.nexus->transition_pde.fields.A = 0; /* not accessed */ +- vm->host.addr.nexus->transition_pde.fields.PCD = 0; /* normal caching */ +- vm->host.addr.nexus->transition_pde.fields.PWT = 0; /* normal write-back*/ +- vm->host.addr.nexus->transition_pde.fields.US = 0; /* no user access */ +- vm->host.addr.nexus->transition_pde.fields.RW = 1; /* read or write */ +- vm->host.addr.nexus->transition_pde.fields.P = 1; /* present in memory*/ +- +- /* Clear Page Table; only one PTE is used. */ +- pageTable = vm->host.addr.transition_PT; +- mon_memzero(pageTable, 4096); +- +- /* Fill in the PTE for identity mapping the code page */ +- pageTable->pte[pti].fields.base = vm->pages.nexus; +- pageTable->pte[pti].fields.avail = 0; +- pageTable->pte[pti].fields.G = 0; /* not global */ +- pageTable->pte[pti].fields.PS = 0; /* (unused in pte) */ +- pageTable->pte[pti].fields.D = 0; /* clean */ +- pageTable->pte[pti].fields.A = 0; /* not accessed */ +- pageTable->pte[pti].fields.PCD = 0; /* normal caching */ +- pageTable->pte[pti].fields.PWT = 0; /* normal write-back */ +- pageTable->pte[pti].fields.US = 0; /* user can not access */ +- pageTable->pte[pti].fields.RW = 1; /* read or write */ +- pageTable->pte[pti].fields.P = 1; /* present in memory */ +- +- +- /* +- * Setup the TSS for the monitor/guest environment. +- * +- * We don't need to set the pagedir in the TSS, because we don't +- * actually jump to it anyway. The TSS is just used to set the kernel +- * stack and in a later stage, perhaps the I/O permission bitmap. +- */ +- +- /* No task chain. */ +- vm->host.addr.tss->back = 0; +- +- /* No debugging or I/O, for now. */ +- vm->host.addr.tss->trap = 0; +- vm->host.addr.tss->io = sizeof(tss_t); +- +- /* Monitor stack offset. */ +- vm->host.addr.tss->esp0 = +- ((Bit32u)vm->guest.addr.nexus) + PAGESIZE; +- +- +- /* +- * Set up initial monitor code and stack offset. +- */ +- +- vm->host.addr.nexus->mon_jmp_info.offset = MON_NEXUS_OFFSET(vm, __mon_cs); +- vm->host.addr.nexus->mon_stack_info.offset = +- vm->host.addr.tss->esp0 - (sizeof(guest_context_t) + 48); +-/* xxx 48 above should be calculated from code below which winds +- * xxx up monitor stack. +- */ +- +- +- /* +- * Setup the IDT for the monitor/guest environment +- */ +- +- r = 0; +- r |= hostInitIDTSlot(vm, 0, IDT_EXCEPTION_NOERROR); /* Divide error */ +- r |= hostInitIDTSlot(vm, 1, IDT_EXCEPTION_NOERROR); /* Debug exceptions */ +- r |= hostInitIDTSlot(vm, 2, IDT_INTERRUPT); /* NMI */ +- r |= hostInitIDTSlot(vm, 3, IDT_EXCEPTION_NOERROR); /* Breakpoint */ +- r |= hostInitIDTSlot(vm, 4, IDT_EXCEPTION_NOERROR); /* Overflow */ +- r |= hostInitIDTSlot(vm, 5, IDT_EXCEPTION_NOERROR); /* Bounds check */ +- r |= hostInitIDTSlot(vm, 6, IDT_EXCEPTION_NOERROR); /* Invalid opcode */ +- r |= hostInitIDTSlot(vm, 7, IDT_EXCEPTION_NOERROR); /* FPU not available */ +- r |= hostInitIDTSlot(vm, 8, IDT_EXCEPTION_ERROR); /* Double fault */ +- r |= hostInitIDTSlot(vm, 9, IDT_EXCEPTION_NOERROR); /* FPU segment overrun */ +- r |= hostInitIDTSlot(vm, 10, IDT_EXCEPTION_ERROR); /* Invalid TSS */ +- r |= hostInitIDTSlot(vm, 11, IDT_EXCEPTION_ERROR); /* Segment not present */ +- r |= hostInitIDTSlot(vm, 12, IDT_EXCEPTION_ERROR); /* Stack exception */ +- r |= hostInitIDTSlot(vm, 13, IDT_EXCEPTION_ERROR); /* GP fault */ +- r |= hostInitIDTSlot(vm, 14, IDT_EXCEPTION_ERROR); /* Page fault */ +- r |= hostInitIDTSlot(vm, 15, IDT_EXCEPTION_NOERROR); /* reserved */ +- r |= hostInitIDTSlot(vm, 16, IDT_EXCEPTION_NOERROR); /* Coprocessor error */ +- r |= hostInitIDTSlot(vm, 17, IDT_EXCEPTION_ERROR); /* Alignment check */ +- r |= hostInitIDTSlot(vm, 18, IDT_EXCEPTION_NOERROR); /* Machine check */ +- +- /* Reserved exceptions */ +- for (i = 19; i < 32; i++) +- r |= hostInitIDTSlot(vm, i, IDT_EXCEPTION_NOERROR); +- +- /* Hardware interrupts */ +- for (i = 32; i < 256; i++) +- r |= hostInitIDTSlot(vm, i, IDT_INTERRUPT); +- if (r!=0) +- goto error; +- +- +- /* +- * Setup the initial guest context +- */ +- +- mon_memzero(vm->host.addr.guest_context, sizeof(guest_context_t)); +- +- /* Wind up the monitor stack for the initial transition via +- * __host2mon. At the tail end, monitor state is popped from the +- * stack and a RET is executed. +- */ +- { +- Bit32u *ptr; +- +- ptr = (Bit32u *) (((unsigned char *) vm->host.addr.guest_context) - 4); +- *ptr-- = (Bit32u) &__ret_to_guest; +- *ptr-- = 0x02; /* eflags: only reserved bit on */ +- *ptr-- = 0; /* eax */ +- *ptr-- = 0; /* ecx */ +- *ptr-- = 0; /* edx */ +- *ptr-- = 0; /* ebx */ +- *ptr-- = 0; /* esp dummy */ +- *ptr-- = 0; /* ebp */ +- *ptr-- = 0; /* esi */ +- *ptr-- = 0; /* edi */ +- *ptr-- = 0; /* FS; start with null value. */ +- *ptr-- = 0; /* GS; start with null value. */ +- } +- +- vm->vmState |= VMStateInitMonitor; +- vm->mon_request = MonReqNone; +- +- return(1); /* all OK */ +- +-error: +- return(0); /* error */ +-} +- +- +- +- unsigned +-hostInitGuestPhyMem(vm_t *vm) +-{ +- unsigned i; +- mon_memzero(vm->pageInfo, sizeof(vm->pageInfo)); +- for (i=0; ipages.guest_n_pages; i++) { +- /* For now, we start out by preallocating physical pages */ +- /* for the guest, though not necessarily mapped into linear */ +- /* space. */ +- vm->pageInfo[i].attr.raw = 0; +- vm->pageInfo[i].tsc = 0; +- vm->pageInfo[i].attr.fields.allocated = 1; +- } +- +- { +- Bit32u rom_page; +- unsigned npages; +- +- /* Mark BIOS ROM area as ReadOnly */ +- rom_page = 0xf0000 >> 12; +- npages = (1 + 0xfffff - 0xf0000) / 4096; +- for (i=0; ipageInfo[rom_page + i].attr.fields.RO = 1; +- +- /* Mark VGA BIOS ROM area as ReadOnly */ +- rom_page = 0xc0000 >> 12; +- npages = (1 + 0xc7fff - 0xc0000) / 4096; +- for (i=0; ipageInfo[rom_page + i].attr.fields.RO = 1; +- } +- +-#if 1 +- /* Mark VGA framebuffer area as Memory Mapped IO */ +- { +- Bit32u vga_page; +- unsigned npages; +- +- vga_page = 0xa0000 >> 12; +- npages = (1 + 0xbffff - 0xa0000) / 4096; +- for (i=0; ipageInfo[vga_page + i].attr.fields.memMapIO = 1; +- } +-#endif +- +- return(0); +-} +- +- +- int +-hostInitIDTSlot(vm_t *vm, unsigned vec, int type) +-/* +- * initIDTSlot(): Initialize a monitor IDT slot. +- */ +-{ +- /* IDT slot stubs */ +- +- idt_stub_t *stub = &vm->host.addr.idt_stubs[vec]; +- Bit32u stub_mon = ((Bit32u) vm->guest.addr.idt_stubs) + +- vec*sizeof(idt_stub_t); +- +- if (sizeof(idt_stub_t) != IDT_STUB_SIZE) +- return( -1 ); +- +- switch (type) { +- case IDT_INTERRUPT: +- stub->m2.pushla = 0x68; +- stub->m2.dummy = 0; +- stub->m2.pushlb = 0x68; +- stub->m2.vector = vec; +- stub->m2.jmp = 0xe9; +- stub->m2.reloc = ((Bit32u) &__handle_int) - +- (stub_mon + sizeof(idt_method2_t)); +- break; +- +- case IDT_EXCEPTION_ERROR: +- stub->m1.pushl = 0x68; +- stub->m1.vector = vec; +- stub->m1.jmp = 0xe9; +- stub->m1.reloc = ((Bit32u) &__handle_fault) - +- (stub_mon + sizeof(idt_method1_t)); +- break; +- +- case IDT_EXCEPTION_NOERROR: +- stub->m2.pushla = 0x68; +- stub->m2.dummy = 0; +- stub->m2.pushlb = 0x68; +- stub->m2.vector = vec; +- stub->m2.jmp = 0xe9; +- stub->m2.reloc = ((Bit32u) &__handle_fault) - +- (stub_mon + sizeof(idt_method2_t)); +- break; +- +- default: +- return -1; +- } +- +- /* Set the interrupt gate */ +- SET_INT_GATE(vm->host.addr.idt[vec], +- nullSelector, stub_mon, D_PRESENT, D_DPL0, D_D32); +- return 0; +-} +- +- +-/* +- * Map pages allocated by host, into the linear address space of +- * the monitor/guest, given the Page Table supplied. +- */ +- +- void +-hostMapMonPages(vm_t *vm, Bit32u *pages, unsigned n, Bit32u *laddr_p, +- page_t *pageTable, unsigned user, unsigned writable, char *name) +-{ +- unsigned i, pti; +- +- +-#if 0 +-hostOSPrint("hostMapMonPages: '%s' mapped at 0x%x .. 0x%x.\n", +- name, +- (*laddr_p) - MON_BASE_FROM_LADDR(0), +- ((*laddr_p) + (n*4096)) - MON_BASE_FROM_LADDR(0) ); +-#endif +- +- pti = (*laddr_p >> 12) & 0x3ff; +- for (i = 0; i < n; i++, pti++) { +- if (pti > 1024) +- break; /* This should not happen! */ +- +- /* Fill in the PTE flags */ +- pageTable->pte[pti].fields.base = pages[i]; +- pageTable->pte[pti].fields.avail = 0; +- pageTable->pte[pti].fields.G = 0; /* not global */ +- pageTable->pte[pti].fields.PS = 0; /* (unused in pte) */ +- pageTable->pte[pti].fields.D = 0; /* clean */ +- pageTable->pte[pti].fields.A = 0; /* not accessed */ +- pageTable->pte[pti].fields.PCD = 0; /* normal caching */ +- pageTable->pte[pti].fields.PWT = 0; /* normal write-back */ +- pageTable->pte[pti].fields.US = user; /* 0=system, 1=user */ +- pageTable->pte[pti].fields.RW = writable; /* 0=RO, 1=RW */ +- pageTable->pte[pti].fields.P = 1; /* present in memory */ +- } +- +- /* +- * Advance linear address pointer, for the next set of pages +- * to be mapped. +- */ +- *laddr_p += 4096 * n; +-} +- +-#if ANAL_CHECKS +- void +-hostMapBlankPage(vm_t *vm, Bit32u *laddr_p, page_t *pageTable) +-{ +- unsigned pti; +- +- pti = (*laddr_p >> 12) & 0x3ff; +- if (pti > 1024) +- return; /* This should not happen! */ +- +- /* Fill in the PTE flags */ +- pageTable->pte[pti].fields.base = 0; +- pageTable->pte[pti].fields.avail = 0; +- pageTable->pte[pti].fields.G = 0; /* not global */ +- pageTable->pte[pti].fields.PS = 0; /* (unused in pte) */ +- pageTable->pte[pti].fields.D = 0; /* clean */ +- pageTable->pte[pti].fields.A = 0; /* not accessed */ +- pageTable->pte[pti].fields.PCD = 0; /* normal caching */ +- pageTable->pte[pti].fields.PWT = 0; /* normal write-back */ +- pageTable->pte[pti].fields.US = 0; +- pageTable->pte[pti].fields.RW = 0; +- pageTable->pte[pti].fields.P = 0; +- +- /* +- * Advance linear address pointer, for the next set of pages +- * to be mapped. +- */ +- *laddr_p += 4096; +-} +-#endif +- +- int +-hostIoctlGeneric(vm_t *vm, void *inode, void *filp, +- unsigned int cmd, unsigned long arg) +-{ +- switch (cmd) { +- +- /* +- * Set the guest CPUID info. +- */ +- case PLEX86_CPUID: +- { +- if ( vm->vmState & VMStateGuestCPUID ) { +- /* Can't change guest CPUID. */ +- return -Plex86ErrnoEINVAL; +- } +- if ( hostOSCopyFromUser(&vm->guestCPUIDInfo, (void *)arg, +- sizeof(vm->guestCPUIDInfo)) ) +- return -Plex86ErrnoEFAULT; +-/* xxx Value checks here. */ +- vm->vmState |= VMStateGuestCPUID; +- return 0; +- } +- +- case PLEX86_REGISTER_MEMORY: +- { +- plex86IoctlRegisterMem_t registerMemMsg; +- if ( hostOSCopyFromUser(®isterMemMsg, (void *)arg, +- sizeof(registerMemMsg)) ) +- return -Plex86ErrnoEFAULT; +- return( hostIoctlRegisterMem(vm, ®isterMemMsg) ); +- } +- +- /* +- * Tear down the VM environment. +- */ +- case PLEX86_TEARDOWN: +- if ( vm->vmState & VMStateRegisteredAll ) { +- hostOSPrint("plex86: guest memory is still registered!\n"); +- /* Could effect the unpinning here and then do: +- * vm->vmState &= ~VMStateRegisteredAll; +- */ +- return -Plex86ErrnoEBUSY; +- } +- +- hostUnallocVmPages(vm); +- /* Fixme: deal with state better here. */ +- +- /* Reset state to only FD opened. */ +- vm->vmState = VMStateFDOpened; +- return 0; +- +- +- /* +- * Execute the guest in the VM for a while. The guest CPU state +- * is specified in a memory window mmap()'d to user space. +- */ +- case PLEX86_EXECUTE: +- { +- plex86IoctlExecute_t executeMsg; +- int ret; +- +- if ( hostOSCopyFromUser(&executeMsg, (void *)arg, sizeof(executeMsg)) ) +- return -Plex86ErrnoEFAULT; +- ret = hostIoctlExecute(vm, &executeMsg); +- if ( hostOSCopyToUser((void *)arg, &executeMsg, sizeof(executeMsg)) ) +- return -Plex86ErrnoEFAULT; +- return ret; +- } +- +-#warning "PLEX86_RESET should only conditionally compiled for debugging." +- /* +- * For debugging, when the module gets hosed, this is a way +- * to reset the in-use count, so we can rmmod it. +- */ +- case PLEX86_RESET: +- hostOSModuleCountReset(vm, inode, filp); +- return 0; +- +- +- default: +- hostOSPrint("plex86: unknown ioctl(%d) called\n", cmd); +- return -Plex86ErrnoEINVAL; +- } +-} +- +- int +-hostIoctlExecute(vm_t *vm, plex86IoctlExecute_t *executeMsg) +-{ +- guest_cpu_t *guest_cpu; +- guest_context_t *guest_stack_context; +- nexus_t *nexus; +- unsigned s; +- int retval; +- +- if ( (vm->vmState != VMStateReady) || +- (vm->mon_request != MonReqNone) ) { +- retval = Plex86NoExecute_VMState; /* Fail. */ +- goto handlePanic; +- } +- +- /* Only (virtualized) native execution is supported currently. +- * Later, it will be interesting to breakpoint one instruction +- * at-a-time using Plex86ExecuteMethodBreakpoint, for +- * cosimulation. +- */ +- if (executeMsg->executeMethod != Plex86ExecuteMethodNative) { +- retval = Plex86NoExecute_Method; /* Fail. */ +- goto handleFail; +- } +- +- /* A pointer to the guest CPU state as passed from host-user space. +- * This structure is memory mapped between user and kernel/monitor space. +- */ +- guest_cpu = vm->host.addr.guest_cpu; +- +- /* A pointer to the guest CPU state saved on the monitor stack. */ +- guest_stack_context = vm->host.addr.guest_context; +- +- /* ================================================================= +- * Before executing the guest in the VM, we must check that +- * the guest conditions meet the requirements of the user-level-only +- * VM. +- * ================================================================= +- */ +- +- /* CR0: +- * PG(31)==1 +- * CD(30)==? (look into this later) +- * NW(29)==? (look into this later) +- * AM(18)==pass-thru from guest +- * WP(16)==Don't care. Monitor always sets this to 1. +- * NE( 5)==? (look into this later) +- * ET( 4)==? (look into this later) +- * TS( 3)==? (look into this later) +- * EM( 2)==? (look into this later) +- * MP( 1)==? (look into this later) +- * PE( 0)==1 +- */ +- /* 0x8005003b */ +- if ( (guest_cpu->cr0.raw & 0xe0000037) != 0x80000033 ) { +- hostOSPrint("plex86: guest CR0=0x%x\n", guest_cpu->cr0.raw); +- retval = Plex86NoExecute_CR0; /* Fail. */ +- goto handleFail; +- } +- +- /* CR4: +- * OSXMMEXCPT(10)==? (look into this later) +- * OSFXSR(9)==? (look into this later) +- * PCE(8)==? (look into this later) +- * PGE(7)==? (look into this later) +- * MCE(6)==? (look into this later) +- * PAE(5)==? (look into this later) +- * PSE(4)==? (look into this later) +- * DE(3)==? (look into this later) +- * TSD(2)==? (look into this later) +- * PVI(1)==? (look into this later) +- * VME(0)==? (look into this later) +- */ +- if ( (guest_cpu->cr4.raw & 0x000007ff) != 0x00000000 ) { +- hostOSPrint("plex86: guest CR4=0x%x\n", guest_cpu->cr4.raw); +- retval = Plex86NoExecute_CR4; /* Fail. */ +- goto handleFail; +- } +- +- /* Guest CPL must be 3 (user-level). +- * CS selector must not be NULL. +- */ +- if ( (guest_cpu->sreg[SRegCS].sel.fields.rpl != 3) || +- (guest_cpu->sreg[SRegCS].sel.fields.index == 0) || +- (guest_cpu->sreg[SRegCS].des.dpl != 3) ) { +- retval = Plex86NoExecute_CS; /* Fail. */ +- goto handleFail; +- } +- +- /* A20 line must be enabled. */ +- if ( guest_cpu->a20Enable != 1 ) { +- retval = Plex86NoExecute_A20; /* Fail. */ +- goto handleFail; +- } +- +- /* Some code not really used now, since we only support A20 being enabled. */ +- { +- unsigned newA20Enable; +- newA20Enable = guest_cpu->a20Enable > 0; /* Make 0 or 1. */ +- if ( newA20Enable != vm->system.a20Enable ) { +- if ( (!newA20Enable) && guest_cpu->cr0.fields.pg ) { +- /* A20 disabled, paging on not supported. Well, really I have to +- * see if it matters. This check was in old plex86 code. +- */ +- retval = Plex86NoExecute_A20; /* Fail. */ +- goto handleFail; +- } +- vm->system.a20Enable = newA20Enable; +- vm->system.a20AddrMask = 0xffefffff | (newA20Enable << 20); +- vm->system.a20IndexMask = 0x000ffeff | (newA20Enable << 8); +- } +- } +- +- /* LDT not supported. +- * Monitor uses GDT slots 1,2,3, so guest segments can not. +- * Segment descriptor cache DPL should equal 3. +- */ +- for (s=0; s<6; s++) { +- unsigned selector = guest_cpu->sreg[s].sel.raw; +- unsigned index; +- /* Only care if selector is not NULL. */ +- if ( selector & 0xfffc ) { +- if ( (selector & 0x0007) != 3 ) { +- /* Either TI=1 (LDT usage) or RPL!=3. */ +- retval = Plex86NoExecute_Selector; /* Fail. */ +- goto handleFail; +- } +- index = selector >> 3; +- if ( index <= 3 ) { +- /* Selector index field uses one of the monitor GDT slots. */ +- retval = Plex86NoExecute_Selector; /* Fail. */ +- goto handleFail; +- } +- if ( index >= (MON_GDT_SIZE/8) ) { +- /* Selector index field uses a slot beyond the monitor GDT size. */ +- retval = Plex86NoExecute_Selector; /* Fail. */ +- goto handleFail; +- } +- if ( guest_cpu->sreg[s].des.dpl != 3 ) { +- retval = Plex86NoExecute_DPL; /* Fail. */ +- goto handleFail; +- } +- } +- } +- +- /* EFlags constraints: +- * VIP/VIF==0 +- * VM==0 +- * RF==0 +- * NT==0 +- * IOPL==0 (We may be able to allow this to be 0..2) +- * IF==1 +- * TF==0 +- * bit1==1 +- */ +- if ( (guest_cpu->eflags & (0x001b7302)) != +- (0x00000202) ) { +- retval = Plex86NoExecute_EFlags; /* Fail. */ +- goto handleFail; +- } +- +- /* Notes on other stuff: +- * - CPUID emulation vs virtualization match. +- */ +- +- /* NOTE: We should commit to executing the guest at this point. +- * We must not leave stray entries in the GDT. +- */ +- +-/* Install virtualized guest descriptors in GDT. +- * Either use descriptor caches from guest space, or we have +- * to chase down the GDT entries using the guest's paging +- * system. Might be a cheaper/safe bet to just use the +- * descriptor caches. If the guest reloads a descriptor, +- * just let the user space deal with it. +- */ +- for (s=0; s<6; s++) { +- if ( (guest_cpu->sreg[s].sel.raw & 0xfffc) != 0) { +- vm->host.addr.gdt[ guest_cpu->sreg[s].sel.fields.index ] = +- guest_cpu->sreg[s].des; +- } +- } +-#warning "Have to clear out GDT" +- +- guest_stack_context->gs = guest_cpu->sreg[SRegGS].sel.raw; +- guest_stack_context->fs = guest_cpu->sreg[SRegFS].sel.raw; +- guest_stack_context->ds = guest_cpu->sreg[SRegDS].sel.raw; +- guest_stack_context->es = guest_cpu->sreg[SRegES].sel.raw; +- +- /* Could use memcpy(); both are in order. Pack both structs. */ +- guest_stack_context->edi = guest_cpu->edi; +- guest_stack_context->esi = guest_cpu->esi; +- guest_stack_context->ebp = guest_cpu->ebp; +- guest_stack_context->dummy_esp = 0; /* Not needed. */ +- guest_stack_context->ebx = guest_cpu->ebx; +- guest_stack_context->edx = guest_cpu->edx; +- guest_stack_context->ecx = guest_cpu->ecx; +- guest_stack_context->eax = guest_cpu->eax; +- +- /* Fields vector/error are ignored for return to guest. */ +- +- /* CS:EIP */ +- guest_stack_context->eip = guest_cpu->eip; +- guest_stack_context->cs = guest_cpu->sreg[SRegCS].sel.raw; +- +- guest_stack_context->eflags.raw = guest_cpu->eflags; +- vm->veflags.raw = 0; /* Virtualized EFLAGS - implement later. */ +- +- guest_stack_context->esp = guest_cpu->esp; +- guest_stack_context->ss = guest_cpu->sreg[SRegSS].sel.raw; +- +- /* Pointer to the fields in the nexus.S assembly code. */ +- nexus = vm->host.addr.nexus; +- +-#warning "Monitor CRx hacks" +- nexus->mon_cr0 = 0x8001003b | /* PG/WP/NE/ET/TS/MP/PE */ +- (guest_cpu->cr0.raw & 0x00040000); /* Pass-thru AM from guest. */ +- /* Could move mon_cr3 load to mapMonitor. */ +- nexus->mon_cr3 = vm->pages.page_dir << 12; +- nexus->mon_cr4 = 0x00000004; /* TSD=1 */ +- +-/* vm->guest_cpu.cr0.raw = guest_cpu->cr0 | 0x32; */ /* +++ hack for now */ +- +-// Notes: +-// - Implement some of monPagingRemap from old code, since that +-// was intended to be run/triggered by an initial mode change. +-// - After execution of 1st timeslice, need to copy dynamic state +-// from VM to guest_cpu area. +-// - Deal with cycle counts etc. +- +- hostInitShadowPaging(vm); +- +- for (;;) { +- unsigned long eflags; +- +-#if 0 +- /* If print buffer has contents, return to user space to print. */ +- if (vm->log_buffer_info.offset) { +- vm->mon_msgs.header.msg_type = VMMessagePrintBuf; +- vm->mon_msgs.header.msg_len = 0; +- vm->mon_request = MonReqNone; /* Request satisfied */ +- resetPrintBuf(vm); /* xxx Fix print mess */ +- retval = 100; +- goto handleFail; +- } +-#endif +- +- vm_save_flags(eflags); +- vm_restore_flags(eflags & ~0x00004300); /* clear NT/IF/TF */ +-#if ANAL_CHECKS +- if (!(eflags & 0x200)) { +- vm_restore_flags(eflags); +- hostOSPrint("ioctlExecute: EFLAGS.IF==0\n"); +- retval = 101; /* Fail. */ +- goto handlePanic; +- } +-#endif +- +- /* Call assembly routine to effect transition. */ +- vm->host.__host2mon(); +- +- /* First check for an asynchronous event (interrupt redirection) */ +- if ( vm->mon_request == MonReqRedirect ) { +- vm_restore_flags(eflags & ~0x00000200); /* restore all but IF */ +- soft_int(vm->redirect_vector); /* sets IF to 1 */ +- hostOSInstrumentIntRedirCount(vm->redirect_vector); +- vm->mon_request = MonReqNone; /* Request satisfied */ +- } +- +- /* Event was synchronous; monitor requested a switch back to host. */ +- else { +- vm_restore_flags(eflags); +- +- /* Perform action requested by monitor. */ +- switch ( vm->mon_request ) { +- case MonReqRemapMonitor: +-#if 0 +- if ( mapMonitor(vm) ) { +- vm->mon_request = MonReqNone; /* Request satisfied */ +- break; +- } +- else { +- hostOSPrint("mapMonitor failed.\n"); +- hostOSPrint("Panic w/ abort_code=%u\n", vm->abort_code); +- retval = 102; +- goto handlePanic; +- } +-#endif +- hostOSPrint("ioctlExecute: case MonReqRemapMonitor.\n"); +- retval = 103; +- goto handlePanic; +- +- case MonReqFlushPrintBuf: +- hostOSPrint("ioctlExecute: case MonReqFlushPrintBuf.\n"); +- retval = 104; +- goto handlePanic; +- +- case MonReqGuestFault: +- /* Encountered a guest fault. */ +- hostCopyGuestStateToUserSpace(vm); +- executeMsg->cyclesExecuted = 0; /* Handle later. */ +- executeMsg->instructionsExecuted = 0; /* Handle later. */ +- executeMsg->monitorState.state = vm->vmState; +- executeMsg->monitorState.request = vm->mon_request; +- executeMsg->monitorState.guestFaultNo = vm->guestFaultNo; +- vm->mon_request = MonReqNone; +- return 0; +- +- case MonReqPanic: +- if (vm->abort_code) +- hostOSPrint("Panic w/ abort_code=%u\n", vm->abort_code); +- hostOSPrint("ioctlExecute: case MonReqPanic.\n"); +- retval = 106; +- goto handlePanic; +- +- case MonReqPinUserPage: +- if ( !hostHandlePagePinRequest(vm, vm->pinReqPPI) ) { +- retval = 108; +- goto handlePanic; +- } +- continue; /* Back to VM monitor. */ +- +- default: +- hostOSPrint("ioctlExecute: default case (%u).\n", vm->mon_request); +- retval = 107; +- goto handlePanic; +- } +- } +- +- /* Let host decide whether we are allowed another timeslice */ +- if ( !hostOSIdle() ) { +- /* We are returning only because the host wants to +- * schedule other work. +- */ +- executeMsg->monitorState.state = vm->vmState; +- executeMsg->monitorState.request = MonReqNone; +- return 0; +- } +- } +- +- /* Should not get here. */ +- retval = 109; +- goto handlePanic; +- +-handleFail: +- /* Handle inabilitiy to execute the guest due to certain state. */ +- executeMsg->monitorState.state = vm->vmState; +- executeMsg->monitorState.request = vm->mon_request; +- return(retval); +- +-handlePanic: +- vm->vmState |= VMStatePanic; +- vm->mon_request = MonReqPanic; +- executeMsg->monitorState.state = vm->vmState; +- executeMsg->monitorState.request = vm->mon_request; +- return(retval); +-} +- +- void +-hostCopyGuestStateToUserSpace(vm_t *vm) +-{ +- guest_cpu_t *guest_cpu; +- guest_context_t *guest_stack_context; +- +- /* A pointer to the guest CPU state as passed from host-user space. +- * This structure is memory mapped between user and kernel/monitor space. +- */ +- guest_cpu = vm->host.addr.guest_cpu; +- +- /* A pointer to the guest CPU state saved on the monitor stack. */ +- guest_stack_context = vm->host.addr.guest_context; +- +- guest_cpu->sreg[SRegES].sel.raw = guest_stack_context->es; +- if ( (guest_stack_context->es & 0xfffc) == 0 ) { +- guest_cpu->sreg[SRegES].des = nullDescriptor; +- guest_cpu->sreg[SRegES].valid = 0; +- } +- else { +- guest_cpu->sreg[SRegES].des = +- vm->host.addr.gdt[ guest_cpu->sreg[SRegES].sel.fields.index ]; +- guest_cpu->sreg[SRegES].valid = 1; +- } +- +- guest_cpu->sreg[SRegCS].sel.raw = guest_stack_context->cs; +- if ( (guest_stack_context->cs & 0xfffc) == 0 ) { +- guest_cpu->sreg[SRegCS].des = nullDescriptor; +- guest_cpu->sreg[SRegCS].valid = 0; +- } +- else { +- guest_cpu->sreg[SRegCS].des = +- vm->host.addr.gdt[ guest_cpu->sreg[SRegCS].sel.fields.index ]; +- guest_cpu->sreg[SRegCS].valid = 1; +- } +- +- guest_cpu->sreg[SRegSS].sel.raw = guest_stack_context->ss; +- if ( (guest_stack_context->ss & 0xfffc) == 0 ) { +- guest_cpu->sreg[SRegSS].des = nullDescriptor; +- guest_cpu->sreg[SRegSS].valid = 0; +- } +- else { +- guest_cpu->sreg[SRegSS].des = +- vm->host.addr.gdt[ guest_cpu->sreg[SRegSS].sel.fields.index ]; +- guest_cpu->sreg[SRegSS].valid = 1; +- } +- +- guest_cpu->sreg[SRegDS].sel.raw = guest_stack_context->ds; +- if ( (guest_stack_context->ds & 0xfffc) == 0 ) { +- guest_cpu->sreg[SRegDS].des = nullDescriptor; +- guest_cpu->sreg[SRegDS].valid = 0; +- } +- else { +- guest_cpu->sreg[SRegDS].des = +- vm->host.addr.gdt[ guest_cpu->sreg[SRegDS].sel.fields.index ]; +- guest_cpu->sreg[SRegDS].valid = 1; +- } +- +- guest_cpu->sreg[SRegFS].sel.raw = guest_stack_context->fs; +- if ( (guest_stack_context->fs & 0xfffc) == 0 ) { +- guest_cpu->sreg[SRegFS].des = nullDescriptor; +- guest_cpu->sreg[SRegFS].valid = 0; +- } +- else { +- guest_cpu->sreg[SRegFS].des = +- vm->host.addr.gdt[ guest_cpu->sreg[SRegFS].sel.fields.index ]; +- guest_cpu->sreg[SRegFS].valid = 1; +- } +- +- guest_cpu->sreg[SRegGS].sel.raw = guest_stack_context->gs; +- if ( (guest_stack_context->gs & 0xfffc) == 0 ) { +- guest_cpu->sreg[SRegGS].des = nullDescriptor; +- guest_cpu->sreg[SRegGS].valid = 0; +- } +- else { +- guest_cpu->sreg[SRegGS].des = +- vm->host.addr.gdt[ guest_cpu->sreg[SRegGS].sel.fields.index ]; +- guest_cpu->sreg[SRegGS].valid = 1; +- } +- +- /* Could use memcpy(); both are in order. Pack both structs. */ +- guest_cpu->edi = guest_stack_context->edi; +- guest_cpu->esi = guest_stack_context->esi; +- guest_cpu->ebp = guest_stack_context->ebp; +- guest_cpu->esp = guest_stack_context->esp; +- guest_cpu->ebx = guest_stack_context->ebx; +- guest_cpu->edx = guest_stack_context->edx; +- guest_cpu->ecx = guest_stack_context->ecx; +- guest_cpu->eax = guest_stack_context->eax; +- +- /* CS:EIP */ +- guest_cpu->eip = guest_stack_context->eip; +- +- guest_cpu->eflags = guest_stack_context->eflags.raw; +- /* vm->veflags.raw = 0; */ /* Virtualized EFLAGS - implement later. */ +-} +- +- +- int +-hostIoctlRegisterMem(vm_t *vm, plex86IoctlRegisterMem_t *registerMemMsg) +-{ +- unsigned error; +- +- /* Do not allow duplicate allocation. The file descriptor must be +- * opened. The guest CPUID info can be filled in later. +- */ +- if ( (vm->vmState & ~VMStateGuestCPUID) != VMStateFDOpened ) +- return -Plex86ErrnoEBUSY; +- +- if (vm->pages.guest_n_megs != 0) +- return -Plex86ErrnoEBUSY; +- +- /* Check that the amount of memory is reasonable. */ +- if ( (registerMemMsg->nMegs > PLEX86_MAX_PHY_MEGS) || +- (registerMemMsg->nMegs < 4) || +- (registerMemMsg->nMegs & 0x3) ) +- return -Plex86ErrnoEINVAL; +- +- /* Check that the guest memory vector is page aligned. */ +- if ( registerMemMsg->guestPhyMemVector & 0xfff ) +- return -Plex86ErrnoEINVAL; +- +- /* Check that the log buffer area is page aligned. */ +- if ( registerMemMsg->logBufferWindow & 0xfff ) +- return -Plex86ErrnoEINVAL; +- +- /* Check that the guest CPU area is page aligned. */ +- if ( registerMemMsg->guestCPUWindow & 0xfff ) +- return -Plex86ErrnoEINVAL; +- +- /* Check that none of the user areas overlap. In case we have a +- * number of regions, use some generic code to handle N regions. +- */ +- { +-#define NumUserRegions 3 +- struct { +- Bit32u min, max; +- } userRegion[NumUserRegions]; +- unsigned i,j; +- +- userRegion[0].min = registerMemMsg->guestPhyMemVector; +- userRegion[0].max = userRegion[0].min + (registerMemMsg->nMegs<<20) - 1; +- userRegion[1].min = registerMemMsg->logBufferWindow; +- userRegion[1].max = userRegion[1].min + LOG_BUFF_SIZE - 1; +- userRegion[2].min = registerMemMsg->guestCPUWindow; +- userRegion[2].max = userRegion[2].min + (4096) - 1; +- +- for (i=1; i= userRegion[i].min) && +- (userRegion[j].min <= userRegion[i].max) ) +- return -Plex86ErrnoEINVAL; +- /* Check for max(j) contained in region(i). */ +- if ( (userRegion[j].max >= userRegion[i].min) && +- (userRegion[j].max <= userRegion[i].max) ) +- return -Plex86ErrnoEINVAL; +- } +- } +- } +- +- +- +- /* Allocate memory */ +- if ( (error = hostAllocVmPages(vm, registerMemMsg)) != 0 ) { +- hostOSPrint("plex86: allocVmPages failed at %u\n", +- error); +- return -Plex86ErrnoENOMEM; +- } +- +- /* Initialize the guests physical memory. */ +- if ( hostInitGuestPhyMem(vm) ) { +- hostUnallocVmPages(vm); +- return -Plex86ErrnoEFAULT; +- } +- +- /* Initialize the monitor. */ +- if ( !hostInitMonitor(vm) || +- !hostMapMonitor(vm) ) { +- hostUnallocVmPages(vm); +- return -Plex86ErrnoEFAULT; +- } +- return 0; +-} +- +- +- +-/* +- * Allocate various pages/memory needed by monitor. +- */ +- +- int +-hostAllocVmPages(vm_t *vm, plex86IoctlRegisterMem_t *registerMemMsg) +-{ +- vm_pages_t *pg = &vm->pages; +- vm_addr_t *ad = &vm->host.addr; +-#warning "Fix these shortcuts" +- unsigned where = 1; +- +- /* clear out allocated pages lists */ +- mon_memzero(pg, sizeof(*pg)); +- mon_memzero(ad, sizeof(*ad)); +- +- /* Guest physical memory pages */ +- pg->guest_n_megs = registerMemMsg->nMegs; +- pg->guest_n_pages = registerMemMsg->nMegs * 256; +- pg->guest_n_bytes = registerMemMsg->nMegs * 1024 * 1024; +- if ( pg->guest_n_pages > MAX_MON_GUEST_PAGES) { +- /* The size of the user-space allocated guest physical memory must +- * fit within the maximum number of guest pages that the VM monitor +- * supports. +- */ +- goto error; +- } +- where++; +- +- vm->guestPhyMemAddr = registerMemMsg->guestPhyMemVector; +- vm->vmState |= VMStateRegisteredPhyMem; /* Bogus for now. */ +- where++; +- +- { +- Bit32u hostPPI, kernelAddr; +- +- /* Guest CPU state (malloc()'d in user space). */ +- if ( !hostOSGetAndPinUserPage(vm, registerMemMsg->guestCPUWindow, +- &pg->guest_cpu_hostOSPtr, &hostPPI, &kernelAddr) ) { +- goto error; +- } +- ad->guest_cpu = (guest_cpu_t *) kernelAddr; +- pg->guest_cpu = hostPPI; +-vm->vmState |= VMStateRegisteredGuestCPU; /* For now. */ +- where++; +- +- /* Log buffer area (malloc()'d in user space). */ +- /* LOG_BUFF_PAGES */ +- if ( !hostOSGetAndPinUserPage(vm, registerMemMsg->logBufferWindow, +- &pg->log_buffer_hostOSPtr[0], &hostPPI, &kernelAddr) ) { +- goto error; +- } +- ad->log_buffer = (Bit8u *) kernelAddr; +- pg->log_buffer[0] = hostPPI; +- where++; +-vm->vmState |= VMStateRegisteredPrintBuffer; /* For now. */ +- } +- +- +- /* Monitor page directory */ +- if ( !(ad->page_dir = (pageEntry_t *) hostOSAllocZeroedPage()) ) { +- goto error; +- } +- where++; +- if (!(pg->page_dir = hostOSGetAllocedPagePhyPage(ad->page_dir))) { +- goto error; +- } +- where++; +- +- /* Monitor page tables */ +- if ( !(ad->page_tbl = hostOSAllocZeroedMem(4096 * MON_PAGE_TABLES)) ) { +- goto error; +- } +- where++; +- if (!hostOSGetAllocedMemPhyPages(pg->page_tbl, MON_PAGE_TABLES, +- ad->page_tbl, 4096 * MON_PAGE_TABLES)) { +- goto error; +- } +- where++; +- +- /* Map of the linear addresses of page tables currently */ +- /* mapped into the monitor space. */ +- if ( !(ad->page_tbl_laddr_map = (unsigned *) hostOSAllocZeroedPage()) ) { +- goto error; +- } +- where++; +- if ( !(pg->page_tbl_laddr_map = +- hostOSGetAllocedPagePhyPage(ad->page_tbl_laddr_map)) ) { +- goto error; +- } +- where++; +- +- /* Nexus page table */ +- if ( !(ad->nexus_page_tbl = (page_t *) hostOSAllocZeroedPage()) ) { +- goto error; +- } +- where++; +- if ( !(pg->nexus_page_tbl = hostOSGetAllocedPagePhyPage(ad->nexus_page_tbl)) ) { +- goto error; +- } +- where++; +- +- /* Transition page table */ +- if ( !(ad->transition_PT = (page_t *) hostOSAllocZeroedPage()) ) { +- goto error; +- } +- where++; +- if ( !(pg->transition_PT = hostOSGetAllocedPagePhyPage(ad->transition_PT)) ) { +- goto error; +- } +- where++; +- +- /* Nexus page */ +- if ( !(ad->nexus = (nexus_t *) hostOSAllocZeroedPage()) ) { +- goto error; +- } +- where++; +- if ( !(pg->nexus = hostOSGetAllocedPagePhyPage(ad->nexus)) ) { +- goto error; +- } +- where++; +- +- /* Monitor IDT */ +- if ( !(ad->idt = hostOSAllocZeroedMem(MON_IDT_PAGES*4096)) ) { +- goto error; +- } +- where++; +- if (!hostOSGetAllocedMemPhyPages(pg->idt, MON_IDT_PAGES, ad->idt, MON_IDT_SIZE)) { +- goto error; +- } +- where++; +- +- /* Monitor GDT */ +- if ( !(ad->gdt = hostOSAllocZeroedMem(MON_GDT_PAGES*4096)) ) { +- goto error; +- } +- where++; +- if (!hostOSGetAllocedMemPhyPages(pg->gdt, MON_GDT_PAGES, ad->gdt, MON_GDT_SIZE)) { +- goto error; +- } +- where++; +- +- /* Monitor LDT */ +- if ( !(ad->ldt = hostOSAllocZeroedMem(MON_LDT_PAGES*4096)) ) { +- goto error; +- } +- where++; +- if (!hostOSGetAllocedMemPhyPages(pg->ldt, MON_LDT_PAGES, ad->ldt, MON_LDT_SIZE)) { +- goto error; +- } +- where++; +- +- /* Monitor TSS */ +- if ( !(ad->tss = hostOSAllocZeroedMem(MON_TSS_PAGES*4096)) ) { +- goto error; +- } +- where++; +- if (!hostOSGetAllocedMemPhyPages(pg->tss, MON_TSS_PAGES, ad->tss, MON_TSS_SIZE)) { +- goto error; +- } +- where++; +- +- /* Monitor IDT stubs */ +- if ( !(ad->idt_stubs = hostOSAllocZeroedMem(MON_IDT_STUBS_PAGES*4096)) ) { +- goto error; +- } +- where++; +- if (!hostOSGetAllocedMemPhyPages(pg->idt_stubs, MON_IDT_STUBS_PAGES, +- ad->idt_stubs, MON_IDT_STUBS_SIZE)) { +- goto error; +- } +- where++; +- +- /* Get the physical pages associated with the vm_t structure. */ +- if (!hostOSGetAllocedMemPhyPages(pg->vm, MAX_VM_STRUCT_PAGES, vm, sizeof(*vm))) { +- goto error; +- } +- where++; +- +- vm->vmState |= VMStateMemAllocated; +- return 0; /* OK. */ +- +- error: +- hostUnallocVmPages( vm ); +- return( where ); +-} +- +- +-/* */ +-/* Unallocate pages/memory used by monitor */ +-/* */ +- +- void +-hostUnallocVmPages( vm_t *vm ) +-{ +- vm_pages_t *pg = &vm->pages; +- vm_addr_t *ad = &vm->host.addr; +- +- /* Guest physical memory pages */ +- if (vm->guestPhyMemAddr) { +- hostReleasePinnedUserPages(vm); +- vm->guestPhyMemAddr = 0; +- } +- vm->vmState &= ~VMStateRegisteredPhyMem; /* Bogus for now. */ +- +- /* Monitor page directory */ +- if (ad->page_dir) hostOSFreePage(ad->page_dir); +- +- /* Monitor page tables */ +- if (ad->page_tbl) hostOSFreeMem(ad->page_tbl); +- +- /* Map of linear addresses of page tables mapped into monitor. */ +- if (ad->page_tbl_laddr_map) hostOSFreePage(ad->page_tbl_laddr_map); +- +- /* Nexus page table */ +- if (ad->nexus_page_tbl) hostOSFreePage(ad->nexus_page_tbl); +- +- /* Guest CPU state. */ +- if (ad->guest_cpu) hostOSFreePage(ad->guest_cpu); +- +- /* Transition page table */ +- if (ad->transition_PT) hostOSFreePage(ad->transition_PT); +- +- if (ad->log_buffer) hostOSFreeMem(ad->log_buffer); +- +- /* Nexus page */ +- if (ad->nexus) hostOSFreePage(ad->nexus); +- +- /* Monitor IDT */ +- if (ad->idt) hostOSFreeMem(ad->idt); +- +- /* Monitor GDT */ +- if (ad->gdt) hostOSFreeMem(ad->gdt); +- +- /* Monitor LDT */ +- if (ad->ldt) hostOSFreeMem(ad->ldt); +- +- /* Monitor TSS */ +- if (ad->tss) hostOSFreeMem(ad->tss); +- +- /* Monitor IDT stubs */ +- if (ad->idt_stubs) hostOSFreeMem(ad->idt_stubs); +- +- +- /* clear out allocated pages lists */ +- mon_memzero(pg, sizeof(*pg)); +- mon_memzero(ad, sizeof(*ad)); +-} +- +- unsigned +-hostGetCpuCapabilities(void) +-{ +- Bit32u eax, ebx, ecx, edx; +- +- /* Get the highest allowed cpuid level */ +- asm volatile ( +- "xorl %%eax,%%eax\n\t" +- "cpuid" +- : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) +- : +- : "cc" +- ); +- if (eax < 1) +- return(0); /* not enough capabilities */ +- +- /* Copy vendor string. */ +- hostCpuIDInfo.vendorDWord0 = ebx; +- hostCpuIDInfo.vendorDWord1 = edx; +- hostCpuIDInfo.vendorDWord2 = ecx; +- +- /* CPUID w/ EAX==1: Processor Signature & Feature Flags */ +- asm volatile ( +- "movl $1,%%eax\n\t" +- "cpuid" +- : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) +- : +- : "cc" +- ); +- hostCpuIDInfo.procSignature.raw = eax; +- hostCpuIDInfo.featureFlags.raw = edx; +- /* Plex86 needs TSC */ +- if (hostCpuIDInfo.featureFlags.fields.tsc==0) +- return(0); +- +- return(1); +-} +- +- +-/* Map the monitor and guest into the VM. */ +- +- unsigned +-hostMapMonitor(vm_t *vm) +-{ +- selector_t monCsSel, monSsSel, monTssSel; +- Bit32u laddr, base; +- unsigned slot; +- guest_context_t *guestContext; +- nexus_t *nexus; +- descriptor_t *gdt; +- +- /* For convenience, some pointers. */ +- guestContext = vm->host.addr.guest_context; +- nexus = vm->host.addr.nexus; +- gdt = vm->host.addr.gdt; +- +-#warning "Is the GDT being cleared of old values?" +-/* +++ should zero out GDT, so prev entries do not remain */ +- +- /* ========================= +- * Map in Monitor structures +- * ========================= +- */ +- +- /* CS/SS/TSS selectors: +- * For now, hardcode in monitor descriptors at slots 1,2,3. As we +- * are only running user code in the VM, these are likely safe slots +- * as they are often used guest OSes for kernel descriptors. +- */ +- monCsSel.raw = Selector(1, 0, RPL0); +- monSsSel.raw = Selector(2, 0, RPL0); +- monTssSel.raw = Selector(3, 0, RPL0); +- +- /* Search for unused PDE for nexus PT (fixed for now) */ +- laddr = 0x70000000; +- vm->mon_pde_mask = laddr & 0xffc00000; +- vm->mon_pdi = laddr >> 22; +- base = MON_BASE_FROM_LADDR(laddr); +- +- /* Map nexus into monitor/guest address space */ +- vm->host.addr.page_dir[laddr >> 22] = vm->host.nexus_pde; +- +- /* CS/SS/TSS descriptors: Put at fixed GDT location for now. */ +- SET_DESCRIPTOR(gdt[monCsSel.fields.index], base, 0xfffff, +- D_PG, D_D32, D_AVL0, D_PRESENT, D_DPL0, D_CODE | D_READ) +- SET_DESCRIPTOR(gdt[monSsSel.fields.index], base, 0xfffff, +- D_PG, D_D32, D_AVL0, D_PRESENT, D_DPL0, D_DATA | D_WRITE) +- SET_DESCRIPTOR(gdt[monTssSel.fields.index], +- base + (Bit32u) vm->guest.addr.tss, +- sizeof(tss_t)-1, +- D_BG, 0, D_AVL0, D_PRESENT, D_DPL0, D_TSS) +- +- +- /* Fix up the selectors of all IDT entries. */ +- for ( slot = 0; slot < 256; slot++ ) +- vm->host.addr.idt[slot].selector = monCsSel; +- +- /* The monitor GDT/IDT loading info. */ +- nexus->mon_gdt_info.base = base + (Bit32u) vm->guest.addr.gdt; +- nexus->mon_gdt_info.limit = MON_GDT_SIZE; +- nexus->mon_idt_info.base = base + (Bit32u) vm->guest.addr.idt; +- nexus->mon_idt_info.limit = MON_IDT_SIZE; +- +- /* We don't have a monitor LDT for now. */ +- nexus->mon_ldt_sel = 0; +- +- /* The monitor TSS. */ +- nexus->mon_tss_sel = monTssSel.raw; +- vm->host.addr.tss->esp0 = ((Bit32u)vm->guest.addr.nexus) + PAGESIZE; +- vm->host.addr.tss->ss0 = monSsSel.raw; +- +- /* Monitor code and stack segments. */ +- nexus->mon_jmp_info.selector = monCsSel.raw; +- nexus->mon_stack_info.selector = monSsSel.raw; +- +- /* Monitor code/data segment base. */ +- nexus->mon_base = base; +- +- vm->vmState |= VMStateMapMonitor; +- return(1); +-} +- +- void +-hostInitShadowPaging(vm_t *vm) +-{ +- pageEntry_t *monPDir; +- Bit32u pdi; +-/*Bit32u cr3_page_index;*/ +-/*phy_page_usage_t *pusage;*/ +- +-#if 0 +- cr3_page_index = A20Addr(vm, vm->guest_cpu.cr3) >> 12; +- if ( cr3_page_index >= vm->pages.guest_n_pages) +- xxxpanic(vm, "monPagingRemap: CR3 conflicts with monitor space\n"); +-#endif +- +- /* Reset page table heap */ +- vm->ptbl_laddr_map_i = 0; +- +- /* Clear monitor PD except 4Meg range used by monitor */ +- monPDir = vm->host.addr.page_dir; +- for (pdi=0; pdi<1024; pdi++) { +-#if ANAL_CHECKS +- vm->host.addr.page_tbl_laddr_map[pdi] = -1; /* max unsigned */ +-#endif +- if (pdi != vm->mon_pdi) +- monPDir[pdi].raw = 0; +- } +- +- /* Update vpaging timestamp. */ +- vm->vpaging_tsc = vm_rdtsc(); +- +-#if 0 +- /* When we remap the monitor page tables, IF guest paging is +- * enabled, then mark the page containing the guest page directory +- * as such. In non-paged mode, there is no page directory. +- */ +- if (vm->guest_cpu.cr0.fields.pg) { +- pusage = &vm->pageInfo[cr3_page_index]; +- pusage->tsc = vm->vpaging_tsc; +- pusage->attr.raw &= PageUsageSticky; +- pusage->attr.raw |= PageUsagePDir; +- pusage->attr.fields.access_perm = PagePermNA; +- if (pusage->attr.raw & PageBadUsage4PDir) +- xxxpanic(vm, "monPagingRemap: BadUsage4PDir\n"); +- } +-#endif +-} +- +- +- void +-hostReleasePinnedUserPages(vm_t *vm) +-{ +- unsigned ppi; +- unsigned dirty; +- unsigned nPages; +- Bit32u kernelAddr; +- +- /* Unpin the pages associate with the guest physical memory. */ +- nPages = vm->pages.guest_n_pages; +- for (ppi=0; ppipageInfo[ppi].attr.fields.pinned ) { +- void *osSpecificPtr; +- +- osSpecificPtr = (void *) vm->hostStructPagePtr[ppi]; +-#warning "Conditionalize page dirtying before page release." +- dirty = 1; /* FIXME: 1 for now. */ +- hostOSUnpinUserPage(vm, +- vm->guestPhyMemAddr + (ppi<<12), +- osSpecificPtr, +- ppi, +- 0 /* There was no host kernel addr mapped for this page. */, +- dirty); +- vm->pageInfo[ppi].attr.fields.pinned = 0; +- } +- } +- +- /* Unpin the pages associated with the guest_cpu area. */ +- kernelAddr = (Bit32u) vm->host.addr.guest_cpu; +- hostOSUnpinUserPage(vm, +- 0, /* User space address. */ +- vm->pages.guest_cpu_hostOSPtr, +- vm->pages.guest_cpu, +- &kernelAddr, +- 1 /* Dirty. */); +- +- /* Unpin the pages associated with the log buffer area. */ +- kernelAddr = (Bit32u) vm->host.addr.log_buffer; +- hostOSUnpinUserPage(vm, +- 0, /* User space address. */ +- vm->pages.log_buffer_hostOSPtr[0], +- vm->pages.log_buffer[0], +- &kernelAddr, +- 1 /* Dirty. */); +-#warning "User space address is passed as 0 for now..." +-} +- +- unsigned +-hostHandlePagePinRequest(vm_t *vm, Bit32u reqGuestPPI) +-{ +- Bit32u hostPPI; +- unsigned qIndex; +- +-#warning "We must not unpin open pages (for page walking) here." +- if (vm->guestPhyPagePinQueue.nEntries < MaxPhyPagesPinned) { +- /* There is room in the Q for another entry - we have not reached +- * the upper limit of allowable number of pinned pages. +- */ +- qIndex = vm->guestPhyPagePinQueue.nEntries; +- } +- else { +- unsigned dirty; +- Bit32u unpinGuestPPI; +- /* There is no room in the Q for another entry - we have reached +- * the upper limit of allowable number of pinned pages. We must +- * first unpin a page to free up the limit, then we can pin the +- * requested page. This keeps plex86 from pinning an unconstrained +- * number of pages at one time. +- */ +- qIndex = vm->guestPhyPagePinQueue.tail; +- dirty = 1; /* FIXME: 1 for now. */ +- unpinGuestPPI = vm->guestPhyPagePinQueue.ppi[qIndex]; +- hostOSUnpinUserPage(vm, +- vm->guestPhyMemAddr + (unpinGuestPPI<<12), +- vm->hostStructPagePtr[unpinGuestPPI], +- unpinGuestPPI, +- 0 /* There was no host kernel addr mapped for this page. */, +- dirty); +- vm->pageInfo[unpinGuestPPI].attr.fields.pinned = 0; +- } +- +- /* Pin the requested guest physical page in the host OS. */ +- if ( !hostOSGetAndPinUserPage(vm, +- vm->guestPhyMemAddr + (reqGuestPPI<<12), +- &vm->hostStructPagePtr[reqGuestPPI], +- &hostPPI, +- 0 /* Don't need a host kernel address. */ +- ) ) { +- hostOSPrint("handlePagePinReq: request to pin failed.\n"); +- return(0); /* Fail. */ +- } +- +- /* Pinning activities have succeeded. Mark this physical page as being +- * pinnned, and store it's physical address. +- */ +- vm->pageInfo[reqGuestPPI].attr.fields.pinned = 1; +- vm->pageInfo[reqGuestPPI].hostPPI = hostPPI; +- +- /* Now add this entry to the Q. */ +- vm->guestPhyPagePinQueue.ppi[qIndex] = reqGuestPPI; +- +- if (vm->guestPhyPagePinQueue.nEntries < MaxPhyPagesPinned) { +- vm->guestPhyPagePinQueue.nEntries++; +- vm->guestPhyPagePinQueue.tail = +- vm->guestPhyPagePinQueue.nEntries % MaxPhyPagesPinned; +- } +- else { +- /* Leave .nEntries at the maximum value - Q is full. */ +- vm->guestPhyPagePinQueue.tail = +- (vm->guestPhyPagePinQueue.tail + 1) % MaxPhyPagesPinned; +- } +- +- return(1); /* OK. */ +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/monitor-mon.c bochs-2.0.2+20030829/plex86/kernel/monitor-mon.c +--- bochs-2.0.2+20030829.old/plex86/kernel/monitor-mon.c 2003-01-09 04:02:31.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/monitor-mon.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,63 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * system-mon.c: The 'motherboard' logic which connects the entire +- * PC system. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#include "plex86.h" +-#define IN_MONITOR_SPACE +-#include "monitor.h" +- +- void +-sysFlushPrintBuf(vm_t *vm) +-{ +- CLI(); +- vm->mon_request = MonReqFlushPrintBuf; +- vm->guest.__mon2host(); +- STI(); +-} +- +- void +-sysRemapMonitor(vm_t *vm) +-{ +- CLI(); +- vm->mon_request = MonReqRemapMonitor; +- vm->guest.__mon2host(); +- STI(); +-} +- +- void +-toHostGuestFault(vm_t *vm, unsigned fault) +-{ +- CLI(); +- vm->mon_request = MonReqGuestFault; +- vm->guestFaultNo = fault; +- vm->guest.__mon2host(); +- STI(); +-} +- +- void +-toHostPinUserPage(vm_t *vm, Bit32u ppi) +-{ +- CLI(); +- vm->mon_request = MonReqPinUserPage; +- vm->pinReqPPI = ppi; +- vm->guest.__mon2host(); +- STI(); +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/nexus.S bochs-2.0.2+20030829/plex86/kernel/nexus.S +--- bochs-2.0.2+20030829.old/plex86/kernel/nexus.S 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/nexus.S 1970-01-01 00:00:00.000000000 +0000 +@@ -1,326 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2001 Kevin P. Lawton +- * +- * nexus.S: code to transition between host and monitor/guest +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +- +-.text +- +- +-/* This module consists of relocatable code and data necessary to +- * effect transitions between the host <--> guest. This information +- * is purposely stored in this single page, so that we have access +- * to it during our transitions between the monitor interrupt handler, +- * and our host. +- * +- * I coded the relevant parts to use completely relocatable +- * accesses to the following fields. This is necessary, so that +- * we can float this code page anywhere in the monitor's linear +- * address space. +- */ +- +-/* =============================================================== +- * NOTE: If you modify ANY of the following fields, you must also +- * update the corresponding entries in the C typedef 'nexus_t'. +- * That construct is used from C land to access values in this +- * relocatable page. +- */ +- +-.globl __nexus_start +-__nexus_start: +- +-__vm: ;.skip 4, 0 +- +-__host_gdt_info: ;.skip 6, 0 +-__host_idt_info: ;.skip 6, 0 +-__host_jmp_info: ;.skip 6, 0 +-__host_stack_info: ;.skip 6, 0 +-__host_ldt_sel: ;.skip 2, 0 +-__host_tss_sel: ;.skip 2, 0 +-__host_cr0: ;.skip 4, 0 +-__host_cr2: ;.skip 4, 0 +-__host_cr3: ;.skip 4, 0 +-__host_cr4: ;.skip 4, 0 +- +-__mon_gdt_info: ;.skip 6, 0 +-__mon_idt_info: ;.skip 6, 0 +-__mon_jmp_info: ;.skip 6, 0 +-__mon_stack_info: ;.skip 6, 0 +-__mon_ldt_sel: ;.skip 2, 0 +-__mon_tss_sel: ;.skip 2, 0 +-__mon_base: ;.skip 4, 0 +-__mon_cr0: ;.skip 4, 0 +-__mon_cr3: ;.skip 4, 0 +-__mon_cr4: ;.skip 4, 0 +-__mon_eflags: ;.skip 4, 0 +- +-__transition_pde: ;.skip 4, 0 +-__transition_pde_p_host: ;.skip 4, 0 +-__transition_pde_p_mon: ;.skip 4, 0 +-__transition_laddr: ;.skip 4, 0 +- +-/* =============================================================== +- * End NOTE. +- */ +- +-#define OFFSET_OF(field) [field - __nexus_start] +- +-/* These are the offsets of the structures above, from the */ +-/* beginning of this section. */ +-#define HOST_GDT_INFO OFFSET_OF(__host_gdt_info) +-#define HOST_IDT_INFO OFFSET_OF(__host_idt_info) +-#define HOST_JMP_INFO OFFSET_OF(__host_jmp_info) +-#define HOST_STACK_INFO OFFSET_OF(__host_stack_info) +-#define HOST_LDT_SEL OFFSET_OF(__host_ldt_sel) +-#define HOST_TSS_SEL OFFSET_OF(__host_tss_sel) +-#define HOST_CR0 OFFSET_OF(__host_cr0) +-#define HOST_CR2 OFFSET_OF(__host_cr2) +-#define HOST_CR3 OFFSET_OF(__host_cr3) +-#define HOST_CR4 OFFSET_OF(__host_cr4) +- +-#define MON_GDT_INFO OFFSET_OF(__mon_gdt_info) +-#define MON_IDT_INFO OFFSET_OF(__mon_idt_info) +-#define MON_JMP_INFO OFFSET_OF(__mon_jmp_info) +-#define MON_STACK_INFO OFFSET_OF(__mon_stack_info) +-#define MON_LDT_SEL OFFSET_OF(__mon_ldt_sel) +-#define MON_TSS_SEL OFFSET_OF(__mon_tss_sel) +-#define MON_CR0 OFFSET_OF(__mon_cr0) +-#define MON_CR3 OFFSET_OF(__mon_cr3) +-#define MON_CR4 OFFSET_OF(__mon_cr4) +-#define MON_BASE OFFSET_OF(__mon_base) +- +-#define TRANSITION_PDE OFFSET_OF(__transition_pde) +-#define TRANSITION_PDE_P_HOST OFFSET_OF(__transition_pde_p_host) +-#define TRANSITION_PDE_P_MON OFFSET_OF(__transition_pde_p_mon) +-#define TRANSITION_LADDR OFFSET_OF(__transition_laddr) +- +- +-/* To make this code page and data accesses to the fields above */ +-/* relocatable, I use the following conventions. I load EBX with */ +-/* a pointer to the beginning of this page, to be used with an */ +-/* access through the CS: segment. We can easily get the */ +-/* current EIP with a call/pop EBX, so the combination of CS:EBX, */ +-/* accesses this page no matter where it is located. */ +- +- +-/* ================================================================== */ +-.globl __host2mon /* Start function __host2mon() */ +-__host2mon: +- /* Save host context first, so it can be restored later */ +- pushfl /* Save host flags */ +- pushal /* Save host general regs */ +- pushl %es /* Save host segments */ +- pushl %ds +- pushl %fs +- pushl %gs +- +- /* Put EIP of beginning of this section in EBX to be used to */ +- /* access data. */ +- call null_call +-null_call: +- popl %ebx +- subl $(OFFSET_OF(null_call)), %ebx +- +- /* Create identity mapping of this page into the monitor context */ +- movl (TRANSITION_PDE_P_HOST)(%ebx), %eax +- movl (TRANSITION_PDE)(%ebx), %ebp +- xchgl %ebp, (%eax) /* old PDE saved in %ebp to be restored below */ +- +- /* Save host GDT, LDT, IDT, and TSS */ +- sgdt (HOST_GDT_INFO)(%ebx) +- sidt (HOST_IDT_INFO)(%ebx) +- sldt (HOST_LDT_SEL)(%ebx) +- str (HOST_TSS_SEL)(%ebx) +- +- movl %esp, (HOST_STACK_INFO)(%ebx) /* Save host SS:ESP */ +- movw %ss, (4+HOST_STACK_INFO)(%ebx) /* for later restore */ +- +- leal (OFFSET_OF(__host_cs))(%ebx), %eax /* Save the CS:EIP for monitor to */ +- movl %eax, (HOST_JMP_INFO)(%ebx) /* jump to when reloading host CS. */ +- movw %cs, (4+HOST_JMP_INFO)(%ebx) /* See __guest2host below. */ +- +- /* Save host CRx values */ +- movl %cr0, %eax +- movl %cr2, %ecx +- movl %cr4, %edx +- movl %cr3, %esi +- +- movl %eax, (HOST_CR0)(%ebx) +- movl %ecx, (HOST_CR2)(%ebx) +- movl %edx, (HOST_CR4)(%ebx) +- movl %esi, (HOST_CR3)(%ebx) +- +- /* Compute monitor CRx values */ +- movl (MON_CR0)(%ebx), %eax +- movl (MON_CR4)(%ebx), %edx +- movl (MON_CR3)(%ebx), %esi +- +- /* Before changing the PSE bit in CR4, we have to switch over */ +- /* to the new CR3 (this page identity mapped anyways). Otherwise */ +- /* the processor could flush the TLB, and reload the entry for */ +- /* this page, only to find it's marked with a 4Meg Page, but we */ +- /* have that support turned off, before we actually */ +- /* reloaded CR3! */ +- movl %esi, %cr3 /* Set monitor CR3 */ +- movl %eax, %cr0 /* Set monitor CR0 */ +- movl %edx, %cr4 /* Set monitor CR4 */ +- movl %esi, %cr3 /* Set monitor CR3 */ +- +-jmp null_jmp0 +-null_jmp0: +- +- /* Switch to monitor GDT, LDT, and IDT */ +- lgdt (MON_GDT_INFO)(%ebx) +- lidt (MON_IDT_INFO)(%ebx) +- lldt (MON_LDT_SEL)(%ebx) +- +- /* Switch to monitor stack and CS */ +- /* and jump to the monitor-side nexus page */ +- lss (MON_STACK_INFO)(%ebx), %esp +- ljmp (MON_JMP_INFO)(%ebx) +-.globl __mon_cs +-__mon_cs: +- +- /* Reset DS:EBX to point to the monitor-side nexus page */ +- movw %ss, %ax +- movw %ax, %ds /* copy SS to DS */ +- movw %ax, %es /* copy SS to ES */ +- movl %esp, %ebx +- andl $0xfffff000, %ebx +- +- /* Clear busy bit of the monitor TSS and switch to it */ +- movzwl (MON_TSS_SEL)(%ebx), %eax +- andl $0xfffffff8, %eax +- addl (MON_GDT_INFO+2)(%ebx), %eax +- subl (MON_BASE)(%ebx), %eax +- andl $0xfffffdff, 4(%eax) +- ltr (MON_TSS_SEL)(%ebx) +- +- /* We no longer need the nexus page identity mapped. Fix the mapping */ +- /* back to the way it should be, in case guest code uses it. */ +- movl (TRANSITION_PDE_P_MON)(%ebx), %eax +- movl %ebp, (%eax) /* %ebp still contains the original value */ +- movl (TRANSITION_LADDR)(%ebx), %eax +- invlpg (%eax) /* Tell TLB about the change */ +-/* +++ xxx fix this, need to convert pure laddr to offset */ +-movl %cr3, %eax /* +++ xxx */ +-movl %eax, %cr3 /* +++ xxx */ +- +- /* */ +- /* We can now restore the monitor context from it's stack. */ +- /* */ +- popl %gs +- popl %fs +- popal /* Restore mon general registers */ +- popfl /* Restore mon eflags */ +- ret /* Resume execution in monitor exception handler code. */ +- +- +- +-/* ================================================================== */ +-.globl __mon2host /* Start function __mon2host() */ +-__mon2host: +- pushfl /* Save mon flags */ +- pushal /* Save mon general registers */ +- pushl %fs +- pushl %gs +- +- /* Set EBX to point to this nexus page */ +- movl %esp, %ebx +- andl $0xfffff000, %ebx +- +- movl %esp, (MON_STACK_INFO)(%ebx) /* Save mon ESP */ +- +- /* Identity map this code page to host address space. */ +- movl (TRANSITION_PDE_P_MON)(%ebx), %eax +- movl (TRANSITION_PDE)(%ebx), %ebp +- xchgl %ebp, (%eax) /* old PDE saved in %ebp to be restored below */ +- movl (TRANSITION_LADDR)(%ebx), %eax +- +- /* Switch EBX to point to the identity mapped copy of */ +- /* the nexus page, and jump to the copy of this code there. */ +- subl (MON_BASE)(%ebx), %eax +- invlpg (%eax) /* Tell TLB about the change */ +- movl %eax, %ebx +- leal (OFFSET_OF(__mon_nexus_jmp))(%ebx), %eax +- jmp *%eax +-__mon_nexus_jmp: +- +- /* We are still in the monitor context, but are running at the */ +- /* same CS.base+EIP location in either host or monitor context, */ +- /* and this page is identity mapped between the 2 contexts. */ +- /* We can now switch to the host CR3, and be sure that execution */ +- /* will resume at the next instruction. */ +- +- /* NOTE: Don't try to access the stack after CR3 was reloaded */ +- /* but before we switched back to the host stack! */ +- +- /* Restore host CRx values */ +- movl (HOST_CR0)(%ebx), %eax +- movl (HOST_CR2)(%ebx), %ecx +- movl (HOST_CR4)(%ebx), %edx +- movl (HOST_CR3)(%ebx), %esi +- +- movl %eax, %cr0 +- movl %ecx, %cr2 +- movl %edx, %cr4 +- movl %esi, %cr3 +- +-jmp null_jmp1 +-null_jmp1: +- +- /* Switch to host GDT, LDT, and IDT */ +- lgdt (HOST_GDT_INFO)(%ebx) +- lidt (HOST_IDT_INFO)(%ebx) +- lldt (HOST_LDT_SEL)(%ebx) +- +- /* Restore host stack and CS */ +- lss (HOST_STACK_INFO)(%ebx), %esp +- ljmp (HOST_JMP_INFO)(%ebx) +-__host_cs: +- +- /* Clear busy bit of the host TSS and switch to it */ +- /* Note that DS is still the monitor segment with base (MON_BASE). */ +- movzwl (HOST_TSS_SEL)(%ebx), %eax +- andl $0xfffffff8, %eax +- addl (HOST_GDT_INFO+2)(%ebx), %eax +- subl (MON_BASE)(%ebx), %eax +- andl $0xfffffdff, 4(%eax) +- ltr (HOST_TSS_SEL)(%ebx) +- +- /* We no longer need the nexus page identity mapped, so we clean */ +- /* up the monitor page directory in case the host looks at it. */ +- /* Note that SS is already the host segment. */ +- movl (TRANSITION_PDE_P_HOST)(%ebx), %eax +- ss; movl %ebp, (%eax) /* %ebp still contains the original value */ +- +- /* Now we can restore the rest of */ +- /* the host context from the host stack. Look at __host2guest */ +- /* for the format of the values stored on the host stack. */ +- popl %gs +- popl %fs +- popl %ds +- popl %es +- popal +- popfl +- ret +- +-.globl __nexus_end +-__nexus_end: +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/paging-mon.c bochs-2.0.2+20030829/plex86/kernel/paging-mon.c +--- bochs-2.0.2+20030829.old/plex86/kernel/paging-mon.c 2003-01-10 04:27:51.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/paging-mon.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,767 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * paging-mon.c: Virtualized (monitor) paging functionality. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +-#include "plex86.h" +-#define IN_MONITOR_SPACE +-#include "monitor.h" +- +- +- +-static unsigned allocatePT(vm_t *, unsigned pdi); +-static unsigned strengthenPagePermissions(vm_t *, phyPageInfo_t *usage, +- unsigned new_access_perm); +-/*static void sanity_check_pdir(vm_t *vm, unsigned id, Bit32u guest_laddr); */ +- +-/* +++ fix retrieve mon pages function and .base issue */ +-/* also open_guest_phy_page expects shifted page val */ +-/* +++ write_physical() has hack to ignore when perm!=RW, fix! */ +-/* +++ add async handling in emulation.c, like in preGuest() */ +- +-/* Cases which would generate a mon #PF */ +-/* ==================================== */ +-/* lazy map */ +-/* r/w to current code page */ +-/* guest #PF (access checks of cpl,rw) */ +-/* w to RO construct */ +-/* r/w to NA construct */ +- +-/* inhibits */ +- +- +-#if 0 +-======= Old notes ===================================================== +-IDT,GDT,LDT: limit = 64K; TR is a dont care +-What to do with PDir, PTbl? +-What to do about coherence probs with page tables and TLB? +-When are A,D bits copied between monitor and host? +-Need check for mapping of space used by monitor +- +-Code cache probably should not have laddr in it +- +-guest.PG==0, how are phy pages unmarked when constructs move? +-guest.PG transition: dump everything (flush) +- +-remapping descriptor tables after page flush +-make sure to validate phy_attr everywhere before using it. +- +-checks for the phy_attr of page that PDir goes in +-page fault because of monP?E.RW==0, but guestP?E==1 +- +-/* +++ what about virtualized linear structs like GDT, IDT, ... */ +-#endif +- +-#warning "Have to be careful unpinning a page which is open" +-#warning " via open_guest_phy_page(). Multiple pages could be" +-#warning " open in the page walk at one time until D/A bits are set." +- +- +- static inline Bit32u +-getHostOSPinnedPage(vm_t *vm, Bit32u ppi) +-{ +- /* If physical page is already pinned by host OS, then we already +- * know the physical address of the page. +- */ +- if (vm->pageInfo[ppi].attr.fields.pinned) +- return( vm->pageInfo[ppi].hostPPI ); +- +- /* Page is not already pinned by the host OS. We need to request +- * from the host OS, that this page is pinned and find the +- * physical address. +- */ +- toHostPinUserPage(vm, ppi); +- if ( !vm->pageInfo[ppi].attr.fields.pinned ) +- monpanic(vm, "getHostOSPinnedPage: page was not marked pinned.\n"); +- return( vm->pageInfo[ppi].hostPPI ); +-} +- +- +- unsigned +-allocatePT(vm_t *vm, unsigned pdi) +-{ +- unsigned map_i; +- +- /* Allocate one of the (preallocated) pages for */ +- /* the monitor to use for a page table at the PDI given. */ +- +- map_i = vm->ptbl_laddr_map_i; +- +- if (map_i >= MON_PAGE_TABLES) { +- monpanic(vm, "allocatePT: out of page tables\n"); +- } +-#if ANAL_CHECKS +- if (vm->guest.addr.page_tbl_laddr_map[pdi] != -1) { +- monprint(vm, "allocatePT: check failed.\n"); +- monpanic(vm, " pdi=0x%x, laddr_map=0x%x\n", +- pdi, vm->guest.addr.page_tbl_laddr_map[pdi]); +- } +-#endif +- vm->guest.addr.page_tbl_laddr_map[pdi] = map_i; +- vm->ptbl_laddr_map_i++; +- return(map_i); +-} +- +- unsigned +-getMonPTi(vm_t *vm, unsigned pdi, unsigned source) +-{ +- unsigned map_i; +- map_i = vm->guest.addr.page_tbl_laddr_map[pdi]; +-#if ANAL_CHECKS +- if (map_i == -1) { +- monprint(vm, "getMonPTi: check failed.\n"); +- monpanic(vm, " pdi=0x%x, map_i=0x%x, source=%u\n", +- pdi, map_i, source); +- } +- if (map_i >= MON_PAGE_TABLES) +- monpanic(vm, "getMonPTi: map_i OOB\n"); +-#endif +- return(map_i); +-} +- +- +-/* Invalidate the mapping of a guest page in the monitor. +- * When situations change, such as a change in the permissions +- * necessary to virtualize the page properly, we'll need to do +- * this first, before remapping with the new permissions. +- */ +- unsigned +-strengthenPagePermissions(vm_t *vm, phyPageInfo_t *pusage, +- unsigned new_access_perm) +-{ +- pusage->attr.fields.access_perm = new_access_perm; +- +- if (pusage->attr.fields.lmap_count == 0) { +- /* No linear addresses are mapped to this phy page yet. +- * Nothing to do. */ +- return 0; +- } +- else if (pusage->attr.fields.lmap_count == 1) { +- /* One linear address is mapped to this phy page. */ +- Bit32u pdi, pti; +- pageEntry_t *monPDE, *monPTE; +- page_t *monPTbl; +- unsigned map_i; +- +- pdi = (pusage->attr.fields.laddr_backlink >> 10); +- pti = (pusage->attr.fields.laddr_backlink & 0x3ff); +- monPDE = &vm->guest.addr.page_dir[pdi]; +- if ( !monPDE->fields.P ) +- monpanic(vm, "strengthenPP: monPDE.P==0\n"); +- map_i = getMonPTi(vm,pdi,10); +- monPTbl = &vm->guest.addr.page_tbl[map_i]; +- monPTE = &monPTbl->pte[pti]; +- if ( !monPTE->fields.P ) { +- +-/*monprint(vm, "strengthenPP: bl=0x%x, AP=%u\n", +- *pusage->attr.fields.laddr_backlink, new_access_perm); */ +- +- /*monpanic(vm, "strengthenPP: monPTE.P==0\n"); */ +- } +- else if (pusage->attr.fields.access_perm==PagePermNA) { +- /* Permissions were changed to No Access */ +- monPTE->raw = 0; +- } +- else if (pusage->attr.fields.access_perm==PagePermRO) { +- /* Permissions were changed to RO */ +- monPTE->fields.RW = 0; +- } +- else { +- monpanic(vm, "strengthenPP: PagePermRW\n"); +- } +- /* Flush the old TLB entry */ +- invlpg_mon_offset( +- Guest2Monitor(vm, pusage->attr.fields.laddr_backlink<<12) +- ); +- return 0; +- } +- else { +- /* Multiple linear addresses are mapped to this phy page. */ +- /* Since we dont store enough backlink info to virtualize all */ +- /* linear addresses which point to this phy page, we have to dump */ +- /* all dynamic mappings and start over. */ +-monpanic(vm, "strengthenPP: multiple lin addr\n"); +-/*monPagingRemap(vm);*/ +- return 1; +- } +-} +- +- unsigned +-addPageAttributes(vm_t *vm, Bit32u ppi, Bit32u req_attr) +-{ +- phyPageInfo_t *pusage; +- unsigned new_access_perm; +- +- VM_ASSERT(vm, ppi < vm->pages.guest_n_pages); +- +- pusage = &vm->pageInfo[ppi]; +- if (pusage->tsc < vm->vpaging_tsc) { +- /* The dynamic attributes for this page are not valid since +- * the last remap. getPageUsage() has logic to build attributes. +- */ +- getPageUsage(vm, ppi); +- } +- +- /* Build new attributes based on old ones, and requested ones. */ +- pusage->attr.raw |= req_attr; +- +- /* Look at strength of new access restrictions */ +- if (pusage->attr.raw & PageUsageCausesNA) +- new_access_perm = PagePermNA; +- else if (pusage->attr.raw & PageUsageCausesRO) +- new_access_perm = PagePermRO; +- else +- new_access_perm = PagePermRW; +- +- if (new_access_perm > pusage->attr.fields.access_perm) { +- /* New usage causes a stronger access restriction. Remap them. */ +- return( strengthenPagePermissions(vm, pusage, new_access_perm) ); +- } +- return 0; +-} +- +- phyPageInfo_t * +-getPageUsage(vm_t *vm, Bit32u ppi) +-{ +- phyPageInfo_t *pusage; +- +- VM_ASSERT(vm, ppi < vm->pages.guest_n_pages); +- pusage = &vm->pageInfo[ppi]; +- +- if (pusage->tsc < vm->vpaging_tsc) { +- /* The dynamic attributes for this page are not valid since +- * the last remap. Clear them out, and timestamp. +- */ +- pusage->tsc = vm_rdtsc(); +- pusage->attr.raw &= PageUsageSticky; +- if (pusage->attr.raw & PageUsageCausesNA) +- pusage->attr.fields.access_perm = PagePermNA; +- else if (pusage->attr.raw & PageUsageCausesRO) +- pusage->attr.fields.access_perm = PagePermRO; +- else +- pusage->attr.fields.access_perm = PagePermRW; +- } +- return(pusage); +-} +- +- +- void * +-open_guest_phy_page(vm_t *vm, Bit32u ppi, Bit8u *mon_offset) +-{ +- page_t *pageTable; +- Bit32u pti, mon_range_offset; +- +- VM_ASSERT(vm, ppi < vm->pages.guest_n_pages); +- /* Since we rewind our CS/DS.base so that the beginning of our */ +- /* monitor pages land on the beginning of a new 4Meg boundary */ +- /* (separate PDE), find out what mon_offset is in terms of */ +- /* an offset from the beginning of the PDE boundary. */ +- mon_range_offset = ( ((Bit32u) mon_offset) - +- kernelModulePages.startOffsetPageAligned ); +- pti = (mon_range_offset >> 12) & 0x3ff; +- pageTable = vm->guest.addr.nexus_page_tbl; +- +- /* Remap the base field. All the rest of the fields are */ +- /* set previously, and can remain the same. */ +- pageTable->pte[pti].fields.base = getHostOSPinnedPage(vm, ppi); +- invlpg_mon_offset( (Bit32u) mon_offset ); +- return(mon_offset); +-} +- +- void +-close_guest_phy_page(vm_t *vm, Bit32u ppi) +-{ +- /* ppi is >> 12 already */ +- /* +++ */ +-} +- +- void +-virtualize_lconstruct(vm_t *vm, Bit32u l0, Bit32u l1, unsigned perm) +-{ +- /* Mark pages for a protected construct in linear space as */ +- /* virtualized (protected), if it is mapped into monitor space. */ +- /* Pages which are not yet mapped in, are virtualized dynamically */ +- /* when they are mapped in. */ +- +- Bit32u pdi, pdi0, pdi1, pti, pti0, pti1; +- pageEntry_t *monPDE, *monPTE; +- page_t *monPTbl; +- +-/* +++ For now, can just dump all page mappings and start over */ +-/* again. Need to complete this function, so we can virtualize */ +-/* only those pages which need it, and keep the other ones. */ +-/* +++ Need to look at perm also. */ +-monpanic(vm, "vir_lconstruct: unfinished.\n"); +-/*monPagingRemap(vm);*/ +-return; +- +- if (vm->guest.addr.guest_cpu->cr0.fields.pg) +- monpanic(vm, "virtualize_lconstruct: guest PG==1\n"); +- if (l0 >= l1) +- monpanic(vm, "virtualize_lconstruct: l0>=l1!\n"); +- if ( (l1-l0) > (64*1024) ) +- monpanic(vm, "virtualize_lconstruct: span is > 64k!\n"); +- pdi0 = l0 >> 22; +- pdi1 = l1 >> 22; +- pti0 = (l0 >> 12) & 0x000003ff; +- for (pdi=pdi0; pdi<=pdi1; pdi++) { +- if ( pdi == vm->mon_pdi ) +- monpanic(vm, "virtualize_lconstruct: conflict with monitor space\n"); +- monPDE = &vm->guest.addr.page_dir[pdi]; +- if (monPDE->fields.P) { +- if (pdi> 12) & 0x000003ff; /* use index of last address */ +- for (pti=pti0; pti<=pti1; pti++) { +-/* +++ */ +-/* +++ FIX THIS!!!, set depending on guest.CR0.PG */ +-/* +++ */ +- monPTbl = &vm->guest.addr.page_tbl[pdi]; +- monPTE = &monPTbl->pte[pti]; +- if (monPTE->fields.P) { +- /* +++ finish this! */ +- /* The physical page for this linear address is allocated */ +- /* and mapped into the monitor. We can access the attributes */ +- /* for this physical page. Even if it has been virtualized */ +- /* before, we still need to mark it since it could have been */ +- /* virtualized due to a physical page constraint. */ +- monpanic(vm, "virtualize_lconstruct: finish.\n"); +- } +- } +- } +- pti0 = 0; /* start address at boundary of next PDI */ +- } +-} +- +- unsigned +-mapGuestLinAddr(vm_t *vm, Bit32u guest_laddr, Bit32u *guest_ppi, +- unsigned req_us, unsigned req_rw, Bit32u attr, +- Bit32u *error) +-{ +- Bit32u pdi, pti; +- Bit32u guest_lpage_index, ptbl_ppi; +- page_t *monPTbl; +- pageEntry_t *monPDE, *monPTE; +- pageEntry_t *guestPDir, guestPDE, *guestPTbl, guestPTE; +- Bit32u guest_pdir_page_index; +- unsigned pt_index, us, rw; +- phyPageInfo_t *pusage; +- unsigned wasRemap = 0; +- +- guest_lpage_index = guest_laddr >> 12; +- pdi = guest_lpage_index >> 10; +- pti = guest_lpage_index & 0x3ff; +- monPDE = &vm->guest.addr.page_dir[pdi]; +- +- if (vm->guest.addr.guest_cpu->cr0.fields.pg) { +- /* Check out the guest's mapping of this address to see */ +- /* if would allow for an access. */ +- /* First, get the guest PDE */ +- guest_pdir_page_index = A20Addr(vm, vm->guest.addr.guest_cpu->cr3) >> 12; +- if (guest_pdir_page_index >= vm->pages.guest_n_pages) +- monpanic(vm, "mapGuestLinAddr: PG=1 guest PDE OOB\n"); +- /* Open a window into guest physical memory */ +- guestPDir = open_guest_phy_page(vm, guest_pdir_page_index, +- vm->guest.addr.tmp_phy_page0); +- guestPDE = guestPDir[pdi]; +- +- /* See if present, before fetching PTE */ +- if (guestPDE.fields.P==0) { +- *error = 0x00000000; /* RSVD=0, P=0 */ +- goto np_exception; +- } +- +-#if 0 +- if (vm->guestCpuIDInfo.procSignature.fields.family < 6) { +- /* Update A bit of PDE memory image if not already */ +- if ( guestPDE.fields.A == 0 ) { +- guestPDE.fields.A = 1; +- guestPDir[pdi] = guestPDE; +- } +- } +-#endif +- +- /* Second, get the guest PDE */ +- ptbl_ppi = A20PageIndex(vm, guestPDE.fields.base); +- if (ptbl_ppi >= vm->pages.guest_n_pages) +- monpanic(vm, "mapGuestLinAddr: PG=1 guest PTE OOB\n"); +- guestPTbl = open_guest_phy_page(vm, ptbl_ppi, +- vm->guest.addr.tmp_phy_page1); +- guestPTE = guestPTbl[pti]; +- +- if (guestPTE.fields.P==0) { +- *error = 0x00000000; /* RSVD=0, P=0 */ +- goto np_exception; +- } +- +-#if 0 +-/* +++ */ +- if (guestPDE.raw & PDEUnhandled) +- monpanic(vm, "mapGuestLinAddr: guestPDE 0x%08x\n", guestPDE.raw); +-#endif +- /* See if requested guest priv is weaker than guest PDE priv */ +- if (req_us > guestPDE.fields.US) { +- *error = 0x00000001; /* RSVD=0, P=1 */ +- goto access_exception; +- } +- if ( (req_rw > guestPDE.fields.RW) && +- (vm->guest.addr.guest_cpu->cr0.fields.wp || req_us) ) { +- *error = 0x00000001; /* RSVD=0, P=1 */ +- goto access_exception; +- } +- +-#warning "ignoring PTEUnhandled bits" +-#if 0 +- if (guestPTE.raw & PTEUnhandled) +- monpanic(vm, "mapGuestLinAddr: guestPTE 0x%08x\n", guestPTE.raw); +-#endif +- if (req_us > guestPTE.fields.US) { +- *error = 0x00000001; /* RSVD=0, P=1 */ +- goto access_exception; +- } +- if ( (req_rw > guestPTE.fields.RW) && +- (vm->guest.addr.guest_cpu->cr0.fields.wp || req_us) ) { +- *error = 0x00000001; /* RSVD=0, P=1 */ +- goto access_exception; +- } +- +-#if 0 +- if (vm->guestCpuIDInfo.procSignature.fields.family >= 6) { +- /* Update A bit of PDE memory image if not already */ +- if ( guestPDE.fields.A == 0 ) { +- guestPDE.fields.A = 1; +- guestPDir[pdi] = guestPDE; +- } +- } +- +- /* Update A bit in PTE memory image if not already */ +- if ( (guestPTE.fields.A == 0) || +- ((req_rw==1) && !guestPTE.fields.D) ) { +- guestPTE.fields.A = 1; +- if (req_rw==1) +- guestPTE.fields.D = 1; +- guestPTbl[pti] = guestPTE; +- } +-#endif +- +- *guest_ppi = A20PageIndex(vm, guestPTE.fields.base); +- } +- else { +- /* guest paging is off, linear address is physical address */ +- guest_pdir_page_index = 0; /* keep compiler quiet */ +- *guest_ppi = A20PageIndex(vm, guest_lpage_index); +- } +- if (*guest_ppi >= vm->pages.guest_n_pages) +- return(MapLinPPageOOB); +- +-/* +++ mapping in guest pages, check static phy_attr bits first before */ +-/* +++ allowing non-protected. */ +- +- +-mapIntoMonitor: +- +- /* At this point, we know that the guest's paging system +- * (if enabled) would allow for this access. Now we have to +- * see about mapping it into the monitor linear address space. +- */ +- pusage = getPageUsage(vm, *guest_ppi); +- +- if (wasRemap > 1) +- monpanic(vm, "wasRemap>1\n"); +- +- /* +- * Check monitor PDE +- */ +- if (monPDE->fields.P == 0) { +- /* OK, Lazy PT map/allocate */ +- if (vm->guest.addr.guest_cpu->cr0.fields.pg) { +- phyPageInfo_t *pde_pusage; +- +- pde_pusage = +- getPageUsage(vm, A20PageIndex(vm, guestPDE.fields.base)); +- if (pde_pusage->attr.raw & PageBadUsage4PTbl) { +- +-#warning "PDE->PDir hack" +-/*monprint(vm, "PDE.base=0x%x CR3=0x%x\n", +- * A20PageIndex(vm, guestPDE.fields.base), +- * A20Addr(vm, vm->guest_cpu.cr3)); +- */ +-return(MapLinEmulate); +- } +- +- if (pde_pusage->attr.raw & PageUsagePTbl) { +- /* It is possible that multiple PDE entries will point to */ +- /* the same Page Table. In this case, we need to search to */ +- /* find which one the monitor already mapped in, and get */ +- /* a pointer to the Page Table allocated by the monitor. */ +- Bit32u guest_ptbl_index; +- unsigned i; +- +- guestPDir = open_guest_phy_page(vm, guest_pdir_page_index, +- vm->guest.addr.tmp_phy_page0); +- guest_ptbl_index = A20PageIndex(vm, guestPDir[pdi].fields.base); +- monPTbl = (void *) 0; +- pt_index = 0; /* keep compiler quiet */ +- for (i=0; i<1024; i++) { +- if (i==pdi) continue; /* skip current PDI */ +- guestPDE = guestPDir[i]; +- if ( guestPDE.fields.P && +- (A20PageIndex(vm, guestPDE.fields.base)==guest_ptbl_index) ) { +- /* OK, guest has a PDE which matches. If it is mapped into */ +- /* the monitor already, then we are done searching. */ +- if (vm->guest.addr.page_dir[i].fields.P) { +- pt_index = getMonPTi(vm, i, 11); +- vm->guest.addr.page_tbl_laddr_map[pdi] = pt_index; +- monPTbl = &vm->guest.addr.page_tbl[pt_index]; +- break; +- } +- } +- } +- close_guest_phy_page(vm, guest_pdir_page_index); +- if (i>=1024) +- monpanic(vm, "mapGuestLinAddr: PDE maps to existing PTbl.\n"); +- } +- else { +- /* Allocate PT using paged scheme. */ +- pt_index = allocatePT(vm, pdi); +- monPTbl = &vm->guest.addr.page_tbl[pt_index]; +- mon_memzero(monPTbl, sizeof(*monPTbl)); +- } +- +- if (vm->guest.addr.guest_cpu->sreg[SRegCS].des.dpl==3) { +- /* For user code, we can use the guest US & RW values as-is, */ +- /* since they are honored as such with either CR0.WP value. */ +- us = guestPDE.fields.US; +- rw = guestPDE.fields.RW; +- } +- else { /* guest supervisor code */ +- /* For supervisor code, access rules are different dependent on */ +- /* the value of CR0.WP. */ +- if (vm->guest.addr.guest_cpu->cr0.fields.wp==0) { +- /* If CR0.WP=0, then supervisor code can write to any page, */ +- /* and permissions are effectively ignored. */ +- us = 1; +- rw = 1; +- } +- else { /* CR0.WP==1 */ +- /* If CR0.WP=0, then supervisor code can read from any page, */ +- /* but write permission depends on the RW bit. */ +- us = 1; +- rw = guestPDE.fields.RW; +- } +- } +- +- +- /* Base/Avail=0/G=0/PS=0/D=d/A=a/PCD=0/PWT=0/US=us/RW=rw/P=1 */ +- monPDE->raw = +- (vm->pages.page_tbl[pt_index] << 12) | (guestPDE.raw & 0x60) | +- (us<<2) | (rw<<1) | 1; +- if ( addPageAttributes(vm, A20PageIndex(vm, guestPDE.fields.base), +- PageUsagePTbl) ) { +- wasRemap++; +- goto mapIntoMonitor; +- } +- } +- else { +- /* Allocate PT using non-paged scheme. */ +- pt_index = allocatePT(vm, pdi); +- monPTbl = &vm->guest.addr.page_tbl[pt_index]; +- mon_memzero(monPTbl, 4096); +- /* Base/Avail=0/G=0/PS=0/D=0/A=0/PCD=0/PWT=0/US=1/RW=1/P=1 */ +- monPDE->raw = +- (vm->pages.page_tbl[pt_index] << 12) | 0x7; +- } +- } +- else { +- /* monPDE->P == 1 */ +- +- /* Make sure this laddr does not conflict with monitor space */ +- /* This can only happen when monPDE.P==1, since the monitor */ +- /* is always mapped in. */ +- if ( (guest_laddr & 0xffc00000) == vm->mon_pde_mask ) +- return(MapLinMonConflict); +- +- pt_index = getMonPTi(vm, pdi, 12); +- monPTbl = &vm->guest.addr.page_tbl[pt_index]; +- } +- +- monPTE = &monPTbl->pte[pti]; +- +- /* +- * Check monitor PTE +- */ +- if (monPTE->fields.P == 0) { +- if (vm->guest.addr.guest_cpu->cr0.fields.pg) { +- if (vm->guest.addr.guest_cpu->sreg[SRegCS].des.dpl==3) { +- /* For user code, we can use the guest US & RW values as-is, */ +- /* since they are honored as such with either CR0.WP value. */ +- us = guestPTE.fields.US; +- rw = guestPTE.fields.RW; +- } +- else { /* guest supervisor code */ +- /* For supervisor code, access rules are different dependent on */ +- /* the value of CR0.WP. */ +- if (vm->guest.addr.guest_cpu->cr0.fields.wp==0) { +- /* If CR0.WP=0, then supervisor code can write to any page, */ +- /* and permissions are effectively ignored. */ +- us = 1; +- rw = 1; +- } +- else { /* CR0.WP==1 */ +- /* If CR0.WP=0, then supervisor code can read from any page, */ +- /* but write permission depends on the RW bit. */ +- us = 1; +- rw = guestPTE.fields.RW; +- } +- } +- if (pusage->attr.fields.access_perm==PagePermRO) { +- rw = 0; +- if (req_rw) +- return(MapLinEmulate); +- } +- else if (pusage->attr.fields.access_perm==PagePermNA) +- return(MapLinEmulate); +- +- /* Base/Avail=0/G=0/PS=0/D=d/A=a/PCD=0/PWT=0/US=1/RW=rw/P=1 */ +- monPTE->raw = +- (getHostOSPinnedPage(vm, *guest_ppi) << 12) | (guestPTE.raw & 0x60) | +- 0x5 | (rw<<1); +- } +- else { /* CR0.PG==0 */ +- rw = 1; /* Paging off is effectively RW */ +- if (pusage->attr.fields.access_perm==PagePermRO) { +- rw = 0; +- if (req_rw) +- return(MapLinEmulate); +- } +- else if (pusage->attr.fields.access_perm==PagePermNA) +- return(MapLinEmulate); +- /* Base/Avail=0/G=0/PS=0/D=0/A=0/PCD=0/PWT=0/US=1/RW=rw/P=1 */ +- monPTE->raw = +- (getHostOSPinnedPage(vm, *guest_ppi) << 12) | 0x5 | (rw<<1); +- } +- +- /* Mark physical page as having an unvirtualized linear address +- * mapped to it. +- */ +- if (pusage->attr.fields.lmap_count == 0) { +- pusage->attr.fields.lmap_count = 1; +- pusage->attr.fields.laddr_backlink = guest_lpage_index; +- } +- else if (pusage->attr.fields.lmap_count == 1) { +- pusage->attr.fields.lmap_count = 2; /* max out count */ +- /* Count maxed out, we only store laddr_backlink of 1st mapping. */ +- } +- else { +- /* Count maxed out, we don't store any more info. */ +- } +- +- invlpg_mon_offset( Guest2Monitor(vm, guest_laddr) ); +- return(MapLinOK); +- } +- else { +- /* PTE.P == 1 */ +- return(MapLinAlreadyMapped); +- } +- +-np_exception: +-access_exception: +- *error |= (req_us<<2) | (req_rw<<1); +- return(MapLinException); +-} +- +- +- void +-guestPageFault(vm_t *vm, guest_context_t *context, Bit32u cr2) +-{ +- Bit32u guest_ppi, error, gerror; +- unsigned us, rw; +- +- /* Make sure this laddr does not conflict with monitor space */ +- if ( (cr2 & 0xffc00000) == vm->mon_pde_mask ) +- monpanic(vm, "PageFault: guest access to monitor space\n"); +- +- error = context->error; +- if (error & 0x8) /* If RSVD bits used in PDir */ +- monpanic(vm, "guestPageFault: RSVD\n"); +- +- us = vm->guest.addr.guest_cpu->sreg[SRegCS].des.dpl == 3; +- rw = (error >> 1) & 1; +- +-/* +++ should base attr (currently 0) on whether this is */ +-/* code or data??? only if siv==1 */ +- switch (mapGuestLinAddr(vm, cr2, &guest_ppi, us, rw, 0, &gerror)) { +- case MapLinOK: +- return; +- case MapLinMonConflict: +- monpanic(vm, "guestPageFault: MapLinMonConflict:\n"); +- case MapLinAlreadyMapped: +- monpanic(vm, "guestPageFault: MapLinAlreadyMapped:\n"); +- /*emulate_instr(vm, context, 2);*/ +- return; +- case MapLinPPageOOB: +- monpanic(vm, "guestPageFault: MapLinPPageOOB (0x%x):\n", cr2); +- case MapLinEmulate: +- monpanic(vm, "guestPageFault: MapLinEmulate:\n"); +- /*emulate_instr(vm, context, 3);*/ +- return; +- +- case MapLinException: +- /*monpanic(vm, "guestPageFault: emulate_exception was here.\n");*/ +- /*emulate_exception(vm, ExceptionPF, gerror);*/ +- toHostGuestFault(vm, ExceptionPF); +- return; +- +- default: +- monpanic(vm, "guestPageFault: MapLin: default case:\n"); +- } +-} +- +-#if 0 +- void +-sanity_check_pdir(vm_t *vm, unsigned id, Bit32u guest_laddr) +-{ +- pageEntry_t *monPDE; +- Bit32u pdi; +- unsigned pt_index; +- +- for (pdi=0; pdi<1024; pdi++) { +- monPDE = &vm->guest.addr.page_dir[pdi]; +- if ( (pdi!=vm->mon_pdi) && +- monPDE->fields.P ) { +- +- pt_index = vm->guest.addr.page_tbl_laddr_map[pdi]; +- if (pt_index == -1) +- monpanic(vm, "sanity_check_pdir: pt_index==-1\n"); +- if (pt_index >= vm->pages.guest_n_pages) +- monpanic(vm, "sanity_check_pdir: pt_index OOB\n"); +- if ( monPDE->fields.base != vm->pages.page_tbl[pt_index] ) { +- monprint(vm, "gaddr=0x%x\n", guest_laddr); +- monprint(vm, "pt_index=%u\n", pt_index); +- monprint(vm, "map[0x302]=%u\n", +- vm->guest.addr.page_tbl_laddr_map[0x302]); +- monpanic(vm, "sanity_check_pdir: id=%u " +- "pdi=0x%x\n", id, pdi); +- } +- } +- } +-} +-#endif +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/panic-mon.c bochs-2.0.2+20030829/plex86/kernel/panic-mon.c +--- bochs-2.0.2+20030829.old/plex86/kernel/panic-mon.c 2003-01-01 17:32:04.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/panic-mon.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,71 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * panic-mon.c: Monitor panic facility. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +-#include "plex86.h" +-#define IN_MONITOR_SPACE +-#include "monitor.h" +- +-extern int mon_vprint(vm_t *vm, char *fmt, va_list args); +- +- +-/*======================================== */ +-/* Only to be used in monitor/guest space! */ +-/*======================================== */ +- +- void +-monpanic(vm_t *vm, char *fmt, ...) +-{ +- monprint(vm, "plex86 panic: "); +- if (fmt) +- { +- va_list args; +- va_start(args, fmt); +- mon_vprint(vm, fmt, args); +- va_end(args); +- } +- +-loop: +- +- CLI(); +- +- vm->mon_request = MonReqPanic; +- vm->guest.__mon2host(); +- +- /* mon2host() should never return in this case. In case it ever */ +- /* does because our logic is broken, keep returning back to */ +- /* the host so we at least don't hang the machine. */ +- goto loop; +-} +- +- void +-monpanic_nomess(vm_t *vm) +-{ +-loop: +- CLI(); +- vm->mon_request = MonReqPanic; +- vm->guest.__mon2host(); +- +- /* mon2host() should never return in this case. In case it ever */ +- /* does because our logic is broken, keep returning back to */ +- /* the host so we at least don't hang the machine. */ +- goto loop; +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/print-mon.c bochs-2.0.2+20030829/plex86/kernel/print-mon.c +--- bochs-2.0.2+20030829.old/plex86/kernel/print-mon.c 2003-01-02 02:09:44.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/print-mon.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,262 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * print-nexus.c: Monitor debug print facility +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +-#include "plex86.h" +-#define IN_MONITOR_SPACE +-#include "monitor.h" +- +-int mon_vprint(vm_t *vm, char *fmt, va_list args); +- +-static unsigned int power_of_ten[] = { +- 1, +- 10, +- 100, +- 1000, +- 10000, +- 100000, +- 1000000, +- 10000000, +- 100000000, +- 1000000000, +- }; +- +- int +-monprint(vm_t *vm, char *fmt, ...) +-{ +- va_list args; +- int ret; +- +- va_start(args, fmt); +- ret = mon_vprint(vm, fmt, args); +- va_end(args); +- return(ret); +-} +- +- int +-mon_vprint(vm_t *vm, char *fmt, va_list args) +-{ +- unsigned offset, size; +- unsigned char *log_buff_p; +- int ret; +- +- if (vm->log_buffer_info.locked) +- return 0; +- +- vm->log_buffer_info.locked = 1; +- vm->log_buffer_info.event = 1; +- offset = vm->log_buffer_info.offset; +- +- /* Sanity check */ +- if (offset >= LOG_BUFF_SIZE) { +- vm->guest.addr.log_buffer[0] = 0; /* Null terminate. */ +- resetPrintBuf(vm); +- return(0); +- } +- +- size = LOG_BUFF_SIZE - offset; +- log_buff_p = &vm->guest.addr.log_buffer[offset]; +- +- ret = mon_vsnprintf(log_buff_p, size, fmt, args); +- +- if (ret == -1) { +- /* Terminate current contents since new print request did not work. */ +- *log_buff_p = 0; +- /* If we are in the monitor space, then we can request that the +- * current buffer contents be printed. +- */ +- resetPrintBuf(vm); +- sysFlushPrintBuf(vm); +- +- /* Print request did not fit. dump buffer contents and try again +- * using whole buffer. +- */ +- size = LOG_BUFF_SIZE; +- log_buff_p = &vm->guest.addr.log_buffer[0]; +- ret = mon_vsnprintf(log_buff_p, size, fmt, args); +- if (ret == -1) { +- /* We have serious problems. This print request will not even +- * fit in the whole buffer. +- */ +- vm->guest.addr.log_buffer[0] = 0; /* Null terminate. */ +- resetPrintBuf(vm); +- /* xxx Put error in buffer here. */ +- return(0); +- } +- } +- vm->log_buffer_info.offset += ret; +- vm->log_buffer_info.locked = 0; +-#if 0 /* Fri Dec 27 21:43:05 EST 2002 */ +- resetPrintBuf(vm); +- sysFlushPrintBuf(vm); +-#endif +- return(ret); +-} +- +- void +-resetPrintBuf(vm_t *vm) +-{ +- vm->log_buffer_info.event = 0; +- vm->log_buffer_info.locked = 0; +- vm->log_buffer_info.offset = 0; +- vm->log_buffer_info.error = 0; +-} +- +- +-/* For now, this is a simple vsnprintf() type of function. We need +- * to fill this out a little. +- */ +- +- int +-mon_vsnprintf(char *str, unsigned size, const char *fmt, va_list args) +-{ +- int count = 0; +- unsigned format_width; +- unsigned char c; +- +- while (*fmt) { +- switch (*fmt) { +- +- case '%': +- format_width = 0; +- fmt++; +- c = *fmt++; +- /* Get optional field width */ +- if ( (c>='0') && (c<='9') ) { +- do { +- format_width = (format_width * 10) + (c - '0'); +- c = *fmt++; +- } while ( (c>='0') && (c<='9') ); +- } +- /* %x: hexadecimal */ +- if ( c == 'x' ) { +- unsigned int val, leadin; +- int j; +- unsigned nibble; +- +- val = va_arg(args, unsigned int); +- leadin = 1; +- +- for (j=7; j>=0; j--) { +- nibble = (val >> (4 * j)) & 0x0f; +- if (leadin && j && !format_width && !nibble) +- continue; +- if (leadin && j && format_width && ((j+1)>format_width) && +- !nibble) +- continue; +- leadin = 0; +- if ( (count+2) >= size ) goto error; +- if (nibble <= 9) +- *str++ = nibble + '0'; +- else +- *str++ = (nibble-10) + 'A'; +- count++; +- } +- break; +- } +- +- /* %c: character */ +- if ( c == 'c' ) { +- unsigned char val; +- val = va_arg(args, unsigned); +- if ( (count+2) >= size ) goto error; +- *str++ = val; +- count++; +- break; +- } +- +- /* %s: string */ +- if ( c == 's' ) { +- unsigned char *s; +- s = va_arg(args, unsigned char *); +- if ( (count+2) >= size ) goto error; +- count++; +- while (*s) { +- if ( (count+2) >= size ) goto error; +- *str++ = *s++; /* Copy char from string to output buffer. */ +- count++; +- } +- break; +- } +- +- /* %u: unsigned int */ +- if ( c == 'u' ) { +- unsigned int val, leadin; +- int j; +- unsigned digit; +- +- val = va_arg(args, unsigned int); +- leadin = 1; +- +- for (j=9; j>=0; j--) { +- if (leadin && j && !format_width && (val < power_of_ten[j])) +- continue; +- if (leadin && j && format_width && ((j+1)>format_width) && +- (val < power_of_ten[j])) +- continue; +- leadin = 0; +- digit = (val / power_of_ten[j]); +- if ( (count+2) >= size ) goto error; +- *str++ = digit + '0'; +- count++; +- val -= (digit * power_of_ten[j]); +- } +- break; +- } +- /* %b : binary (non-standard but useful) */ +- if ( c == 'b' ) { +- unsigned int val, bit, leadin; +- int j; +- val = va_arg(args, unsigned int); +- leadin = 1; +- for (j=31; j>=0; j--) { +- bit = (val >> j) & 1; +- if (leadin && j && !format_width && !bit) +- continue; +- if (leadin && j && format_width && ((j+1)>format_width) && !bit) +- continue; +- leadin = 0; +- if ( (count+2) >= size ) goto error; +- *str++ = bit + '0'; +- count++; +- } +- break; +- } +- +- /* Error, unrecognized format char */ +- goto error; +- break; +- +- default: +- /* pass char through */ +- if ( (count+2) >= size ) goto error; +- *str++ = *fmt++; +- count++; +- break; +- } +- } +- +- *str = 0; /* Complete string with null char */ +- return(count); +- +-error: +- return(-1); +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/kernel/util-nexus.c bochs-2.0.2+20030829/plex86/kernel/util-nexus.c +--- bochs-2.0.2+20030829.old/plex86/kernel/util-nexus.c 2003-01-02 02:08:22.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/kernel/util-nexus.c 1970-01-01 00:00:00.000000000 +0000 +@@ -1,57 +0,0 @@ +-/* +- * plex86: run multiple x86 operating systems concurrently +- * Copyright (C) 1999-2003 Kevin P. Lawton +- * +- * util-nexus.c: convenience routines which can be accessed from +- * either space. +- * +- * This library is free software; you can redistribute it and/or +- * modify it under the terms of the GNU Lesser General Public +- * License as published by the Free Software Foundation; either +- * version 2 of the License, or (at your option) any later version. +- * +- * This library is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +- * Lesser General Public License for more details. +- * +- * You should have received a copy of the GNU Lesser General Public +- * License along with this library; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +- +-#include "plex86.h" +-/* These functions are available from either space. */ +-#define IN_MONITOR_SPACE +-#define IN_HOST_SPACE +-#include "monitor.h" +- +- +- +- void +-mon_memzero(void *ptr, int size) +-{ +- char *p = ptr; +- while (size--) +- *p++ = 0; +-} +- +- void +-mon_memcpy(void *dst, void *src, int size) +-{ +- char *d = dst; +- char *s = src; +- while (size--) +- *d++ = *s++; +-} +- +- void * +-mon_memset(void *dst, unsigned c, unsigned n) +-{ +- unsigned char *d = dst; +- while (n--) { +- *d++ = c; +- } +- return(dst); +-} +diff -Nur bochs-2.0.2+20030829.old/plex86/misc/load_module.sh bochs-2.0.2+20030829/plex86/misc/load_module.sh +--- bochs-2.0.2+20030829.old/plex86/misc/load_module.sh 2003-01-01 17:32:06.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/misc/load_module.sh 1970-01-01 00:00:00.000000000 +0000 +@@ -1,55 +0,0 @@ +-#! /bin/bash +-# +-# A simple script to load up the kernel module and create the device nodes +-# for it. +-# +-# Note: +-# this must be run as root +-# +- +-# Work out where the module is +-kmodule="`dirname $0`/../kernel/plex86.o" +- +-# Check that root is executing us +-if [ "$EUID" != "0" ]; then +- echo "Sorry, you need to be root for this script to work." +- echo "use 'su -c $0' and enter the root password when prompted" +- exit -1 +-fi +- +-# Check if the module exists +-if [ ! -f "$kmodule" ]; then +- echo "The kernel module ($kmodule) does not exist!" +- exit -1 +-fi +- +-# Check if the module is already loaded +-if [ "x`grep plex86 /proc/devices`" != "x" ]; then +- echo "The kernel module is already loaded!" +- exit -1 +-fi +- +-# Remove any stale device nodes +-# (extend for any minor devices created in the future) +-rm -f /dev/plex86 +- +-# Load up the module with insmod +-/sbin/insmod $kmodule +- +-# Check if the module loaded +-major=`grep plex86 /proc/devices | awk '/plex86/ {print $1;}'` +-if [ "x$major" = "x" ]; then +- echo "The kernel module failed to load!" +- exit -1 +-fi +- +-# Create the device node and set its permissions +-# (extend for any minor devices created in the future) +-if [ ! -c /dev/plex86 ]; then +- /bin/mknod /dev/plex86 c $major 0 +-fi +-chmod a+rw /dev/plex86 +- +-# Job done - Give a little positive feedback +-echo "The kernel module is sucessfully installed." +-exit 0 +diff -Nur bochs-2.0.2+20030829.old/plex86/misc/netbsd_post.sh bochs-2.0.2+20030829/plex86/misc/netbsd_post.sh +--- bochs-2.0.2+20030829.old/plex86/misc/netbsd_post.sh 2003-01-01 17:32:06.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/misc/netbsd_post.sh 1970-01-01 00:00:00.000000000 +0000 +@@ -1,17 +0,0 @@ +-#! /bin/sh +-# +-# This is the post-install script called by modload after it has loaded +-# the module. +-# +-# Sample modload commandline: +-# +-# modload -e plex86_lkmentry -p netbsd_post.sh plex86.o +-# +-if [ $# -ne 3 ]; then +- echo "$0 should only be called from modload(8) with 3 args" +- exit 1 +-fi +- +-rm -f /dev/plex86 +-mknod /dev/plex86 c $3 0 +-exit 0 +diff -Nur bochs-2.0.2+20030829.old/plex86/misc/unload_module.sh bochs-2.0.2+20030829/plex86/misc/unload_module.sh +--- bochs-2.0.2+20030829.old/plex86/misc/unload_module.sh 2003-01-01 17:32:06.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/misc/unload_module.sh 1970-01-01 00:00:00.000000000 +0000 +@@ -1,34 +0,0 @@ +-#! /bin/bash +-# +-# A simple script to unload the kernel module and remove the old device nodes +-# for it. +-# +-# Note: +-# this must be run as root +-# +- +-# Check that root is executing us +-if [ "$EUID" != "0" ]; then +- echo "Sorry, you need to be root for this script to work." +- echo "use 'su -c $0' and enter the root password when prompted" +- exit -1 +-fi +- +-# Check if the module is already loaded +-if [ "x`grep plex86 /proc/devices`" != "x" ]; then +- /sbin/rmmod plex86 +- +- # Check that it really went (OK - I'm paranoid) +- if [ "x`grep plex86 /proc/devices`" != "x" ]; then +- echo "The kernel module failed to unload!" +- exit -1 +- fi +-fi +- +-# Remove any stale device nodes +-# (extend for any minor devices created in the future) +-rm -f /dev/plex86 +- +-# Job done - Give a little positive feedback +-echo "The kernel module is no longer installed." +-exit 0 +diff -Nur bochs-2.0.2+20030829.old/plex86/plex86.h bochs-2.0.2+20030829/plex86/plex86.h +--- bochs-2.0.2+20030829.old/plex86/plex86.h 2003-01-10 04:27:51.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/plex86.h 2003-08-29 14:31:40.000000000 +0000 +@@ -1,5 +1,5 @@ + /************************************************************************ +- * $Id: plex86.h,v 1.6 2003/01/10 04:27:51 kevinlawton Exp $ ++ * $Id: plex86.h,v 1.2 2002/07/21 23:14:54 DemonLord Exp $ + ************************************************************************ + * + * plex86: run multiple x86 operating systems concurrently +@@ -33,7 +33,7 @@ + selector_t sel; + descriptor_t des; + unsigned valid; +- } __attribute__ ((packed)) guest_sreg_t; ++ } guest_sreg_t; + + #define SRegES 0 + #define SRegCS 1 +@@ -79,48 +79,6 @@ + } __attribute__ ((packed)) fields; + } __attribute__ ((packed)) cr4_t; + +-typedef struct { +- Bit32u vendorDWord0; +- Bit32u vendorDWord1; +- Bit32u vendorDWord2; +- union { +- Bit32u raw; +- struct { +- Bit32u stepping:4; +- Bit32u model:4; +- Bit32u family:4; +- Bit32u procType:2; +- Bit32u Reserved31_14:18; +- } __attribute__ ((packed)) fields; +- } __attribute__ ((packed)) procSignature; +- union { +- Bit32u raw; +- struct { +- Bit32u fpu:1; +- Bit32u vme:1; +- Bit32u de:1; +- Bit32u pse:1; +- Bit32u tsc:1; +- Bit32u msr:1; +- Bit32u pae:1; +- Bit32u mce:1; +- Bit32u cx8:1; +- Bit32u apic:1; +- Bit32u Reserved10:1; +- Bit32u sep:1; +- Bit32u mtrr:1; +- Bit32u pge:1; +- Bit32u mca:1; +- Bit32u cmov:1; +- Bit32u pat:1; +- Bit32u pse36:1; +- Bit32u Reserved22_18:5; +- Bit32u mmx:1; +- Bit32u fxsr:1; +- Bit32u Reserved31_25:7; +- } __attribute__ ((packed)) fields; +- } __attribute__ ((packed)) featureFlags; +- } __attribute__ ((packed)) cpuid_info_t; + + typedef struct { + Bit32u edi; +@@ -145,7 +103,7 @@ + Bit32u cr1, cr2, cr3; + cr4_t cr4; + unsigned a20Enable; +- } __attribute__ ((packed)) guest_cpu_t; ++ } guest_cpu_t; + + + +@@ -162,32 +120,17 @@ + #else + #include + #endif ++#define PLEX86_ALLOCVPHYS _IO('k', 2) + #define PLEX86_RESET _IO('k', 3) + #define PLEX86_TEARDOWN _IO('k', 4) + #define PLEX86_EXECUTE _IO('k', 5) +-#define PLEX86_CPUID _IO('k', 6) +-#define PLEX86_REGISTER_MEMORY _IO('k', 7) + #else ++#define PLEX86_ALLOCVPHYS 0x6b02 + #define PLEX86_RESET 0x6b03 + #define PLEX86_TEARDOWN 0x6b04 + #define PLEX86_EXECUTE 0x6b05 +-#define PLEX86_CPUID 0x6b06 +-#define PLEX86_REGISTER_MEMORY 0x6b07 + #endif + +-/* Reasons why plex86 could not execute the guest context in the VM. */ +-#define Plex86NoExecute_Method 1 +-#define Plex86NoExecute_CR0 2 +-#define Plex86NoExecute_CR4 3 +-#define Plex86NoExecute_CS 4 +-#define Plex86NoExecute_A20 5 +-#define Plex86NoExecute_Selector 6 +-#define Plex86NoExecute_DPL 7 +-#define Plex86NoExecute_EFlags 8 +-#define Plex86NoExecute_Panic 9 +-#define Plex86NoExecute_VMState 10 +- +- + /* Requests that the VM monitor makes to host-kernel space or + * host-user space. + */ +@@ -196,37 +139,8 @@ + #define MonReqRedirect 4 /* Only to host-kernel. */ + #define MonReqRemapMonitor 5 + #define MonReqGuestFault 6 +-#define MonReqPinUserPage 7 + #define MonReqPanic 8 + +-#define VMStateFDOpened 0x001 +-#define VMStateMemAllocated 0x002 +-#define VMStateGuestCPUID 0x004 +-#define VMStateRegisteredPhyMem 0x008 +-#define VMStateRegisteredPrintBuffer 0x010 +-#define VMStateRegisteredGuestCPU 0x020 +-#define VMStateInitMonitor 0x040 +-#define VMStateMapMonitor 0x080 +-#define VMStatePanic 0x100 +- +- /* State where the VM/monitor is ready to execute. */ +-#define VMStateReady (VMStateFDOpened | \ +- VMStateMemAllocated | \ +- VMStateGuestCPUID | \ +- VMStateRegisteredPhyMem | \ +- VMStateRegisteredPrintBuffer | \ +- VMStateRegisteredGuestCPU | \ +- VMStateInitMonitor | \ +- VMStateMapMonitor) +- +- /* State where all user-space memory constructs are registered with +- * the plex86 kernel module. +- */ +-#define VMStateRegisteredAll \ +- (VMStateRegisteredPhyMem | \ +- VMStateRegisteredPrintBuffer | \ +- VMStateRegisteredGuestCPU) +- + typedef struct { + unsigned state; + unsigned request; +@@ -248,12 +162,4 @@ + plex86MonitorState_t monitorState; + } plex86IoctlExecute_t; + +-typedef struct { +- unsigned nMegs; +- Bit32u guestPhyMemVector; +- +- Bit32u logBufferWindow; +- Bit32u guestCPUWindow; +- } plex86IoctlRegisterMem_t; +- + #endif /* #ifndef __PLEX86_H__ */ +diff -Nur bochs-2.0.2+20030829.old/plex86/simple.c bochs-2.0.2+20030829/plex86/simple.c +--- bochs-2.0.2+20030829.old/plex86/simple.c 1970-01-01 00:00:00.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86/simple.c 2003-08-29 14:31:40.000000000 +0000 +@@ -0,0 +1,20 @@ ++#include ++ ++ int ++main(int argc, char *argv[]) ++{ ++ unsigned i; ++ unsigned a=1, b=2; ++ unsigned count; ++ ++ if (argc != 2) return(1); ++ count = atoi(argv[1]); ++ ++ for (i=0; i +-#include +-#include +-#include "plex86-interface.h" +- +-#define LOG_THIS genlog-> +- +-unsigned plex86State = 0; +-int plex86FD = -1; +- +-asm (".comm plex86PrintBufferPage,4096,4096"); +-asm (".comm plex86GuestCPUPage,4096,4096"); +-extern Bit8u plex86PrintBufferPage[]; +-extern Bit8u plex86GuestCPUPage[]; +- +-static Bit8u *plex86MemPtr = 0; +-static size_t plex86MemSize = 0; +-static Bit8u *plex86PrintBuffer = plex86PrintBufferPage; +-static guest_cpu_t *plex86GuestCPU = (guest_cpu_t *) plex86GuestCPUPage; +- +-static void copyPlex86StateToBochs(BX_CPU_C *cpu); +-static void copyBochsDescriptorToPlex86(descriptor_t *, bx_descriptor_t *); +-static void copyPlex86DescriptorToBochs(BX_CPU_C *, +- bx_descriptor_t *, descriptor_t *); +-static int openFD(void); +- +-static unsigned faultCount[32]; +- +- +- int +-openFD(void) +-{ +- if (plex86State) { +- // This should be the first operation; no state should be set yet. +- fprintf(stderr, "plex86: openFD: plex86State = 0x%x\n", plex86State); +- return(0); // Error. +- } +- +- // Open a new VM. +- fprintf(stderr, "plex86: opening VM.\n"); +- fprintf(stderr, "plex86: trying /dev/misc/plex86..."); +- plex86FD = open("/dev/misc/plex86", O_RDWR); +- if (plex86FD < 0) { +- fprintf(stderr, "failed.\n"); +- // Try the old name. +- fprintf(stderr, "plex86: trying /dev/plex86..."); +- plex86FD = open("/dev/plex86", O_RDWR); +- if (plex86FD < 0) { +- fprintf(stderr, "failed.\n"); +- fprintf(stderr, "plex86: did you load the kernel module?" +- " Read the toplevel README file!\n"); +- perror ("open"); +- return(-1); // Error. +- } +- } +- fprintf(stderr, "OK.\n"); +- return(1); // OK. +-} +- +- unsigned +-plex86CpuInfo(BX_CPU_C *cpu) +-{ +- cpuid_info_t bochsCPUID; +- +- if (plex86FD < 0) { +- // If the plex86 File Descriptor has not been opened yet. +- if ( !openFD() ) { +- return(0); // Error. +- } +- } +- +- bochsCPUID.vendorDWord0 = cpu->cpuidInfo.vendorDWord0; +- bochsCPUID.vendorDWord1 = cpu->cpuidInfo.vendorDWord1; +- bochsCPUID.vendorDWord2 = cpu->cpuidInfo.vendorDWord2; +- bochsCPUID.procSignature.raw = cpu->cpuidInfo.procSignature; +- bochsCPUID.featureFlags.raw = cpu->cpuidInfo.featureFlags; +- +- fprintf(stderr, "plex86: passing guest CPUID to plex86.\n"); +- if ( ioctl(plex86FD, PLEX86_CPUID, &bochsCPUID) ) { +- perror("ioctl CPUID: "); +- return(0); // Error. +- } +- +- return(1); // OK. +-} +- +- unsigned +-plex86TearDown(void) +-{ +- fprintf(stderr, "plex86: plex86TearDown called.\n"); +- +- fprintf(stderr, "plex86: guest Fault Count (FYI):\n"); +- for (unsigned f=0; f<32; f++) { +- if (faultCount[f]) +- fprintf(stderr, "plex86: FC[%u] = %u\n", f, faultCount[f]); +- } +- +- if ( plex86FD < 0 ) { +- fprintf(stderr, "plex86: plex86TearDown: FD not open.\n"); +- return(0); +- } +- +- if ( plex86State & Plex86StateMMapPhyMem ) { +- fprintf(stderr, "plex86: unmapping guest physical memory.\n"); +- } +- plex86State &= ~Plex86StateMMapPhyMem; +- +- if ( plex86State & Plex86StateMMapPrintBuffer ) { +- } +- plex86State &= ~Plex86StateMMapPrintBuffer; +- +- if ( plex86State & Plex86StateMMapGuestCPU ) { +- } +- plex86State &= ~Plex86StateMMapGuestCPU; +- +- fprintf(stderr, "plex86: tearing down VM.\n"); +- if (ioctl(plex86FD, PLEX86_TEARDOWN, 0) == -1) { +- perror("ioctl TEARDOWN: "); +- return(0); // Failed. +- } +- plex86State &= ~Plex86StateMemAllocated; +- +- // Close the connection to the kernel module. +- fprintf(stderr, "plex86: closing VM device.\n"); +- if (close(plex86FD) == -1) { +- perror("close of VM device\n"); +- return(0); // Failed. +- } +- +- plex86FD = -1; // File descriptor is now closed. +- +- plex86State = 0; // For good measure. +- +- return(1); // OK. +-} +- +- unsigned +-plex86ExecuteInVM(BX_CPU_C *cpu) +-{ +- plex86IoctlExecute_t executeMsg; +- int ret; +- +- if ( plex86State != Plex86StateReady ) { +- fprintf(stderr, "plex86: plex86ExecuteInVM: not in ready state (0x%x)\n", +- plex86State); +- BX_PANIC(("plex86ExecuteInVM: bailing")); +- return(0); +- } +- +- executeMsg.executeMethod = Plex86ExecuteMethodNative; +- plex86GuestCPU->edi = cpu->gen_reg[BX_32BIT_REG_EDI].dword.erx; +- plex86GuestCPU->esi = cpu->gen_reg[BX_32BIT_REG_ESI].dword.erx; +- plex86GuestCPU->ebp = cpu->gen_reg[BX_32BIT_REG_EBP].dword.erx; +- plex86GuestCPU->esp = cpu->gen_reg[BX_32BIT_REG_ESP].dword.erx; +- plex86GuestCPU->ebx = cpu->gen_reg[BX_32BIT_REG_EBX].dword.erx; +- plex86GuestCPU->edx = cpu->gen_reg[BX_32BIT_REG_EDX].dword.erx; +- plex86GuestCPU->ecx = cpu->gen_reg[BX_32BIT_REG_ECX].dword.erx; +- plex86GuestCPU->eax = cpu->gen_reg[BX_32BIT_REG_EAX].dword.erx; +- +- plex86GuestCPU->eflags = cpu->eflags.val32; +- plex86GuestCPU->eip = cpu->dword.eip; +- +- // ES/CS/SS/DS/FS/GS +- for (unsigned s=0; s<6; s++) { +- plex86GuestCPU->sreg[s].sel.raw = cpu->sregs[s].selector.value; +- copyBochsDescriptorToPlex86(&plex86GuestCPU->sreg[s].des, +- &cpu->sregs[s].cache); +- plex86GuestCPU->sreg[s].valid = cpu->sregs[s].cache.valid; +- } +- +- // LDTR +- plex86GuestCPU->ldtr.sel.raw = cpu->ldtr.selector.value; +- copyBochsDescriptorToPlex86(&plex86GuestCPU->ldtr.des, &cpu->ldtr.cache); +- plex86GuestCPU->ldtr.valid = cpu->ldtr.cache.valid; +- +- // TR +- plex86GuestCPU->tr.sel.raw = cpu->tr.selector.value; +- copyBochsDescriptorToPlex86(&plex86GuestCPU->tr.des, &cpu->tr.cache); +- plex86GuestCPU->tr.valid = cpu->tr.cache.valid; +- +- // GDTR/IDTR +- plex86GuestCPU->gdtr.base = cpu->gdtr.base; +- plex86GuestCPU->gdtr.limit = cpu->gdtr.limit; +- plex86GuestCPU->idtr.base = cpu->idtr.base; +- plex86GuestCPU->idtr.limit = cpu->idtr.limit; +- +- plex86GuestCPU->dr0 = cpu->dr0; +- plex86GuestCPU->dr1 = cpu->dr1; +- plex86GuestCPU->dr2 = cpu->dr2; +- plex86GuestCPU->dr3 = cpu->dr3; +- plex86GuestCPU->dr6 = cpu->dr6; +- plex86GuestCPU->dr7 = cpu->dr7; +- +- plex86GuestCPU->tr3 = 0; // Unimplemented in bochs. +- plex86GuestCPU->tr4 = 0; // Unimplemented in bochs. +- plex86GuestCPU->tr5 = 0; // Unimplemented in bochs. +- plex86GuestCPU->tr6 = 0; // Unimplemented in bochs. +- plex86GuestCPU->tr7 = 0; // Unimplemented in bochs. +- +- plex86GuestCPU->cr0.raw = cpu->cr0.val32; +- plex86GuestCPU->cr1 = cpu->cr1; +- plex86GuestCPU->cr2 = cpu->cr2; +- plex86GuestCPU->cr3 = cpu->cr3; +- plex86GuestCPU->cr4.raw = cpu->cr4.registerValue; +- +- plex86GuestCPU->a20Enable = BX_GET_ENABLE_A20(); +- +- ret = ioctl(plex86FD, PLEX86_EXECUTE, &executeMsg); +- if (ret != 0) { +- fprintf(stderr, "plex86: ioctl(PLEX86_EXECUTE): "); +- switch (ret) { +- case Plex86NoExecute_Method: +- fprintf(stderr, "bad execute method.\n"); +- break; +- case Plex86NoExecute_CR0: +- fprintf(stderr, "bad CR0 value.\n"); +- break; +- case Plex86NoExecute_CR4: +- fprintf(stderr, "bad CR4 value.\n"); +- break; +- case Plex86NoExecute_CS: +- fprintf(stderr, "bad CS value.\n"); +- break; +- case Plex86NoExecute_A20: +- fprintf(stderr, "bad A20 enable value.\n"); +- break; +- case Plex86NoExecute_Selector: +- fprintf(stderr, "bad selector value.\n"); +- break; +- case Plex86NoExecute_DPL: +- fprintf(stderr, "bad descriptor DPL.\n"); +- break; +- case Plex86NoExecute_EFlags: +- fprintf(stderr, "bad EFlags.\n"); +- break; +- case Plex86NoExecute_Panic: +- fprintf(stderr, "panic.\n"); +- break; +- case Plex86NoExecute_VMState: +- fprintf(stderr, "bad VM state.\n"); +- break; +- default: +- fprintf(stderr, "ret = %d\n", ret); +- } +- } +- else { +- switch ( executeMsg.monitorState.request ) { +- case MonReqFlushPrintBuf: +- fprintf(stderr, "plex86: MonReqFlushPrintBuf:\n"); +- fprintf(stderr, "::%s\n", plex86PrintBuffer); +- break; +- case MonReqPanic: +- fprintf(stderr, "plex86: MonReqPanic:\n"); +- fprintf(stderr, "::%s\n", plex86PrintBuffer); +- break; +- //case MonReqNone: +- // copyPlex86StateToBochs(cpu); +- // return(0); /* All OK. */ +- case MonReqGuestFault: +- faultCount[ executeMsg.monitorState.guestFaultNo ]++; +- copyPlex86StateToBochs(cpu); +- return(0); /* All OK. */ +- default: +- fprintf(stderr, "plex86: executeMsg.request = %u\n", +- executeMsg.monitorState.request); +- break; +- } +- } +- +- plex86TearDown(); +- BX_PANIC(("plex86ExecuteInVM: bailing")); +- +- return(0); +-} +- +- void +-copyPlex86StateToBochs(BX_CPU_C *cpu) +-{ +- cpu->gen_reg[BX_32BIT_REG_EDI].dword.erx = plex86GuestCPU->edi; +- cpu->gen_reg[BX_32BIT_REG_ESI].dword.erx = plex86GuestCPU->esi; +- cpu->gen_reg[BX_32BIT_REG_EBP].dword.erx = plex86GuestCPU->ebp; +- cpu->gen_reg[BX_32BIT_REG_ESP].dword.erx = plex86GuestCPU->esp; +- cpu->gen_reg[BX_32BIT_REG_EBX].dword.erx = plex86GuestCPU->ebx; +- cpu->gen_reg[BX_32BIT_REG_EDX].dword.erx = plex86GuestCPU->edx; +- cpu->gen_reg[BX_32BIT_REG_ECX].dword.erx = plex86GuestCPU->ecx; +- cpu->gen_reg[BX_32BIT_REG_EAX].dword.erx = plex86GuestCPU->eax; +- +- cpu->eflags.val32 = plex86GuestCPU->eflags; +- cpu->dword.eip = plex86GuestCPU->eip; +- +- // Set fields used for exception processing. +- cpu->prev_eip = plex86GuestCPU->eip; +- cpu->prev_esp = plex86GuestCPU->esp; +- +- // ES/CS/SS/DS/FS/GS +- for (unsigned s=0; s<6; s++) { +- cpu->sregs[s].selector.value = plex86GuestCPU->sreg[s].sel.raw; +- cpu->sregs[s].cache.valid = plex86GuestCPU->sreg[s].valid; +- if ( (cpu->sregs[s].selector.value & 0xfffc) == 0 ) { +- /* Null selector. */ +- if ( cpu->sregs[s].cache.valid ) { +- plex86TearDown(); +- BX_PANIC(("copyPlex86StateToBochs: null descriptor [%u] " +- "with descriptor cache valid bit set.", s)); +- } +- /* valid bit == 0, invalidates a bochs descriptor cache. */ +- } +- else { +- /* Non-null selector. */ +- if ( cpu->sregs[s].cache.valid==0 ) { +- plex86TearDown(); +- BX_PANIC(("copyPlex86StateToBochs: non-null descriptor [%u] " +- "with descriptor cache valid bit clear.", s)); +- } +- copyPlex86DescriptorToBochs(cpu, &cpu->sregs[s].cache, +- &plex86GuestCPU->sreg[s].des); +- } +- } +-} +- +- void +-copyBochsDescriptorToPlex86(descriptor_t *plex86Desc, bx_descriptor_t *bochsDesc) +-{ +- // For now this function is a hack to convert from bochs descriptor +- // cache fields which are parsed out into separate fields, to +- // a packed descriptor format as stored in a real segment descriptor. +- // This is user only for code/data segments and the LDTR/TR. +- // Ideally, bochs would store the 64-bit segment descriptor when +- // it loads segment registers. +- +- if (bochsDesc->valid == 0) { +- memset(plex86Desc, 0, sizeof(*plex86Desc)); +- return; +- } +- plex86Desc->p = bochsDesc->p; +- plex86Desc->dpl = bochsDesc->dpl; +- plex86Desc->type = (bochsDesc->segment<<4) | bochsDesc->type; +- if (bochsDesc->segment) { +- // Code/Data segment type. +- Bit32u limit = bochsDesc->u.segment.limit; +- plex86Desc->limit_low = limit; // Only lower 16-bits. +- plex86Desc->limit_high = limit >> 16; +- Bit32u base = bochsDesc->u.segment.base; +- plex86Desc->base_low = base; +- plex86Desc->base_med = base >> 16; +- plex86Desc->base_high = base >> 24; +- plex86Desc->avl = bochsDesc->u.segment.avl; +- plex86Desc->reserved = 0; +- plex86Desc->d_b = bochsDesc->u.segment.d_b; +- plex86Desc->g = bochsDesc->u.segment.g; +- } +- else if (bochsDesc->type == 2) { +- // LDT descriptor. +- plex86Desc->limit_low = bochsDesc->u.ldt.limit; +- plex86Desc->limit_high = 0; +- Bit32u base = bochsDesc->u.ldt.base; +- plex86Desc->base_low = base; +- plex86Desc->base_med = base >> 16; +- plex86Desc->base_high = base >> 24; +- plex86Desc->avl = 0; +- plex86Desc->reserved = 0; +- plex86Desc->d_b = 0; +- plex86Desc->g = 0; +- } +- else if ( (bochsDesc->type == 9) || (bochsDesc->type==1) ) { +- // TSS +- Bit32u limit = bochsDesc->u.tss386.limit; +- plex86Desc->limit_low = limit; // Only lower 16-bits. +- plex86Desc->limit_high = limit >> 16; +- Bit32u base = bochsDesc->u.tss386.base; +- plex86Desc->base_low = base; +- plex86Desc->base_med = base >> 16; +- plex86Desc->base_high = base >> 24; +- plex86Desc->avl = bochsDesc->u.tss386.avl; +- plex86Desc->reserved = 0; +- plex86Desc->d_b = 0; +- plex86Desc->g = bochsDesc->u.tss386.g; +- } +- else { +- BX_PANIC(("copyBochsDescriptorToPlex86: desc type = %u.", +- bochsDesc->type)); +- } +-} +- +- void +-copyPlex86DescriptorToBochs(BX_CPU_C *cpu, +- bx_descriptor_t *bochsDesc, descriptor_t *plex86Desc) +-{ +- Bit32u dword1, dword2, *dwordPtr; +- dwordPtr = (Bit32u *) plex86Desc; +- +- /* We can assume little endian, since we're running an x86 VM. */ +- dword1 = dwordPtr[0]; +- dword2 = dwordPtr[1]; +- cpu->parse_descriptor(dword1, dword2, bochsDesc); +-} +- +- unsigned +-plex86RegisterGuestMemory(Bit8u *vector, unsigned bytes) +-{ +- plex86IoctlRegisterMem_t ioctlMsg; +- +- if (plex86FD < 0) { +- // If the plex86 File Descriptor has not been opened yet. +- if ( !openFD() ) { +- return(0); // Error. +- } +- } +- +- if (bytes & 0x3fffff) { +- // Memory size must be multiple of 4Meg. +- fprintf(stderr, "plex86: RegisterGuestMemory: memory size of %u bytes" +- "is not a 4Meg increment.\n", bytes); +- return(0); // Error. +- } +- if ( ((unsigned)vector) & 0xfff ) { +- // Memory vector must be page aligned. +- fprintf(stderr, "plex86: RegisterGuestMemory: vector not page aligned."); +- return(0); // Error. +- } +- ioctlMsg.nMegs = bytes >> 20; +- ioctlMsg.guestPhyMemVector = (Bit32u) vector; +- ioctlMsg.logBufferWindow = (Bit32u) plex86PrintBuffer; +- ioctlMsg.guestCPUWindow = (Bit32u) plex86GuestCPU; +- if (ioctl(plex86FD, PLEX86_REGISTER_MEMORY, &ioctlMsg) == -1) { +- return(0); // Error. +- } +- plex86MemSize = bytes; +- +- /* For now... */ +-plex86State |= Plex86StateMemAllocated; +-plex86State |= Plex86StateMMapPhyMem; +-plex86State |= Plex86StateMMapPrintBuffer; +-plex86State |= Plex86StateMMapGuestCPU; +-// Zero out printbuffer and guestcpu here? +- +- fprintf(stderr, "plex86: RegisterGuestMemory: %uMB succeeded.\n", +- ioctlMsg.nMegs); +- return(1); // OK. +-} +- +- unsigned +-plex86UnregisterGuestMemory(Bit8u *vector, unsigned bytes) +-{ +- return(1); // OK. +-} +diff -Nur bochs-2.0.2+20030829.old/plex86-interface.h bochs-2.0.2+20030829/plex86-interface.h +--- bochs-2.0.2+20030829.old/plex86-interface.h 2003-01-09 04:03:36.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86-interface.h 1970-01-01 00:00:00.000000000 +0000 +@@ -1,37 +0,0 @@ +-///////////////////////////////////////////////////////////////////////// +-//// $Id: plex86-interface.h,v 1.4 2003/01/09 04:03:36 kevinlawton Exp $ +-/////////////////////////////////////////////////////////////////////////// +-//// +-//// Copyright (C) 2002 Kevin P. Lawton +-//// +-//// This library is free software; you can redistribute it and/or +-//// modify it under the terms of the GNU Lesser General Public +-//// License as published by the Free Software Foundation; either +-//// version 2 of the License, or (at your option) any later version. +-//// +-//// This library is distributed in the hope that it will be useful, +-//// but WITHOUT ANY WARRANTY; without even the implied warranty of +-//// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-//// Lesser General Public License for more details. +-//// +-//// You should have received a copy of the GNU Lesser General Public +-//// License along with this library; if not, write to the Free Software +-//// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- +-#include "plex86/plex86.h" +- +-#define Plex86StateMemAllocated 0x01 +-#define Plex86StateMMapPhyMem 0x02 +-#define Plex86StateMMapPrintBuffer 0x04 +-#define Plex86StateMMapGuestCPU 0x08 +-#define Plex86StateReady 0x0f /* All bits set. */ +- +- +-extern unsigned plex86State; +-extern int plex86FD; +- +-extern unsigned plex86CpuInfo(BX_CPU_C *cpu); +-extern unsigned plex86TearDown(void); +-extern unsigned plex86ExecuteInVM(BX_CPU_C *cpu); +-extern unsigned plex86RegisterGuestMemory(Bit8u *vector, unsigned bytes); +-extern unsigned plex86UnregisterGuestMemory(Bit8u *vector, unsigned bytes); +diff -Nur bochs-2.0.2+20030829.old/plex86.cc bochs-2.0.2+20030829/plex86.cc +--- bochs-2.0.2+20030829.old/plex86.cc 1970-01-01 00:00:00.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86.cc 2003-08-29 14:31:40.000000000 +0000 +@@ -0,0 +1,438 @@ ++///////////////////////////////////////////////////////////////////////// ++//// $Id: plex86.cc,v 0.000 2002/12/24 09:14:54 cbothamy Exp $ ++/////////////////////////////////////////////////////////////////////////// ++//// ++//// Copyright (C) 2002 Kevin P. Lawton ++//// ++//// This library is free software; you can redistribute it and/or ++//// modify it under the terms of the GNU Lesser General Public ++//// License as published by the Free Software Foundation; either ++//// version 2 of the License, or (at your option) any later version. ++//// ++//// This library is distributed in the hope that it will be useful, ++//// but WITHOUT ANY WARRANTY; without even the implied warranty of ++//// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++//// Lesser General Public License for more details. ++//// ++//// You should have received a copy of the GNU Lesser General Public ++//// License along with this library; if not, write to the Free Software ++//// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ ++ ++#include "bochs.h" ++#include ++#include ++#include ++#include "plex86.h" ++ ++#define LOG_THIS genlog-> ++ ++ ++unsigned plex86State = 0; ++int plex86FD = -1; ++Bit8u *plex86MemPtr = 0; ++size_t plex86MemSize = 0; ++Bit8u *plex86PrintBuffer = 0; ++guest_cpu_t *plex86GuestCPU = 0; ++ ++static void copyPlex86StateToBochs(BX_CPU_C *cpu); ++static void copyBochsDescriptorToPlex86(descriptor_t *, bx_descriptor_t *); ++static void copyPlex86DescriptorToBochs(BX_CPU_C *, ++ bx_descriptor_t *, descriptor_t *); ++ ++static unsigned faultCount[32]; ++ ++ ++ int ++plex86Open(void) ++{ ++ if (plex86State) { ++ // This should be the first operation; no state should be set yet. ++ fprintf(stderr, "plex86Open: plex86State = 0x%x\n", plex86State); ++ return(-1); // Error. ++ } ++ ++ // Open a new VM. ++ fprintf(stderr, "Opening VM.\n"); ++ fprintf(stderr, "Trying /dev/misc/plex86..."); ++ plex86FD = open("/dev/misc/plex86", O_RDWR); ++ if (plex86FD >= 0) { ++ fprintf(stderr, "OK.\n"); ++ plex86State |= Plex86StateFDOpened; // Kernel device opened. ++ } ++ else { ++ fprintf(stderr, "failed.\n"); ++ // Try the old name. ++ fprintf(stderr, "Trying /dev/plex86..."); ++ plex86FD = open("/dev/plex86", O_RDWR); ++ if (plex86FD >= 0) { ++ fprintf(stderr, "OK.\n"); ++ plex86State |= Plex86StateFDOpened; // Kernel device opened. ++ } ++ else { ++ fprintf(stderr, "failed.\n"); ++ fprintf(stderr, "won't use the Plex86 backend.\n"); ++ perror ("open"); ++ } ++ } ++ ++ return(plex86FD); // File descriptor is return val. ++} ++ ++ Bit8u * ++plex86AllocateMemory(unsigned nMegs) ++{ ++ Bit8u *ptr; ++ ++ plex86MemSize = nMegs * 1024 * 1024; ++ ++ if (plex86State != Plex86StateFDOpened) { ++ fprintf(stderr, "plex86AllocateMemory: plex86State = 0x%x\n", plex86State); ++ return(0); ++ } ++ ++ // Allocate memory from the host OS for the virtual physical memory. ++ fprintf(stderr, "Allocating %dMB of physical memory in VM.\n", nMegs); ++ if (ioctl(plex86FD, PLEX86_ALLOCVPHYS, nMegs) == -1) { ++ perror("ioctl ALLOCVPHYS: "); ++ plex86TearDown(); ++ return(0); ++ } ++ plex86State |= Plex86StateMemAllocated; ++ ++ // Map guest virtual physical memory into user address space and zero it. ++ fprintf(stderr, "Mapping virtualized physical memory into monitor.\n"); ++ ptr = (Bit8u*) mmap(NULL, plex86MemSize, PROT_READ | PROT_WRITE, ++ MAP_SHARED, plex86FD, 0); ++ if (ptr == (void *) -1) { ++ perror("mmap of physical pages"); ++ plex86TearDown(); ++ return(0); ++ } ++ plex86State |= Plex86StateMMapPhyMem; ++ ++ plex86MemPtr = ptr; ++ fprintf(stderr, "Zeroing virtualized physical memory.\n"); ++ memset(ptr, 0, plex86MemSize); ++ ++ // Create a memory mapping of the monitor's print buffer into ++ // user memory. This is used for efficient printing of info that ++ // the monitor prints out. ++ fprintf(stderr, "Mapping monitor print buffer into user mem.\n"); ++ plex86PrintBuffer = (Bit8u*) mmap(NULL, 4096, PROT_READ, ++ MAP_SHARED, plex86FD, plex86MemSize + 0*4096); ++ if (plex86PrintBuffer == (void *) -1) { ++ perror("mmap of monitor print buffer"); ++ plex86TearDown(); ++ return(0); ++ } ++ plex86State |= Plex86StateMMapPrintBuffer; ++ ++ // Create a memory mapping of the monitor's guest_cpu structure into ++ // user memory. This is used for passing the guest_cpu state between ++ // user and kernel/monitor space. ++ fprintf(stderr, "Mapping guest_cpu structure into user mem.\n"); ++ plex86GuestCPU = (guest_cpu_t *) mmap(NULL, 4096, PROT_READ | PROT_WRITE, ++ MAP_SHARED, plex86FD, plex86MemSize + 1*4096); ++ if (plex86GuestCPU == (void *) -1) { ++ perror("mmap of guest_cpu structure"); ++ plex86TearDown(); ++ return(0); ++ } ++ plex86State |= Plex86StateMMapGuestCPU; ++ fprintf(stderr, "Zeroing guest_cpu structure.\n"); ++ memset(plex86GuestCPU, 0, 4096); ++ ++ // All setup has completed. ++ plex86State |= Plex86StateReady; ++ ++ return(ptr); ++} ++ ++ unsigned ++plex86TearDown(void) ++{ ++ fprintf(stderr, "plex86TearDown called.\n"); ++for (unsigned f=0; f<32; f++) { ++ if (faultCount[f]) ++ fprintf(stderr, "FC[%u] = %u\n", f, faultCount[f]); ++ } ++ ++ if ( !(plex86State & Plex86StateFDOpened) ) { ++ fprintf(stderr, "plex86TearDown: FD not open.\n"); ++ return(0); ++ } ++ ++ plex86State &= ~Plex86StateReady; // Mark as not ready any more. ++ ++ if ( plex86State & Plex86StateMMapPhyMem ) { ++ fprintf(stderr, "Unmapping guest physical memory.\n"); ++ if (munmap(plex86MemPtr, plex86MemSize) != 0) { ++ perror ("munmap of guest physical memory"); ++ return(0); // Failed. ++ } ++ } ++ plex86State &= ~Plex86StateMMapPhyMem; ++ ++ if ( plex86State & Plex86StateMMapPrintBuffer ) { ++ fprintf(stderr, "Unmapping print buffer.\n"); ++ if (munmap(plex86PrintBuffer, 4096) != 0) { ++ perror("munmap of print buffer."); ++ return(0); // Failed. ++ } ++ } ++ plex86State &= ~Plex86StateMMapPrintBuffer; ++ ++ if ( plex86State & Plex86StateMMapGuestCPU ) { ++ fprintf(stderr, "Unmapping guest_cpu structure.\n"); ++ if (munmap(plex86GuestCPU, 4096) != 0) { ++ perror("munmap of guest_cpu structure."); ++ return(0); // Failed. ++ } ++ } ++ plex86State &= ~Plex86StateMMapGuestCPU; ++ ++ fprintf(stderr, "Tearing down VM.\n"); ++ if (ioctl(plex86FD, PLEX86_TEARDOWN, 0) == -1) { ++ perror("ioctl TEARDOWN: "); ++ return(0); // Failed. ++ } ++ plex86State &= ~Plex86StateMemAllocated; ++ ++ // Close the connection to the kernel module. ++ fprintf(stderr, "Closing VM device.\n"); ++ if (close(plex86FD) == -1) { ++ perror("close of VM device\n"); ++ return(0); // Failed. ++ } ++ plex86State &= ~Plex86StateFDOpened; ++ ++ plex86State = 0; // For good measure. ++ ++ return(1); // OK. ++} ++ ++ unsigned ++plex86ExecuteInVM(BX_CPU_C *cpu) ++{ ++ plex86IoctlExecute_t executeMsg; ++ int ret; ++ ++ if ( (plex86State & Plex86StateReady) == 0 ) { ++ fprintf(stderr, "plex86ExecuteInVM: not in ready state (0x%x)\n", ++ plex86State); ++ return(0); ++ } ++ ++ executeMsg.executeMethod = Plex86ExecuteMethodNative; ++ plex86GuestCPU->edi = cpu->gen_reg[BX_32BIT_REG_EDI].dword.erx; ++ plex86GuestCPU->esi = cpu->gen_reg[BX_32BIT_REG_ESI].dword.erx; ++ plex86GuestCPU->ebp = cpu->gen_reg[BX_32BIT_REG_EBP].dword.erx; ++ plex86GuestCPU->esp = cpu->gen_reg[BX_32BIT_REG_ESP].dword.erx; ++ plex86GuestCPU->ebx = cpu->gen_reg[BX_32BIT_REG_EBX].dword.erx; ++ plex86GuestCPU->edx = cpu->gen_reg[BX_32BIT_REG_EDX].dword.erx; ++ plex86GuestCPU->ecx = cpu->gen_reg[BX_32BIT_REG_ECX].dword.erx; ++ plex86GuestCPU->eax = cpu->gen_reg[BX_32BIT_REG_EAX].dword.erx; ++ ++ plex86GuestCPU->eflags = cpu->eflags.val32; ++ plex86GuestCPU->eip = cpu->dword.eip; ++ ++ // ES/CS/SS/DS/FS/GS ++ for (unsigned s=0; s<6; s++) { ++ plex86GuestCPU->sreg[s].sel.raw = cpu->sregs[s].selector.value; ++ copyBochsDescriptorToPlex86(&plex86GuestCPU->sreg[s].des, ++ &cpu->sregs[s].cache); ++ plex86GuestCPU->sreg[s].valid = cpu->sregs[s].cache.valid; ++ } ++ ++ // LDTR ++ plex86GuestCPU->ldtr.sel.raw = cpu->ldtr.selector.value; ++ copyBochsDescriptorToPlex86(&plex86GuestCPU->ldtr.des, &cpu->ldtr.cache); ++ plex86GuestCPU->ldtr.valid = cpu->ldtr.cache.valid; ++ ++ // TR ++ plex86GuestCPU->tr.sel.raw = cpu->tr.selector.value; ++ copyBochsDescriptorToPlex86(&plex86GuestCPU->tr.des, &cpu->tr.cache); ++ plex86GuestCPU->tr.valid = cpu->tr.cache.valid; ++ ++ // GDTR/IDTR ++ plex86GuestCPU->gdtr.base = cpu->gdtr.base; ++ plex86GuestCPU->gdtr.limit = cpu->gdtr.limit; ++ plex86GuestCPU->idtr.base = cpu->idtr.base; ++ plex86GuestCPU->idtr.limit = cpu->idtr.limit; ++ ++ plex86GuestCPU->dr0 = cpu->dr0; ++ plex86GuestCPU->dr1 = cpu->dr1; ++ plex86GuestCPU->dr2 = cpu->dr2; ++ plex86GuestCPU->dr3 = cpu->dr3; ++ plex86GuestCPU->dr6 = cpu->dr6; ++ plex86GuestCPU->dr7 = cpu->dr7; ++ ++ plex86GuestCPU->tr3 = 0; // Unimplemented in bochs. ++ plex86GuestCPU->tr4 = 0; // Unimplemented in bochs. ++ plex86GuestCPU->tr5 = 0; // Unimplemented in bochs. ++ plex86GuestCPU->tr6 = 0; // Unimplemented in bochs. ++ plex86GuestCPU->tr7 = 0; // Unimplemented in bochs. ++ ++ plex86GuestCPU->cr0.raw = cpu->cr0.val32; ++ plex86GuestCPU->cr1 = cpu->cr1; ++ plex86GuestCPU->cr2 = cpu->cr2; ++ plex86GuestCPU->cr3 = cpu->cr3; ++ plex86GuestCPU->cr4.raw = cpu->cr4.registerValue; ++ ++ plex86GuestCPU->a20Enable = BX_GET_ENABLE_A20(); ++ ++ ret = ioctl(plex86FD, PLEX86_EXECUTE, &executeMsg); ++ if (ret < 0) { ++ fprintf(stderr, "ioctl(PLEX86_EXECUTE) returns < 0\n"); ++ } ++ ++ switch ( executeMsg.monitorState.request ) { ++ case MonReqFlushPrintBuf: ++ fprintf(stderr, "MonReqFlushPrintBuf:\n"); ++ fprintf(stderr, "::%s\n", plex86PrintBuffer); ++ break; ++ case MonReqPanic: ++ fprintf(stderr, "MonReqPanic:\n"); ++ fprintf(stderr, "::%s\n", plex86PrintBuffer); ++ break; ++ //case MonReqNone: ++ // copyPlex86StateToBochs(cpu); ++ // return(0); /* All OK. */ ++ case MonReqGuestFault: ++ faultCount[ executeMsg.monitorState.guestFaultNo ]++; ++ copyPlex86StateToBochs(cpu); ++ return(0); /* All OK. */ ++ default: ++ fprintf(stderr, "executeMsg.request = %u\n", ++ executeMsg.monitorState.request); ++ break; ++ } ++ ++ plex86TearDown(); ++ BX_PANIC(("plex86ExecuteInVM: bailing")); ++ ++ return(0); ++} ++ ++ void ++copyPlex86StateToBochs(BX_CPU_C *cpu) ++{ ++ cpu->gen_reg[BX_32BIT_REG_EDI].dword.erx = plex86GuestCPU->edi; ++ cpu->gen_reg[BX_32BIT_REG_ESI].dword.erx = plex86GuestCPU->esi; ++ cpu->gen_reg[BX_32BIT_REG_EBP].dword.erx = plex86GuestCPU->ebp; ++ cpu->gen_reg[BX_32BIT_REG_ESP].dword.erx = plex86GuestCPU->esp; ++ cpu->gen_reg[BX_32BIT_REG_EBX].dword.erx = plex86GuestCPU->ebx; ++ cpu->gen_reg[BX_32BIT_REG_EDX].dword.erx = plex86GuestCPU->edx; ++ cpu->gen_reg[BX_32BIT_REG_ECX].dword.erx = plex86GuestCPU->ecx; ++ cpu->gen_reg[BX_32BIT_REG_EAX].dword.erx = plex86GuestCPU->eax; ++ ++ cpu->eflags.val32 = plex86GuestCPU->eflags; ++ cpu->dword.eip = plex86GuestCPU->eip; ++ ++ // Set fields used for exception processing. ++ cpu->prev_eip = plex86GuestCPU->eip; ++ cpu->prev_esp = plex86GuestCPU->esp; ++ ++ // ES/CS/SS/DS/FS/GS ++ for (unsigned s=0; s<6; s++) { ++ cpu->sregs[s].selector.value = plex86GuestCPU->sreg[s].sel.raw; ++ cpu->sregs[s].cache.valid = plex86GuestCPU->sreg[s].valid; ++ if ( (cpu->sregs[s].selector.value & 0xfffc) == 0 ) { ++ /* Null selector. */ ++ if ( cpu->sregs[s].cache.valid ) { ++ plex86TearDown(); ++ BX_PANIC(("copyPlex86StateToBochs: null descriptor [%u] " ++ "with descriptor cache valid bit set.", s)); ++ } ++ /* valid bit == 0, invalidates a bochs descriptor cache. */ ++ } ++ else { ++ /* Non-null selector. */ ++ if ( cpu->sregs[s].cache.valid==0 ) { ++ plex86TearDown(); ++ BX_PANIC(("copyPlex86StateToBochs: non-null descriptor [%u] " ++ "with descriptor cache valid bit clear.", s)); ++ } ++ copyPlex86DescriptorToBochs(cpu, &cpu->sregs[s].cache, ++ &plex86GuestCPU->sreg[s].des); ++ } ++ } ++} ++ ++ void ++copyBochsDescriptorToPlex86(descriptor_t *plex86Desc, bx_descriptor_t *bochsDesc) ++{ ++ // For now this function is a hack to convert from bochs descriptor ++ // cache fields which are parsed out into separate fields, to ++ // a packed descriptor format as stored in a real segment descriptor. ++ // This is user only for code/data segments and the LDTR/TR. ++ // Ideally, bochs would store the 64-bit segment descriptor when ++ // it loads segment registers. ++ ++ if (bochsDesc->valid == 0) { ++ memset(plex86Desc, 0, sizeof(*plex86Desc)); ++ return; ++ } ++ plex86Desc->p = bochsDesc->p; ++ plex86Desc->dpl = bochsDesc->dpl; ++ plex86Desc->type = (bochsDesc->segment<<4) | bochsDesc->type; ++ if (bochsDesc->segment) { ++ // Code/Data segment type. ++ Bit32u limit = bochsDesc->u.segment.limit; ++ plex86Desc->limit_low = limit; // Only lower 16-bits. ++ plex86Desc->limit_high = limit >> 16; ++ Bit32u base = bochsDesc->u.segment.base; ++ plex86Desc->base_low = base; ++ plex86Desc->base_med = base >> 16; ++ plex86Desc->base_high = base >> 24; ++ plex86Desc->avl = bochsDesc->u.segment.avl; ++ plex86Desc->reserved = 0; ++ plex86Desc->d_b = bochsDesc->u.segment.d_b; ++ plex86Desc->g = bochsDesc->u.segment.g; ++ } ++ else if (bochsDesc->type == 2) { ++ // LDT descriptor. ++ plex86Desc->limit_low = bochsDesc->u.ldt.limit; ++ plex86Desc->limit_high = 0; ++ Bit32u base = bochsDesc->u.ldt.base; ++ plex86Desc->base_low = base; ++ plex86Desc->base_med = base >> 16; ++ plex86Desc->base_high = base >> 24; ++ plex86Desc->avl = 0; ++ plex86Desc->reserved = 0; ++ plex86Desc->d_b = 0; ++ plex86Desc->g = 0; ++ } ++ else if ( (bochsDesc->type == 9) || (bochsDesc->type==1) ) { ++ // TSS ++ Bit32u limit = bochsDesc->u.tss386.limit; ++ plex86Desc->limit_low = limit; // Only lower 16-bits. ++ plex86Desc->limit_high = limit >> 16; ++ Bit32u base = bochsDesc->u.tss386.base; ++ plex86Desc->base_low = base; ++ plex86Desc->base_med = base >> 16; ++ plex86Desc->base_high = base >> 24; ++ plex86Desc->avl = bochsDesc->u.tss386.avl; ++ plex86Desc->reserved = 0; ++ plex86Desc->d_b = 0; ++ plex86Desc->g = bochsDesc->u.tss386.g; ++ } ++ else { ++ BX_PANIC(("copyBochsDescriptorToPlex86: desc type = %u.", ++ bochsDesc->type)); ++ } ++} ++ ++ void ++copyPlex86DescriptorToBochs(BX_CPU_C *cpu, ++ bx_descriptor_t *bochsDesc, descriptor_t *plex86Desc) ++{ ++ Bit32u dword1, dword2, *dwordPtr; ++ dwordPtr = (Bit32u *) plex86Desc; ++ ++ /* We can assume little endian, since we're running an x86 VM. */ ++ dword1 = dwordPtr[0]; ++ dword2 = dwordPtr[1]; ++ cpu->parse_descriptor(dword1, dword2, bochsDesc); ++} +diff -Nur bochs-2.0.2+20030829.old/plex86.h bochs-2.0.2+20030829/plex86.h +--- bochs-2.0.2+20030829.old/plex86.h 1970-01-01 00:00:00.000000000 +0000 ++++ bochs-2.0.2+20030829/plex86.h 2003-08-29 14:31:40.000000000 +0000 +@@ -0,0 +1,41 @@ ++///////////////////////////////////////////////////////////////////////// ++//// $Id: plex86.h,v 0.000 2002/12/24 09:14:54 cbothamy Exp $ ++/////////////////////////////////////////////////////////////////////////// ++//// ++//// Copyright (C) 2002 Kevin P. Lawton ++//// ++//// This library is free software; you can redistribute it and/or ++//// modify it under the terms of the GNU Lesser General Public ++//// License as published by the Free Software Foundation; either ++//// version 2 of the License, or (at your option) any later version. ++//// ++//// This library is distributed in the hope that it will be useful, ++//// but WITHOUT ANY WARRANTY; without even the implied warranty of ++//// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++//// Lesser General Public License for more details. ++//// ++//// You should have received a copy of the GNU Lesser General Public ++//// License along with this library; if not, write to the Free Software ++//// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ ++#include "plex86/plex86.h" ++ ++#define Plex86StateFDOpened 0x01 ++#define Plex86StateMemAllocated 0x02 ++#define Plex86StateMMapPhyMem 0x04 ++#define Plex86StateMMapPrintBuffer 0x08 ++#define Plex86StateMMapGuestCPU 0x10 ++#define Plex86StateReady 0x20 ++ ++ ++extern unsigned plex86State; ++extern int plex86FD; ++extern Bit8u *plex86MemPtr; ++extern unsigned plex86MemSize; ++extern Bit8u *plex86PrintBuffer; ++extern guest_cpu_t *plex86GuestCPU; ++ ++extern int plex86Open(void); ++extern unsigned char * plex86AllocateMemory(unsigned nMegs); ++extern unsigned plex86TearDown(void); ++extern unsigned plex86ExecuteInVM(BX_CPU_C *cpu); --- bochs-2.3.5.orig/debian/patches/01_build.patch +++ bochs-2.3.5/debian/patches/01_build.patch @@ -0,0 +1,58 @@ +Index: b/bios/Makefile.in +=================================================================== +--- a/bios/Makefile.in 2007-12-05 05:51:27.000000000 +0200 ++++ b/bios/Makefile.in 2007-12-05 05:53:03.000000000 +0200 +@@ -74,9 +74,9 @@ BIOS-bochs-legacy: rombios.c apmbios.S b + $(GCC) $(BIOS_BUILD_DATE) -DLEGACY -E -P $< > _rombiosl_.c + $(BCC) -o rombiosl.s -C-c -D__i86__ -0 -S _rombiosl_.c + sed -e 's/^\.text//' -e 's/^\.data//' rombiosl.s > _rombiosl_.s +- $(AS86) _rombiosl_.s -b tmp.bin -u- -w- -g -0 -j -O -l rombiosl.txt ++ $(AS86) _rombiosl_.s -b $@.tmp.bin -u- -w- -g -0 -j -O -l rombiosl.txt + -perl ${srcdir}/makesym.perl < rombiosl.txt > rombiosl.sym +- mv tmp.bin $@ ++ mv $@.tmp.bin $@ + ./biossums $@ + @RMCOMMAND@ _rombiosl_.s + +@@ -85,9 +85,9 @@ rombios16.bin: rombios.c apmbios.S bioss + $(GCC) $(BIOS_BUILD_DATE) -E -P $< > _rombios_.c + $(BCC) -o rombios.s -C-c -D__i86__ -0 -S _rombios_.c + sed -e 's/^\.text//' -e 's/^\.data//' rombios.s > _rombios_.s +- $(AS86) _rombios_.s -b tmp.bin -u- -w- -g -0 -j -O -l rombios.txt ++ $(AS86) _rombios_.s -b $@.tmp.bin -u- -w- -g -0 -j -O -l rombios.txt + -perl ${srcdir}/makesym.perl < rombios.txt > rombios.sym +- mv tmp.bin rombios16.bin ++ mv $@.tmp.bin rombios16.bin + ./biossums rombios16.bin + @RMCOMMAND@ _rombios_.s + +Index: b/Makefile.in +=================================================================== +--- a/Makefile.in 2007-12-05 05:49:34.000000000 +0200 ++++ b/Makefile.in 2007-12-05 05:51:20.000000000 +0200 +@@ -383,13 +383,13 @@ install_doc:: + + + build_docbook:: +- cd doc/docbook; make ++ $(MAKE) -C doc/docbook + + dl_docbook:: +- cd doc/docbook; make dl_docs ++ $(MAKE) -C doc/docbook dl_docs + + install_docbook: build_docbook +- cd doc/docbook; make install ++ $(MAKE) -C doc/docbook install + + install_man:: + -mkdir -p $(DESTDIR)$(man1dir) +@@ -445,7 +445,7 @@ v6workspace: + win32_snap: + unzip $(V6WORKSPACE_ZIP) + $(SHELL) ./build/win32/cc2cpp +- make zip ++ $(MAKE) zip + $(SHELL) ./build/win32/cpp2cc + + tar: --- bochs-2.3.5.orig/debian/patches/03_qemu_bios.patch +++ bochs-2.3.5/debian/patches/03_qemu_bios.patch @@ -0,0 +1,85 @@ +Index: b/bios/Makefile.in +=================================================================== +--- a/bios/Makefile.in 2007-12-07 07:51:07.000000000 +0200 ++++ b/bios/Makefile.in 2007-12-07 08:04:28.000000000 +0200 +@@ -57,7 +57,7 @@ BIOS_BUILD_DATE = "-DBIOS_BUILD_DATE=\"$ + $(CXX) -c $(BX_INCDIRS) $(CXXFLAGS) $(LOCAL_CXXFLAGS) @CXXFP@$< @OFP@$@ + + +-bios: biossums BIOS-bochs-latest BIOS-bochs-legacy ++bios: biossums BIOS-bochs-latest BIOS-bochs-legacy BIOS-qemu-latest + + clean: + @RMCOMMAND@ *.o *.a *.s _rombios*_.c rombios*.txt rombios*.sym +@@ -69,6 +69,7 @@ dist-clean: clean + + bios-clean: + @RMCOMMAND@ BIOS-bochs-* ++ @RMCOMMAND@ BIOS-qemu-* + + BIOS-bochs-legacy: rombios.c apmbios.S biossums rombios.h + $(GCC) $(BIOS_BUILD_DATE) -DLEGACY -E -P $< > _rombiosl_.c +@@ -80,6 +81,15 @@ BIOS-bochs-legacy: rombios.c apmbios.S b + ./biossums $@ + @RMCOMMAND@ _rombiosl_.s + ++rombios16-qemu.bin: rombios.c apmbios.S biossums rombios.h ++ $(GCC) $(BIOS_BUILD_DATE) -DBX_QEMU -E -P $< > _rombiosq_.c ++ $(BCC) -o rombiosq.s -C-c -D__i86__ -0 -S _rombiosq_.c ++ sed -e 's/^\.text//' -e 's/^\.data//' rombiosq.s > _rombiosq_.s ++ $(AS86) _rombiosq_.s -b $@.tmp.bin -u- -w- -g -0 -j -O -l rombiosq.txt ++ -perl ${srcdir}/makesym.perl < rombiosq.txt > rombiosq.sym ++ mv $@.tmp.bin $@ ++ ./biossums $@ ++ @RMCOMMAND@ _rombiosq_.s + + rombios16.bin: rombios.c apmbios.S biossums rombios.h + $(GCC) $(BIOS_BUILD_DATE) -E -P $< > _rombios_.c +@@ -96,12 +106,22 @@ rombios32.bin: rombios32.out rombios.h + objcopy -O binary $< $@ + ./biossums -pad $@ + ++rombios32-qemu.bin: rombios32-qemu.out rombios.h ++ objcopy -O binary $< $@ ++ ./biossums -pad $@ ++ + rombios32.out: rombios32start.o rombios32.o rombios32.ld + ld -o $@ -T rombios32.ld rombios32start.o rombios32.o + ++rombios32-qemu.out: rombios32start.o rombios32-qemu.o rombios32.ld ++ ld -o $@ -T rombios32.ld rombios32start.o rombios32-qemu.o ++ + rombios32.o: rombios32.c acpi-dsdt.hex + $(GCC) -O2 -Wall -c -o $@ $< + ++rombios32-qemu.o: rombios32.c acpi-dsdt.hex ++ $(GCC) -DBX_QEMU -O2 -Wall -c -o $@ $< ++ + ifeq ("1", "0") + acpi-dsdt.hex: acpi-dsdt.dsl + iasl -tc -p $@ $< +@@ -113,5 +133,8 @@ rombios32start.o: rombios32start.S + BIOS-bochs-latest: rombios16.bin rombios32.bin + cat rombios32.bin rombios16.bin > $@ + ++BIOS-qemu-latest: rombios16-qemu.bin rombios32-qemu.bin ++ cat rombios32-qemu.bin rombios16-qemu.bin > $@ ++ + biossums: biossums.c + $(GCC) -o biossums biossums.c +Index: b/bios/rombios32.c +=================================================================== +--- a/bios/rombios32.c 2007-09-15 10:24:04.000000000 +0300 ++++ b/bios/rombios32.c 2007-12-07 07:51:16.000000000 +0200 +@@ -864,6 +864,11 @@ static void mptable_init(void) + int ioapic_id, i, len; + int mp_config_table_size; + ++#ifdef BX_QEMU ++ if (smp_cpus <= 1) ++ return; ++#endif ++ + #ifdef BX_USE_EBDA_TABLES + mp_config_table = (uint8_t *)(ram_size - ACPI_DATA_SIZE - MPTABLE_MAX_SIZE); + #else --- bochs-2.3.5.orig/debian/patches/10_enable_iasl.patch +++ bochs-2.3.5/debian/patches/10_enable_iasl.patch @@ -0,0 +1,15 @@ +Index: b/bios/Makefile.in +=================================================================== +--- a/bios/Makefile.in 2007-12-07 08:04:28.000000000 +0200 ++++ b/bios/Makefile.in 2007-12-07 08:05:12.000000000 +0200 +@@ -122,10 +122,8 @@ rombios32.o: rombios32.c acpi-dsdt.hex + rombios32-qemu.o: rombios32.c acpi-dsdt.hex + $(GCC) -DBX_QEMU -O2 -Wall -c -o $@ $< + +-ifeq ("1", "0") + acpi-dsdt.hex: acpi-dsdt.dsl + iasl -tc -p $@ $< +-endif + + rombios32start.o: rombios32start.S + $(GCC) -c -o $@ $< --- bochs-2.3.5.orig/debian/patches/series +++ bochs-2.3.5/debian/patches/series @@ -0,0 +1,7 @@ +00_base.patch +01_build.patch +02_libtool.patch +03_qemu_bios.patch +04_man_table.patch +10_enable_iasl.patch +11_no-ssp.patch --- bochs-2.3.5.orig/debian/patches/11_no-ssp.patch +++ bochs-2.3.5/debian/patches/11_no-ssp.patch @@ -0,0 +1,17 @@ +Index: bochs-2.3.5-1ubuntu1/bios/Makefile.in +=================================================================== +--- bochs-2.3.5-1ubuntu1.orig/bios/Makefile.in 2007-12-10 12:19:37.792399272 +0100 ++++ bochs-2.3.5-1ubuntu1/bios/Makefile.in 2007-12-10 12:20:06.376768137 +0100 +@@ -117,10 +117,10 @@ + ld -o $@ -T rombios32.ld rombios32start.o rombios32-qemu.o + + rombios32.o: rombios32.c acpi-dsdt.hex +- $(GCC) -O2 -Wall -c -o $@ $< ++ $(GCC) -fno-stack-protector -O2 -Wall -c -o $@ $< + + rombios32-qemu.o: rombios32.c acpi-dsdt.hex +- $(GCC) -DBX_QEMU -O2 -Wall -c -o $@ $< ++ $(GCC) -fno-stack-protector -DBX_QEMU -O2 -Wall -c -o $@ $< + + acpi-dsdt.hex: acpi-dsdt.dsl + iasl -tc -p $@ $< --- bochs-2.3.5.orig/debian/control +++ bochs-2.3.5/debian/control @@ -0,0 +1,148 @@ +Source: bochs +Section: misc +Priority: extra +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Guillem Jover +Build-Depends: debhelper (>= 5), quilt (>= 0.40), + autoconf, libz-dev, libncurses5-dev, libreadline5-dev | libreadline-dev, + libaa1-dev, libsvga1-dev [i386 amd64], libx11-dev, libxpm-dev, libice-dev, + libsm-dev, libsdl1.2-dev, libwxgtk2.6-dev, libgtk2.0-dev, + libasound2-dev [i386 amd64 powerpc alpha sparc m68k arm mips mipsel s390] +Build-Depends-Indep: iasl, bcc (>= 0.16.3-2), bin86 (>= 0.16.3-2), perl, + docbook-utils +Homepage: http://bochs.sourceforge.net/ +Vcs-Browser: http://svn.debian.org/wsvn/pkg-bochs/ +Vcs-Svn: svn://svn.debian.org/pkg-bochs/trunk/ +Standards-Version: 3.7.3 + +Package: bochs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, bochs-wx | bochs-gui, + bochsbios (= ${source:Version}), vgabios (>= 0.5c-1) +Recommends: bximage | createdisk +Suggests: bochs-doc, debootstrap, grub-disk, gcc | c-compiler, libc-dev +Description: IA-32 PC emulator + Bochs is a highly portable free IA-32 (x86) PC emulator written in C++, that + runs on most popular platforms. It includes emulation of the Intel x86 CPU, + common I/O devices, and a custom BIOS. + . + Bochs is capable of running most operating systems inside the emulation + including GNU, GNU/Linux, *BSD, FreeDOS, MSDOS and Windows 95/NT. + +Package: bochs-doc +Architecture: all +Section: doc +Description: Bochs upstream documentation + This package contains the HTML documentation of the Bochs project. + . + The documentation is divided into three parts: + . + * User Guide + * Development Guide + * Documentation Guide + +Package: bochsbios +Architecture: all +Replaces: bochs (<< 2.0) +Description: BIOS for the Bochs emulator + Bochs is a highly portable free IA-32 (x86) PC emulator written in C++, that + runs on most popular platforms. It includes emulation of the Intel x86 CPU, + common I/O devices, and a custom BIOS. + . + This package contains the BIOS of the Bochs project. + +Package: bochsbios-qemu +Architecture: all +Description: Bochs BIOS for qemu + Bochs is a highly portable free IA-32 (x86) PC emulator written in C++, that + runs on most popular platforms. It includes emulation of the Intel x86 CPU, + common I/O devices, and a custom BIOS. + . + This package contains a special version of the BIOS of the Bochs project built + for qemu. + +Package: bochs-wx +Architecture: any +Depends: ${shlibs:Depends}, bochs (= ${binary:Version}) +Replaces: bochs (<< 2.0rel-1) +Provides: bochs-gui +Description: WxWindows plugin for Bochs + Bochs is a highly portable free IA-32 (x86) PC emulator written in C++, that + runs on most popular platforms. It includes emulation of the Intel x86 CPU, + common I/O devices, and a custom BIOS. + . + This package contains a WxWindows GUI plugin for Bochs. + +Package: bochs-sdl +Architecture: any +Depends: ${shlibs:Depends}, bochs (= ${binary:Version}) +Replaces: bochs (<< 2.0rel-1) +Provides: bochs-gui +Description: SDL plugin for Bochs + Bochs is a highly portable free IA-32 (x86) PC emulator written in C++, that + runs on most popular platforms. It includes emulation of the Intel x86 CPU, + common I/O devices, and a custom BIOS. + . + This package contains an SDL GUI plugin for Bochs. + . + Use Scroll-Lock key for full screen. + +Package: bochs-term +Architecture: any +Depends: ${shlibs:Depends}, bochs (= ${binary:Version}) +Replaces: bochs (<< 2.0rel-1), bochs-curses +Provides: bochs-gui +Description: Terminal (ncurses-based) plugin for Bochs + Bochs is a highly portable free IA-32 (x86) PC emulator written in C++, that + runs on most popular platforms. It includes emulation of the Intel x86 CPU, + common I/O devices, and a custom BIOS. + . + This package contains a Terminal (ncurses-based) GUI plugin for Bochs. + +Package: bochs-x +Architecture: any +Depends: ${shlibs:Depends}, bochs (= ${binary:Version}) +Replaces: bochs (<< 2.0rel-1) +Provides: bochs-gui +Description: X11 plugin for Bochs + Bochs is a highly portable free IA-32 (x86) PC emulator written in C++, that + runs on most popular platforms. It includes emulation of the Intel x86 CPU, + common I/O devices, and a custom BIOS. + . + This package contains an X11 GUI plugin for Bochs. + +Package: bochs-svga +Architecture: i386 amd64 +Depends: ${shlibs:Depends}, bochs (= ${binary:Version}) +Provides: bochs-gui +Description: SVGA plugin for Bochs + Bochs is a highly portable free IA-32 (x86) PC emulator written in C++, that + runs on most popular platforms. It includes emulation of the Intel x86 CPU, + common I/O devices, and a custom BIOS. + . + This package contains an SVGA GUI plugin for Bochs. + . + **VERY IMPORTANT WARNING** + Running Bochs with this plugin will redirect all your keyboard input + (including ALT+Fx) to the guest OS, blocking your terminal. An exception + is the F12 key, which you can use to interrupt the emulation. + +Package: bximage +Architecture: any +Depends: ${shlibs:Depends} +Description: Disk Image Creation Tool for Bochs + This tool is part of the Bochs project. Its purpose is to generate + disk images that are used to allocate the guest operating system in + Bochs environment. + +Package: sb16ctrl-bochs +Architecture: i386 hurd-i386 kfreebsd-i386 knetbsd-i386 +Replaces: sb16ctrl +Depends: ${shlibs:Depends} +Description: control utility for Bochs emulated SB16 card + You can use this utility to perform some query operations on + the Bochs emulated SB16 card. It needs to be installed in your + Debian-based guest OS. + . + The sb16ctrl utility contained in this package can only be used + from inside the Bochs emulator. DO NOT TRY IT ON REAL HARDWARE. --- bochs-2.3.5.orig/debian/changelog +++ bochs-2.3.5/debian/changelog @@ -0,0 +1,792 @@ +bochs (2.3.5-1ubuntu1) hardy; urgency=low + + * Merge from debian unstable, remaining changes: + - Keep qemu specific bios in separate package + * Renamed qemu bios image to BIOS-qemu-latest + + -- Soren Hansen Mon, 10 Dec 2007 12:26:41 +0100 + +bochs (2.3.5-1) unstable; urgency=low + + * New upstream release. + - debian/patches/01_man.patch: Fixed upstream. Remove. + - debian/patches/03_redolog_FTBFS.patch: Likewise. + - debian/patches/05_64_bit_cleanliness.patch: Likewise. + - debian/patches/00_base.patch: Sync. + * Remove versioned Build-Depends on dpkg, which is already on stable. + * Remove Tag fields, they are better maintainer outside the package. + * Improve tarball.sh to support cleaning upstream tarballs, and document + its usage in README.Debian. + * Turn failures when creating the tun device file non-fatal. + * Add Homepage, Vcs-Browser and Vcs-Svn fields in debian/control. + * Call configure with autotools-dev recommended --build and --host options. + * Build-Depend on iasl and enable it to build acpi-dsdt.hex. + * Ship BIOS-bochs-legacy in bochsbios. + * Fix parallel FTBFS and jobserver warnings. + - debian/patches/01_build.patch: New file. + * Do not directly use the QA SourceForge redirector, instead use an URL + to sf.net. (Closes: #453546) + * Build and ship a qemu specific bios (BIOS-qemu-latest) in bochsbios. + - debian/patches/03_qemu_bios.patch: New file. + Based on a patch by Soren Hansen . + * Move patch dependency in debian/rules from build-arch and build-indep + targets to configure.in. + * Fail and print an error explaining that build-indep will only succeed + on any-i386. (Closes: #451409) + * Now using Standards-Version 3.7.3 (no changes needed). + * Set bochs-doc Section to doc. + + -- Guillem Jover Fri, 07 Dec 2007 09:08:31 +0200 + +bochs (2.3+20070705-2ubuntu1) hardy; urgency=low + + * debian/patches/06_qemu_bios.patch, debian/control, + debian/bochsbios-qemu.{install,dirs}: + - Added new binary package bochsbios-qemu containing a special + BIOS image for qemu. + * Build BIOS images with -fno-stack-protector (LP: #163756) + * Modify Maintainer value to match the DebianMaintainerField + specification. + + -- Soren Hansen Fri, 23 Nov 2007 17:45:06 +0100 + +bochs (2.3+20070705-2) unstable; urgency=low + + * Fix differing prototype for tftp_send_optack in eth_vnet.cc affecting + builds on 64 bit architectures. (Closes: #432250, #432405) + - debian/patches/05_64_bit_cleanliness.patch: New file. + Thanks to Aaron M. Ucko . + + -- Guillem Jover Tue, 10 Jul 2007 05:44:13 +0300 + +bochs (2.3+20070705-1) unstable; urgency=low + + * New upstream snapshot. + - Do not provoke a BSOD for Windows 2000 from bochsbios. (Closes: #417416) + - Fix OpenBSD 3.9 installation iso booting up to the installer with + qemu. (Closes: #382795) + - Fix heap buffer overflow in ne2k emulated driver. (Closes: #427144) + CVE-2007-2893 + - Support spaces in command line bochsrc-like options. (Closes: #250196) + - debian/patches/00_base.patch: Sync. + - debian/patches/01_man.patch: Likewise. + - debian/patches/02_libtool.patch: Likewise. + - debian/patches/03_redolog_FTBFS.patch: Likewise. + - debian/patches/04_man_table.patch: Likewise. + * Update Tag: field to the latest vocabulary. + * Use binary:Version instead of deprecated Source-Version substvar. + * Update CVSROOT in tarball.sh. + * Explicitely point to LGPL 2.1 in debian/copyright. + * Update menu entry section. + * Do not ignore make errors on clean. + * Switch configuration variables to simply expanded ones in debian/rules. + * Update config.sub and config.guess on clean. + + -- Guillem Jover Sat, 07 Jul 2007 05:07:01 +0300 + +bochs (2.3-2) unstable; urgency=low + + * Install the note.gif only if building the binary independent packages. + * Make the bochs wrapper exec the real binary, to avoid unneecessary + running processes. + + -- Guillem Jover Mon, 18 Sep 2006 03:17:02 +0300 + +bochs (2.3-1) unstable; urgency=low + + * New upstream release. + - debian/patches/00_base.patch: Sync. + - debian/patches/03_g++-4.1.patch: Integrated upstream. Remove. + - debian/patches/04_wx2.6.patch: Likewise. + - debian/patches/03_redolog_FTBFS.patch: New file. Fix build failure. + - Documentation now uses index.html instead of book1.html. Remove now + unneeded debian/bochs-doc.links. (Closes: #380380) + * Switched to quilt: + - Add new debian/patches/series file. + - Add Build-Depends on 'quilt (>= 0.40)'. + - Include quilt.make from debian/rules. + - Remove now unused debian/patch.mk. + * Now using Standards-Version 3.7.2 (no changes needed). + * Add 2006 to the copyright years in debian/copyright. + * Remove obsolete template note and all debconf support with it. + * Remove code to strip possible RPATH in SDL plugin as it should not contain + it anymore, do not Build-Depend on chrpath anymore. + * Use source:Version in bochs' bochsbios Depencency, to make the package + binNMU safe, and Build-Depend on dpkg 1.13.19. + * Fix manpage warning due to unwrappable long line by using a table. + - debian/patches/04_man_table.patch: New file. + * Include the note.gif image in the bochs-doc package. (Closes: #198766) + * Do not install into bochs doc dir the README-plugins and README-wxWindows + files which contain development information not interesting to the user, + neither sb16ctrl example and source code which are provided in a separete + package already. + * Add a small README.plugins in the bochs package to document how to use + the ui plugin packages. (Closes: #250194) + Thanks to A Costa for the initial text. + * Include bxcommit in the bximage package. + * Include busmouse plugin in the bochs package. + * Do not set unused substvar sb16ctrl-bochs:Architecture in debian/rules. + * Enable new PIT model, APIC, Virtual 8086 Mode Extensions, x86_64, SSE4, + icache, internal disassembler, io and memory repetition speedups, + simulation save and restore, and limited USB support. + * Upgrade cpu-level to 6, as required by the x86_64 support. + * Add a Tag: field to all binary packages, using the data from debtags. + + -- Guillem Jover Sun, 17 Sep 2006 20:07:05 +0300 + +bochs (2.2.6-2) unstable; urgency=low + + * Fix typos in bochsrc(5). (Closes: #356012) + - debian/patches/01_man.patch: New file. + Thanks to A Costa . + * Fix clean target by calling upstream dist-clean, bios-clean under bios/, + and removing the misc/sb16/sb16ctrl and bios/VGABIOS-*. + * Switch to libwxgtk2.6-dev and libgtk2.0-dev. + - debian/patches/04_wx2.6.patch: New file. + Thanks to Hans de Goede . + * Fix FTBFS with g++ 4.1. (Closes: #357059) + - debian/patches/03_g++-4.1.patch: New file. + Thanks to Martin Michlmayr . + + -- Guillem Jover Tue, 21 Mar 2006 02:51:22 +0200 + +bochs (2.2.6-1) unstable; urgency=low + + * New upstream release. + - debian/patches/01_doc.patch: Integrated upstream. Remove. + - debian/patches/03_gcc-4.0.patch: Likewise. + - debian/patches/00_base.patch: Sync. + - debian/patches/02_libtool.patch: Likewise. + * Do not install ROM BIOS that are not built anymore. + * Do not create a fake stamp file for the ROM BIOS. + * Fix debian/sb16ctrl.1: + - Change the SEE ALSO references to be bold. + - Escaped some hyphens. + - Reindent the Bochs Online Documentation's URL. + * Build the svga module on amd64. (Closes: #346577) + Thanks to Kaare Hviid for the initial patch. + + -- Guillem Jover Thu, 9 Feb 2006 04:30:50 +0200 + +bochs (2.2.5-1) unstable; urgency=low + + * New upstream release. + - debian/patches/00_base.patch: Synced. + - debian/patches/01_doc.patch: Likewise. + - debian/patches/02_libtool.patch: Likewise. + * Debconf templates: + - Added Spanish. (Closes: #333897) + Thanks to César Gómez Martín . + - Added Swedish. (Closes: #330987) + Thanks to Daniel Nylander . + - Added Portuguese. (Closes: #338892) + Thanks to Simão Pedro Cardoso . + * Include pci plugins into bochs package. (Closes: #341436) + Thanks to Robert Millan + * Fix more typos in bochs and bochsrc manpages. (Closes: #335334, #335336) + Thanks to A Costa . + * Wrap lines in debian/control fields (knowingly breaking policy). + * Switch to debhelper compat level 5. + * Build-Conflict against libwxgtk2.6-dev as it FTBFS if present. + * Clean up debian/patch.mk: + - Rename clean to unpatch. + - Switch patch and unpatch to single-colon targets. + - Add patch, unpatch, apply-patches and reverse-patches to the PHONY + targets. + * Clean up debian/rules file: + - Add a proper copyright comment header. + - Remove null, bochs and INSTALL_PROGRAM variables. + - Switch clean to single-colon target, make it depend on unpatch and call + make clean. + - Swap config.status and configure from target to dependency. + - Pass CFLAGS and CXXFLAGS to configure. + - Remove configure from the PHONY targets. + - Inline the main conf_args to the configure invokation. + - Just use autoconf, and do not try autoconf2.50. + - Split autoconf and configure commands in different targets. + - Make build-arch and build-indep depend on patch and config.status. + - Make binary-indep depend on install-indep, and binary-arch on install. + - Remove commented debhelper commands. + + -- Guillem Jover Sat, 7 Jan 2006 08:19:52 +0200 + +bochs (2.2.1-2) unstable; urgency=low + + * Use misc:Depends instead of an explicit dependency to debconf + to get the alternative debconf-2.0 as well. + * Fix typo in bochsrc.5 that prevents the line from being displayed. + (Closes: #326528) + - debian/patches/01_doc.patch: Updated. + Thanks to Nicolas François . + * Update LGPL to 2.1 and fix FSF address in debian/copyright. + * Change Build-Depends to 'libreadline5-dev | libreadline-dev' from + 'libreadline4-dev'. + * Fix bashisms in bochs.config and bochs.postinst. + * Added missing angle to email address in sb16ctrl.1. + * Install sb16ctl.1 in the binary. + * Use variable assignment and handle spaces in filenames correctly. + - debian/launcher: Updated. + * Do not use a variable with read and use $() instead of backticks. + - debian/launcher/etc/bochs-init/init.sh: Reindent. Updated. + + -- Guillem Jover Sun, 11 Sep 2005 05:24:24 +0300 + +bochs (2.2.1-1) unstable; urgency=low + + * New upstream release. + - debian/patches/00_base.patch: Synced. + - debian/patches/01_doc.patch: Likewise. + - debian/patches/02_libtool.patch: Likewise. + - debian/patches/03_gcc-4.0.patch: Likewise. + - debian/patches/04_no_pcibios_init.patch: Removed. + - Fix ">>PANIC<< prefetch: RIP > CS.limit". (Closes: #162785, #288766) + - Fix TUN/TAP network interface. (Closes: #268422) + * Added Vietnamese debconf translation. (Closes: #313170) + Thanks to Clytie Siddall . + * Fix typos in the bochsrc man page. (Closes: #310359) + - debian/patches/01_doc.patch: Update. + Thanks to A Costa . + * Enable the pseudo NIC interface to be used with EtherBoot and document + the addition in the README.Debian file. + Thanks to Robert Millan for the pointer. + * Cosmetic cleaning of README.Debian. + * Provide a symlinked manpage for bochs-bin. + * Add a man page for sb16ctrl. + * Explicitly state architectures and stop using type-handling. + * Replace aalib1-dev Build-Depends with libaa1-dev. + * Replace xlibs-dev Build-Depends with the fain grained only ones + needed: libx11-dev, libxpm-dev, libice-dev, libsm-dev. + * Tighten dependencies on bochsbios and vgabios. (Closes: #290188) + * Do not use a stamp file for configure. + * Add Debian Subversion repository URL. + * Update copyright year. + * Update watch file to version 3 (no changes needed). + * Now using Standards-Version 3.6.2 (no changes needed). + * Use new QA SourceForge watch redirector. + * Use new dpkg-architecture variables for os and cpu. + * C++ ABI transition. + - Remove special case for m68k to use g++-3.4. + + -- Guillem Jover Fri, 29 Jul 2005 03:18:33 +0300 + +bochs (2.1.1+20041109-3) unstable; urgency=high + + * Remove rombios pcibios initialization code. It lets the virtual box + in a state inconsitent with what qemu expects. + - debian/patches/04_no_pcibios_init.patch: New file. + (Closes: #281862, #283166, #284132, #285752) + + -- Guillem Jover Tue, 11 Jan 2005 18:36:23 +0100 + +bochs (2.1.1+20041109-2) unstable; urgency=high + + * Build-Depends and use gcc-3.4 on m68k to avoid an ICE. (Closes: #284050) + * Fix build failure with gcc-4.0. (Closes: #284748) + Thanks to Andreas Jochens . + * Add missing "--tag CXX" in libtool invokations. + * Remove possible RPATH in SDL plugin. + * Fix typo in documentation. (Partial fix: #198766) + * Fix broken links to Home in bochs-doc manuals. (Closes: #198861) + * Update bochsrc(5) with new vgaromimage syntax, and fix warnings in all + manpages. (Closes: #274336) + + -- Guillem Jover Mon, 13 Dec 2004 17:22:43 +0100 + +bochs (2.1.1+20041109-1) unstable; urgency=low + + * New maintainer. (Closes: #276392) + * New upstream snapshot. + - Stop using tar in tar. + - Fix Linux kernel loading on 2.4.26 or 2.6.8 and up. (Closes: #273424) + * Added a debian/tarball.sh script to easily manage snapshots. + * Patches: + - Use debian/patch.mk. + - debian/patches/gdb.diff: Remove, integrated upstream. + - debian/patches/gzip.diff: Likewise. + - debian/patches/kbsd-gnu.diff: Likewise + - debian/patches/orig.diff: Renamed to ... + - debian/patches/00_base.patch: ... this. Remove upstream integrated + changes. Fixed 3DNow hunk duplication. + - debian/patches/plex86.diff: Renamed to ... + - debian/patches/plex86.disabled: ... this. + * Use new vgaromimage syntax in bochs-init config: + - debian/etc/bochs-init/bochsrc: Update. + * Create tun devices. (Closes: #215576) + * Removed leftover debian/rules.ZILESAVE. + * Removed leftover debian/xfonts-bochs.dirs. + * General cosmetic fixes. + * Cleaned debian/copyright. + * Major cleanup of debian/rules. + - Honour noopt in DEB_BUILD_OPTIONS. + - Build with debugging symbols by default. + - Use -s in debhelper scripts instead of -a and hardcoded package + excludes. + - Use debian/tmp as the source dir in dh_install. Fix all *.install + files. + * Added a debian/watch file. + * Added Catalan debconf template. + * Now using Standard-Version 3.6.1. + + -- Guillem Jover Sat, 13 Nov 2004 17:32:09 +0100 + +bochs (2.1.1+20040903-3) unstable; urgency=low + + * QA Upload + * Correct QA Group's maintainer address + * Bug fix: "Czech translation of bochs debconf messages", thanks to Jan + Outrata (Closes: #275500). + + -- Frank Lichtenheld Mon, 8 Nov 2004 04:28:11 +0100 + +bochs (2.1.1+20040903-2) unstable; urgency=low + + * Orphan. + - control.in (Maintainer): Set to Debian QA Group. + + -- Robert Millan Wed, 13 Oct 2004 20:58:27 +0200 + +bochs (2.1.1+20040903-1) unstable; urgency=low + + * New upstream snapshot. + - patches: Resync some stuff. + - control.in (Depends): Set vgabios (>= 0.4c+20040829-2) + * Add German and Japanese translations. + - po/de.po + - po/ja.po + + -- Robert Millan Fri, 3 Sep 2004 10:34:28 +0200 + +bochs (2.1.1-11) unstable; urgency=low + + * rules (conf_args): Enable mmx, 3dnow, compressed-hd (unimplemented). + * control (Build-Depends): Add libreadline4-dev. + * patches/ftbfs_mmx.diff: New. Fix some fuckery. + + -- Robert Millan Mon, 30 Aug 2004 04:24:39 +0200 + +bochs (2.1.1-10) unstable; urgency=high + + * urgency=high because change in -8 _must_ release with sarge. + * patches/gdb.diff: Fix dependency on plex86 patch, which was disabled on + 2.1.1-8. (Closes: #265941) + * rules: Fail if any patch fails to apply (I hate make). + + -- Robert Millan Mon, 16 Aug 2004 03:31:50 +0200 + +bochs (2.1.1-9) unstable; urgency=low + + * Allow building of bochsbios on non-i386. It was reported that the + resulting binary is identical, since we use bin86/bcc to compile it. + (Closes: #249796). + + -- Robert Millan Sun, 15 Aug 2004 02:01:48 +0200 + +bochs (2.1.1-8) unstable; urgency=low + + * Disable Plex86 backend. + + -- Robert Millan Mon, 9 Aug 2004 20:56:01 +0200 + +bochs (2.1.1-7) unstable; urgency=low + + * rules: Fallback to autoconf when autoconf2.50 is not found (sigh). + + -- Robert Millan Thu, 5 Aug 2004 21:11:30 +0200 + +bochs (2.1.1-6) unstable; urgency=low + + * Use type-handling to handle dpkg arch-specific build-dependencies. + - control.in: New. + - rules: Parse @i386@, @linux-gnu@ and @svgalib@ from control.in. + * Allow building of binary-indep from any platform. + - control.in (Build-Depends): Nuke i386. + * Explicitly use autoconf2.50. + - rules: s/autoconf/autoconf2.50/g + - control.in (Build-Conflicts): Nuke autoconf2.13. + * patches/kbsd-gnu.diff: New. Fix GNU/k*BSD portability issues. + + -- Robert Millan Thu, 5 Aug 2004 04:05:30 +0200 + +bochs (2.1.1-5) unstable; urgency=low + + * Fix FTBFS on ! i386-linux-gnu. (Closes: #247957) + - rules: Pass -Nbochs-svga to dh_gencontrol for ! i386-linux-gnu. + * etc/bochs-init: New. Scripts for running Bochs as init. + - README.Debian: Describe what this means. + - rules: Install it in debian/tmp. + - bochs.install: Add it. + + -- Robert Millan Tue, 27 Apr 2004 09:44:37 +0200 + +bochs (2.1.1-4) unstable; urgency=low + + * New binary package: bochs-svga (SVGA GUI plugin). + - control (Build-Depends): Add libsvga1-dev [i386]. + - control: Add bochs-svga (for i386-linux-gnu only). + - rules (conf_args): Add --with-svga on i386-linux-gnu. + - bochs-svga.install: New. Install svga plugin. + + -- Robert Millan Mon, 26 Apr 2004 20:26:34 +0200 + +bochs (2.1.1-3) unstable; urgency=low + + * Noone loves Xfree86 anymore. + - control: s/Xfree86/X11/g. + * Sad, but true. Disable AMD64 support. (Closes: #242793) + - rules (conf_args): Remove --enable-x86-64. + - control (Description): Remove amd64-related bits. + * Kiss bochsconf goodbye. (Closes: #203698) + - bochsconf: Nuked. + - README.Debian: Replace bochsconf-related notes. + - bochs.install: Nuke bochsconf. + - rules: Ditto. + - launcher: Remove bochsconf-related lines. + * control: Make descriptions of bochsbios, bochs-term, bochs-x, bochs-wx and + bochs-sdl more accurate. Thanks Javier. (Closes: #209436, #209437, + #209446, #209472, #209522) + * Add Dutch po-debconf translation. (Closes: #241317) + - po/nl.po: New. Contributed by Luk Claes + + -- Robert Millan Sun, 25 Apr 2004 21:37:36 +0200 + +bochs (2.1.1-2) unstable; urgency=low + + * rules (conf_args): Add --enable-fpu. (Closes: #239904) + * control (Build-Depends): Add libasound2-dev, aalib1-dev. (Closes: #239927) + * patches/orig.diff: Resync. + * README.Debian: Remove reference to user/x1948.html. (Closes: #237274) + * control (Suggests): Nuke e2fsprogs. + + -- Robert Millan Wed, 24 Mar 2004 22:43:26 +0100 + +bochs (2.1.1-1) unstable; urgency=low + + * New upstream release. + + -- Robert Millan Thu, 11 Mar 2004 14:21:42 +0100 + +bochs (2.1rel-4) unstable; urgency=low + + * launcher: Made bochsconf run optional. (Closes: #179143) + + -- Robert Millan Sat, 7 Feb 2004 13:39:56 +0100 + +bochs (2.1rel-3) unstable; urgency=low + + * rules: s/gdb-stubs/gdb-stub/g. (Really closes: #224862) + + -- Robert Millan Fri, 6 Feb 2004 15:04:13 +0100 + +bochs (2.1rel-2) unstable; urgency=low + + * patches/gdb.diff: New. Turn GDB stubs into a conffile option. (patch + from Charles Duffy) + * rules: Enable GDB stubs. (Closes: #224862) + - 0list: Update. + + -- Robert Millan Sun, 1 Feb 2004 23:29:59 +0100 + +bochs (2.1rel-1) unstable; urgency=low + + * New upstream release. + * patches/plex86.diff: Dont panic on failure to open Plex86 device. + (Closes: #222550) + + -- Robert Millan Sat, 31 Jan 2004 16:54:18 +0100 + +bochs (2.1pre3-1) unstable; urgency=low + + * New upstream pre-release. + * Switch to debhelper compat 4. + - rules: Don't override DH_COMPAT. + - compat: New. + * rules: Add --enable-idle-hack. Thanks Josh Metzler. (Closes: #223879) + + -- Robert Millan Sat, 10 Jan 2004 12:53:34 +0100 + +bochs (2.1pre1.a-2) unstable; urgency=low + + * rules: Reorganise kernel-specific checks. + + -- Robert Millan Tue, 16 Dec 2003 16:45:21 +0100 + +bochs (2.1pre1.a-1) unstable; urgency=low + + * Switched to DBS-like tarball/patch handling. (Closes: #217522) + * control: Lower Recommends to Suggests for Plex86. (Closes: #215112) + * Nuked redundant upstream changelog.gz file. (Closes: #170545) + + -- Robert Millan Tue, 28 Oct 2003 20:07:59 +0100 + +bochs (2.1pre1-1) unstable; urgency=low + + * New upstream release. + + -- Robert Millan Wed, 8 Oct 2003 21:57:37 +0000 + +bochs (2.0.2+20030829-1) unstable; urgency=low + + * New upstream snapshot. + - Updated libtool. (Closes: #195826) + - Fixed CPU bug. (Closes: #197094) + - debian/patches/orig.diff: Update. + - debian/patches/plex86.diff: Update. + * debian/{control,po/,templates}: Switch to gettext-based debconf templates; + thanks Christian Perrier. (Closes: #205777) + * debian/po/fr.po: New. French debconf translation; thanks again to + Christian Perrier. (Closes: #206735) + * debian/rules: s/freebsd/kfreebsd-gnu/g cleanup. + * debian/control (xfonts-bochs): Nuked (obsoleted upstream). + * debian/rules: Likewise. + * debian/bochs.install: Add "gameport" plugin. + * debian/control (bochsbios): Bumped bochs dependency. + + -- Robert Millan Fri, 29 Aug 2003 14:09:39 +0000 + +bochs (2.0.2+20030525-1) unstable; urgency=low + + * New upstream snapshot. + * Merged fix-link-deps.diff and cpu/3dnow.cc fixes into upstream. + * Update plex86.diff from upstream's bts. (see patch header) + + -- Robert Millan Sun, 25 May 2003 03:49:22 +0200 + +bochs (2.0.2+20030522-3) unstable; urgency=low + + * Fixed link dependencies in bochs-* GUI packages so that GUI plugins + depend on their respective GUI libraries, and bochs can stop depending + on them. (Closes: #176458) + + -- Robert Millan Sat, 24 May 2003 13:36:09 +0200 + +bochs (2.0.2+20030522-2) unstable; urgency=low + + * Moved diffs into debian/patches. + * Added patch for Plex86 support. + + -- Robert Millan Fri, 23 May 2003 17:17:50 +0000 + +bochs (2.0.2+20030522-1) unstable; urgency=low + + * New upstream snapshot. + - fixes FTBFS. + - has x11-pc-be.map (Closes: #191080) + * Copy all missing plugins from plugin dir. (Closes: #191639) + + -- Robert Millan Thu, 22 May 2003 00:36:17 +0200 + +bochs (2.0.2+20020419-1) unstable; urgency=low + + * New upstream snapshot. (Closes: #188538) + * Fix x86-64 emulation. thanks Arnd Bergmann. (Closes: #189349) + + -- Robert Millan Sat, 19 Apr 2003 19:38:39 +0200 + +bochs (2.0.2-3) unstable; urgency=low + + * Added libgtk1.2-dev explicitly to Build-Depends. (Closes: #181964) + * Put debian address in Maintainer field. + + -- Robert Millan Fri, 21 Feb 2003 18:46:59 +0100 + +bochs (2.0.2-2) unstable; urgency=low + + * First upload as a developer. + * Building against libwxgtk2.4-dev. (Closes: #178294) + * Fixed marks in SGML documentation, thanks Aaron M. Ucko. (Closes: #179138) + * Fixed GZIP variable mess in Makefile.in. + + -- Robert Millan Thu, 20 Feb 2003 22:43:05 +0100 + +bochs (2.0.2-1) unstable; urgency=low + + * New upstream release. (Closes: #176339) + * Fixed build problem with sb16ctrl. (Closes: #175947) + * Added Replaces line on all bochs-gui packages. (Closes: #175264) + * Removed HTML documentation from bochs package. + * Fixed wrong links in index.html of documentation. (Closes: #175888) + + -- Robert Millan Fri, 24 Jan 2003 16:47:21 +0100 + +bochs (2.0rel-2) unstable; urgency=low + + * Added sb16ctrl-bochs (again). + * Removed linuxisms from sb16ctrl.c. + * Put xfonts-bochs dependency on bochs-x. (Closes: #174109) + * Now building html docs from docbook. Splitted into bochs-doc package. + * Added entry in debian menu. + + -- Robert Millan Wed, 25 Dec 2002 01:56:24 +0100 + +bochs (2.0rel-1) unstable; urgency=low + + * New upstream release. + * Split GUI plugins in their own packages to lower dependencies. + * Fixed Hurd nomenclaure in documentation. + + -- Robert Millan Sun, 22 Dec 2002 01:55:56 +0100 + +bochs (2.0pre3-1) unstable; urgency=low + + * New upstream release. + * Enabling plugins. + * Compiling SDL support. + * Add version check for conffile change debconf warning. (Closes: #170725) + * Add some notes about sb16ctrl.c in README.Debian. (Closes: #161873) + * Got rid of CHANGES.gz. (Closes: #170545) + + -- Robert Millan Sat, 7 Dec 2002 14:57:30 +0100 + +bochs (2.0pre2-1) unstable; urgency=low + + * New upstream release. + * Building WxWindows frontend (GTK+ based). + * Enabling x86-64 by default. + * Merged support for the different GUIs (X, curses, Wx) into one binary, + as they are no longer exclussive. + * Removed sb16ctrl package as it prevented Bochs from getting into + testing. Now sb16ctrl is in /usr/share/doc/bochs/sb16ctrl.c for you + to build. (Closes: #161873) + * Now Bochs binary can do most of what the launcher used to, so I've + rewritten the bochs launcher to do no more than a pair of things. + * Configuration file #home# and #guest# tags are now environmental variables, + added debconf template to tell the user he/she has to rework his/her + bochsrc. + + -- Robert Millan Fri, 22 Nov 2002 15:51:16 +0100 + +bochs (1.4.1.z.cvs20021031-1) unstable; urgency=low + + * New upstream snapshot. + * Fixed commandline parser of launcher, thanks Robbe. (Closes: #167152) + * Force creating sb16ctrl symlink. (Closes: #166906) + * Using --enable-all-optimizations autoconf flag. + * Stripping sb16ctrl with dh_strip. + + -- Robert Millan Fri, 1 Nov 2002 15:23:52 +0100 + +bochs (1.4.1.z.cvs20020927-1) unstable; urgency=low + + * New upstream snapshot. Implemented x86-64 support (see README.Debian) + * Disabling i686 optimisations as are discouraged upstream (fallback to i586) + * Fixed targets in debian/rules for building build-arch separately + from build-indep. (Closes: #161831) + * Now using dh_install. + + -- Robert Millan Fri, 27 Sep 2002 13:51:53 +0200 + +bochs (1.4.1.z.cvs20020915-1) unstable; urgency=low + + * New upstream snapshot with GDB stub patch. + * Reactivating bios building, as bug #153449 is fixed now. + * Enabling i686, MMX and FPU optimisations. + + -- Robert Millan Sun, 15 Sep 2002 07:51:41 +0200 + +bochs (1.4.1.no.gifs-1) unstable; urgency=low + + * Got rid of gifs. + * Splitted build-indep section. + * Addition of bochsbios and sb16ctrl. + * Temporarily deactivating bios building (see bug #153449). + + -- Robert Millan Mon, 29 Jul 2002 23:54:45 +0200 + +bochs (1.4.1.no.elpin-1) unstable; urgency=low + + * Removed nonfree elpin BIOS (ouch!). (Closes: #152762) + + -- Robert Millan Fri, 12 Jul 2002 05:52:51 +0200 + +bochs (1.4.1-1) unstable; urgency=low + + * New upstream release. + * Add dependancy on bochs to bochs-x and bochs-curses. (Closes: #150553) + + -- Robert Millan Wed, 26 Jun 2002 09:16:29 +0200 + +bochs (1.4rel-6) unstable; urgency=low + + * Removed DOC-linux.html installation document, useless in the package. + * Fixed sed rule in upstream Makefile to replace @VERSION@. (Closes: #140219) + * Made launcher to search .bochsrc in `pwd` first. (Closes: #146397) + * Patched misc non-upstream issues in manpages. + + -- Robert Millan Sat, 11 May 2002 12:52:50 +0200 + +bochs (1.4rel-5) unstable; urgency=low + + * Enabled support to specify location for bochsrc. + * Using versioned depends from bochs to bochs-{x,curses}. (Closes: #145268) + * Enabling serial support in iodev/serial.cc. (Closes: #145983) + * Merged FHS fixes into Makefile. Fixed misc install issues. + (Closes: #140219, #145943) + * Added GNU #defines to iodev/cdrom.cc. + + -- Robert Millan Sun, 21 Apr 2002 08:36:14 +0200 + +bochs (1.4rel-4) unstable; urgency=low + + * Got rid of linux/fs.h include that broak build on some arches. + + -- Robert Millan Thu, 18 Apr 2002 15:20:52 +0200 + +bochs (1.4rel-3) unstable; urgency=low + + * Fallback to fixed fonts when vga fonts are not present. + * Fixed deboostrap typo in debian/control. + * Checking for X properly with test -z $DISPLAY. (Closes: #142537) + + -- Robert Millan Fri, 12 Apr 2002 12:31:35 +0200 + +bochs (1.4rel-2) unstable; urgency=low + + * Reworked launcher script to be more flexible and less intrusive. + * Written Bochsconf tool to simplify setup. (please test!) + * Nicer error message when xfont is not present. (Closes: 142059) + + -- Robert Millan Mon, 8 Apr 2002 18:47:21 +0200 + +bochs (1.4rel-1) unstable; urgency=low + + * New upstream release. + * Merged gui/gui.cc into upstream. + * Fixed bad syntax in debian/rules that disabled vbe, cdrom, sb16 and + ne2k support for the X interface. (Closes: #140233) + + -- Robert Millan Thu, 28 Mar 2002 22:04:59 +0100 + +bochs (1.4pre2-2) unstable; urgency=low + + * Enabled Vesa Bios Extensions support, since vgabios now provides it. + * Created a bochs-curses package with ncurses interface. + (had to fix gui/gui.cc, with undeclared identifiers) + * Now using tempfile to get random locations in laucher. + + -- Robert Millan Wed, 20 Mar 2002 13:32:27 +0100 + +bochs (1.4pre2-1) unstable; urgency=low + + * New upstream release + * Created a launcher script for bochs. bochsrc is autoloaded and + $HOME is parsed. + * Enabled network support for GNU/Linux (oops) + + -- Robert Millan Wed, 6 Mar 2002 15:41:58 +0100 + +bochs (1.3-2) unstable; urgency=low + + * Removed unnecessary bcc and bin86 from Build-Depends. + (sigh, did i dream they were required?) + * Added support for GNU and GNU/*BSD. + * Passing DEB_HOST_GNU_TYPE and DEB_BUILD_GNU_TYPE to configure. + + -- Robert Millan Sun, 3 Mar 2002 14:21:16 +0100 + +bochs (1.3-1) unstable; urgency=low + + * Initial Release. (Closes: #78642) + * Sorry Goswin, had to take it. + + -- Robert Millan Sat, 12 Jan 2002 11:34:12 +0100 + --- bochs-2.3.5.orig/debian/bochsbios.install +++ bochs-2.3.5/debian/bochsbios.install @@ -0,0 +1,2 @@ +usr/share/bochs/BIOS-bochs-latest +usr/share/bochs/BIOS-bochs-legacy --- bochs-2.3.5.orig/debian/bochsbios-qemu.install +++ bochs-2.3.5/debian/bochsbios-qemu.install @@ -0,0 +1 @@ +usr/share/bochs/BIOS-qemu-latest