diff --git a/.gitignore b/.gitignore index 2a6e2f0cb..5ef9f239c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,12 @@ # Mac OS X metadata *.DS_Store + +# Generated files +Makefile +aclocal.m4 +autom4te.cache +config.h.in +config.log +config.status +configure diff --git a/BasiliskII/src/AmigaOS/main_amiga.cpp b/BasiliskII/src/AmigaOS/main_amiga.cpp index 90ac6db23..3f8ae8a3a 100644 --- a/BasiliskII/src/AmigaOS/main_amiga.cpp +++ b/BasiliskII/src/AmigaOS/main_amiga.cpp @@ -274,10 +274,10 @@ int main(int argc, char **argv) QuitEmulator(); } } - RAMBaseMac = (uint32)RAMBaseHost; + RAMBaseMac = (uaecptr)RAMBaseHost; D(bug("Mac RAM starts at %08lx\n", RAMBaseHost)); ROMBaseHost = RAMBaseHost + RAMSize; - ROMBaseMac = (uint32)ROMBaseHost; + ROMBaseMac = (uaecptr)ROMBaseHost; D(bug("Mac ROM starts at %08lx\n", ROMBaseHost)); // Get rom file path from preferences diff --git a/BasiliskII/src/AmigaOS/scsi_amiga.cpp b/BasiliskII/src/AmigaOS/scsi_amiga.cpp index c660eb268..f3ee84a23 100644 --- a/BasiliskII/src/AmigaOS/scsi_amiga.cpp +++ b/BasiliskII/src/AmigaOS/scsi_amiga.cpp @@ -213,7 +213,7 @@ bool scsi_set_target(int id, int lun) * read/write data according to S/G table (returns false on error); timeout is in 1/60 sec */ -bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, uint8 **sg_ptr, uint32 *sg_len, uint16 *stat, uint32 timeout) +bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, void* const* sg_ptr, uint32* sg_len, uint16* stat, uint32 timeout) { // Bypass the buffer if there's only one S/G table entry bool do_direct_transfer = (sg_size == 1 && ((uint32)sg_ptr[0] & 1) == 0 && direct_transfers_supported); diff --git a/BasiliskII/src/BeOS/scsi_beos.cpp b/BasiliskII/src/BeOS/scsi_beos.cpp index 75d1e29ad..9affe7c29 100644 --- a/BasiliskII/src/BeOS/scsi_beos.cpp +++ b/BasiliskII/src/BeOS/scsi_beos.cpp @@ -175,7 +175,7 @@ bool scsi_set_target(int id, int lun) * read/write data according to S/G table (returns false on error); timeout is in 1/60 sec */ -bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, uint8 **sg_ptr, uint32 *sg_len, uint16 *stat, uint32 timeout) +bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, void* const* sg_ptr, uint32* sg_len, uint16* stat, uint32 timeout) { // Check if buffer is large enough, allocate new buffer if needed if (!try_buffer(data_length)) { diff --git a/BasiliskII/src/BeOS/sysdeps.h b/BasiliskII/src/BeOS/sysdeps.h index ed3ba9c33..59177d826 100644 --- a/BasiliskII/src/BeOS/sysdeps.h +++ b/BasiliskII/src/BeOS/sysdeps.h @@ -90,19 +90,19 @@ extern void Delay_usec(uint32 usec); // Intel x86 assembler optimizations #define X86_PPRO_OPT -static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_long(const void* a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;} #ifdef X86_PPRO_OPT -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswap %k0\n" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_word(const void* a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswap %k0\n" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} #else -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_word(const void* a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} #endif #define HAVE_GET_WORD_UNSWAPPED #define do_get_mem_word_unswapped(a) ((uae_u32)*((uae_u16 *)(a))) -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;} +static inline void do_put_mem_long(void* a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;} #ifdef X86_PPRO_OPT -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("bswap %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {__asm__ ("bswap %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;} #else -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;} #endif #define X86_ASSEMBLY @@ -114,10 +114,10 @@ static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" #else // PowerPC (memory.cpp not used, so no optimization neccessary) -static inline uae_u32 do_get_mem_long(uae_u32 *a) {return *a;} -static inline uae_u32 do_get_mem_word(uae_u16 *a) {return *a;} -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {*a = v;} -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = v;} +static inline uae_u32 do_get_mem_long(const void* a) {return *(const uae_u32*)a;} +static inline uae_u32 do_get_mem_word(const void* a) {return *(const uae_u16*)a;} +static inline void do_put_mem_long(void* a, uae_u32 v) {*(uae_u32*)a = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {*(uae_u16*)a = v;} #undef X86_ASSEMBLY #define UNALIGNED_PROFITABLE @@ -126,8 +126,8 @@ static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = v;} #define REGPARAM #endif -#define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a))) -#define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v)) +#define do_get_mem_byte(a) ((uae_u32)*((const uae_u8*)(a))) +#define do_put_mem_byte(a, v) (*(uae_u8*)(a) = (v)) #define call_mem_get_func(func, addr) ((*func)(addr)) #define call_mem_put_func(func, addr, v) ((*func)(addr, v)) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 4ea28b722..c182a9e61 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -1865,7 +1865,7 @@ static void update_display_static(driver_base *drv) // Check for first column from left and first column from right that have changed if (high) { - if (VIDEO_MODE_DEPTH < VIDEO_DEPTH_8BIT) { + if ((int)VIDEO_MODE_DEPTH < VIDEO_DEPTH_8BIT) { const int src_bytes_per_row = bytes_per_row; const int dst_bytes_per_row = drv->s->pitch; const int pixels_per_byte = VIDEO_MODE_X / src_bytes_per_row; diff --git a/BasiliskII/src/Unix/FreeBSD/scsi_freebsd.cpp b/BasiliskII/src/Unix/FreeBSD/scsi_freebsd.cpp index 556af295f..6c38d2af2 100644 --- a/BasiliskII/src/Unix/FreeBSD/scsi_freebsd.cpp +++ b/BasiliskII/src/Unix/FreeBSD/scsi_freebsd.cpp @@ -610,7 +610,7 @@ static bool try_buffer(int size) return true; } -bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, uint8 **sg_ptr, uint32 *sg_len, uint16 *stat, uint32 timeout) +bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, void* const* sg_ptr, uint32* sg_len, uint16* stat, uint32 timeout) { int value = 0; #ifdef CAM @@ -730,9 +730,9 @@ bool scsi_send_cmd(size_t data_length, bool reading, int sg_size, uint8 **sg_ptr static char line[16]; for(int r=0, x=0;x. # # 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. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -53,8 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -66,11 +62,11 @@ Try \`$me --help' for more information." 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. @@ -104,8 +100,9 @@ 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 -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$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" ; @@ -122,7 +119,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) 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) @@ -135,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward @@ -150,22 +168,30 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /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 ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) + arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null + | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? @@ -175,7 +201,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in fi ;; *) - os=netbsd + os=netbsd + ;; + esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` ;; esac # The OS release @@ -188,148 +221,126 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; 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 ;; + echo "${machine}-${os}${release}${abi}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:MicroBSD:*:*) - echo ${UNAME_MACHINE}-unknown-microbsd${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. - eval $set_cc_for_build - 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 - $CC_FOR_BUILD -o $dummy $dummy.s 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" - ;; - 3-1307) - UNAME_MACHINE="alphaev7" - ;; - esac - fi - 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'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; 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 @@ -337,29 +348,51 @@ EOF else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + 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 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; 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.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + 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*) @@ -368,10 +401,10 @@ EOF 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 @@ -383,10 +416,10 @@ EOF 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 @@ -396,38 +429,41 @@ EOF # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-atari-mint${UNAME_RELEASE} + 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 ;; + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + echo m68k-unknown-mint${UNAME_RELEASE} + 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 @@ -451,35 +487,36 @@ EOF exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $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 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + 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` + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ @@ -492,29 +529,29 @@ EOF 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` @@ -522,7 +559,7 @@ EOF 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 @@ -537,49 +574,54 @@ EOF exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - 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 ;; - *:AIX:*:[45]) + exit ;; + *:AIX:*:[4567]) 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 IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else 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 @@ -588,52 +630,52 @@ EOF 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac + esac ;; + esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + sed 's/^ //' << EOF >$dummy.c - #define _HPUX_SOURCE - #include - #include + #define _HPUX_SOURCE + #include + #include - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa @@ -641,9 +683,19 @@ EOF esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + 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 -q __LP64__ then HP_ARCH="hppa2.0w" else @@ -651,11 +703,11 @@ EOF 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 @@ -683,312 +735,348 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $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 ;; + 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 nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + 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 ;; + 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 ;; + 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:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) + exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + *:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + 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 i586-pc-interix3 - exit 0 ;; + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-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 0 ;; + exit ;; + 8664:Windows_NT:*) + echo x86_64-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 i586-pc-interix - exit 0 ;; + 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:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + 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/[-(].*//'`-${LIBC} + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - mips64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU - #undef mips64 - #undef mips64el + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el + CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 + CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - 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 ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-${LIBC} + exit ;; x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - 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 - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # 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 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + 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... - # I am not positive that other SVR4 systems won't match this, + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. + # 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 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + 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 @@ -996,15 +1084,16 @@ EOF 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 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 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - 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 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) + 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 ;; + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + 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; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; 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 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) 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` @@ -1096,68 +1198,109 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + 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} + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv${UNAME_RELEASE} + 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 ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + 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 0 ;; + 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:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; - esac + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1165,22 +1308,28 @@ EOF 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-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + 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 @@ -1191,177 +1340,55 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - 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 ;; + 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 ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; esac -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - cat >&2 <. +# # 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. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. + +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -70,8 +68,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright 1992-2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -83,11 +80,11 @@ Try \`$me --help' for more information." 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 +96,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,10 +115,18 @@ esac # 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* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] @@ -144,10 +149,13 @@ case $os in -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 | -microblaze*) os= basic_machine=$1 ;; + -bluegene*) + os=-cnk + ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 @@ -162,13 +170,17 @@ case $os in os=-chorusos basic_machine=$1 ;; - -chorusrdb) - os=-chorusrdb + -chorusrdb) + os=-chorusrdb basic_machine=$1 - ;; + ;; -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 +197,10 @@ case $os in # 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/'` @@ -202,6 +218,12 @@ case $os in -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; -lynx*) os=-lynxos ;; @@ -226,56 +248,114 @@ case $basic_machine in # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ + | aarch64 | aarch64_be \ | 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 \ - | clipper \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ - | mips64vr | mips64vrel \ + | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | moxie \ + | mt \ | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | openrisc | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ - | s390 | s390x \ - | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic80 | tron \ - | v850 | v850e \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -291,57 +371,89 @@ case $basic_machine in # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ + | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ - | clipper-* | cydra-* \ + | avr-* | avr32-* \ + | ba-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | e2k-* | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ + | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ - | romp-* | rs6000-* \ - | s390-* | s390x-* \ - | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | riscv32-* | riscv64-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ - | v850-* | v850e-* | vax-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. @@ -359,6 +471,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -373,6 +488,12 @@ case $basic_machine in 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 @@ -396,6 +517,13 @@ case $basic_machine in basic_machine=m68k-apollo os=-bsd ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -404,10 +532,35 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; c90) basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -432,12 +585,27 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | 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 ;; @@ -460,6 +628,14 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -571,7 +747,6 @@ case $basic_machine in i370-ibm* | ibm*) basic_machine=i370-ibm ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 @@ -610,6 +785,17 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -621,10 +807,21 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -638,10 +835,6 @@ case $basic_machine in 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 @@ -650,14 +843,29 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; mvs) basic_machine=i370-ibm os=-mvs ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 @@ -722,9 +930,11 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem @@ -733,9 +943,12 @@ case $basic_machine in 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 @@ -753,6 +966,14 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -762,32 +983,45 @@ case $basic_machine in 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 | 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 | ppcbe) basic_machine=powerpc-unknown ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown @@ -812,6 +1046,14 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -822,6 +1064,12 @@ case $basic_machine in rtpc | rtpc-*) basic_machine=romp-ibm ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; sa29200) basic_machine=a29k-amd os=-udi @@ -832,6 +1080,14 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -839,6 +1095,12 @@ case $basic_machine in 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 @@ -857,6 +1119,9 @@ case $basic_machine in basic_machine=i860-stratus os=-sysv4 ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; sun2) basic_machine=m68000-sun ;; @@ -913,13 +1178,9 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown @@ -934,6 +1195,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -977,9 +1242,16 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; ymp) basic_machine=ymp-cray os=-unicos @@ -988,6 +1260,10 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1007,6 +1283,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1023,13 +1302,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) + sh[1234] | sh[24]a | sh[24]aeb | 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) @@ -1073,9 +1349,12 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1096,25 +1375,31 @@ case $os in # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ + | -aos* | -aros* | -cloudabi* \ | -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* \ + | -bitrig* | -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* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -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* | -windiss* \ - | -powermax* | -dnix* | -microbsd*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1132,12 +1417,15 @@ case $os in 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|'` ;; @@ -1150,6 +1438,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1171,6 +1462,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1193,6 +1487,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1223,6 +1520,17 @@ case $os in -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; + -aros*) + os=-aros + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; -none) ;; *) @@ -1245,6 +1553,12 @@ else # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1254,6 +1568,24 @@ case $basic_machine in arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1272,13 +1604,13 @@ case $basic_machine in ;; m68000-sun) os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 ;; m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1297,9 +1629,15 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1402,7 +1740,7 @@ case $basic_machine in -sunos*) vendor=sun ;; - -aix*) + -cnk*|-aix*) vendor=ibm ;; -beos*) @@ -1432,9 +1770,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; @@ -1459,7 +1803,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/BasiliskII/src/Unix/m4/m4-ax_cxx_compile_stdcxx_11.m4 b/BasiliskII/src/Unix/m4/m4-ax_cxx_compile_stdcxx_11.m4 new file mode 100644 index 000000000..e76fd6053 --- /dev/null +++ b/BasiliskII/src/Unix/m4/m4-ax_cxx_compile_stdcxx_11.m4 @@ -0,0 +1,171 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++11 +# standard; if necessary, add switches to CXXFLAGS to enable support. +# +# The first argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The second argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline C++11 support is required and that the macro +# should error out if no mode with that support is found. If specified +# 'optional', then configuration proceeds regardless, after defining +# HAVE_CXX11 if and only if a supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 12 + +m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[ + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + struct Base { + virtual void f() {} + }; + struct Child : public Base { + virtual void f() override {} + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c); + + auto d = a; + auto l = [](){}; + // Prevent Clang error: unused variable 'l' [-Werror,-Wunused-variable] + struct use_l { use_l() { l(); } }; + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this + namespace test_template_alias_sfinae { + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { + func(0); + } + } + + // Check for C++11 attribute support + void noret [[noreturn]] () { throw 0; } +]]) + +AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl + m4_if([$1], [], [], + [$1], [ext], [], + [$1], [noext], [], + [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl + m4_if([$2], [], [ax_cxx_compile_cxx11_required=true], + [$2], [mandatory], [ax_cxx_compile_cxx11_required=true], + [$2], [optional], [ax_cxx_compile_cxx11_required=false], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++11 features by default, + ax_cv_cxx_compile_cxx11, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [ax_cv_cxx_compile_cxx11=yes], + [ax_cv_cxx_compile_cxx11=no])]) + if test x$ax_cv_cxx_compile_cxx11 = xyes; then + ac_success=yes + fi + + m4_if([$1], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++11 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + + m4_if([$1], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + for switch in -std=c++11 -std=c++0x +std=c++11; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx11_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) + fi + else + if test x$ac_success = xno; then + HAVE_CXX11=0 + AC_MSG_NOTICE([No compiler with C++11 support was found]) + else + HAVE_CXX11=1 + AC_DEFINE(HAVE_CXX11,1, + [define if the compiler supports basic C++11 syntax]) + fi + + AC_SUBST(HAVE_CXX11) + fi +]) diff --git a/BasiliskII/src/Unix/main_unix.cpp b/BasiliskII/src/Unix/main_unix.cpp index 3505335e8..b10c18f11 100644 --- a/BasiliskII/src/Unix/main_unix.cpp +++ b/BasiliskII/src/Unix/main_unix.cpp @@ -611,7 +611,7 @@ int main(int argc, char **argv) #if DIRECT_ADDRESSING // RAMBaseMac shall always be zero - MEMBaseDiff = (uintptr)RAMBaseHost; + MEMBase = RAMBaseHost; RAMBaseMac = 0; ROMBaseMac = Host2MacAddr(ROMBaseHost); #endif diff --git a/BasiliskII/src/Unix/sysdeps.h b/BasiliskII/src/Unix/sysdeps.h index df2919394..e6b2a5ec6 100644 --- a/BasiliskII/src/Unix/sysdeps.h +++ b/BasiliskII/src/Unix/sysdeps.h @@ -387,10 +387,10 @@ void Set_pthread_attr(pthread_attr_t *attr, int priority); #ifdef CPU_CAN_ACCESS_UNALIGNED /* Big-endian CPUs which can do unaligned accesses */ -static inline uae_u32 do_get_mem_long(uae_u32 *a) {return *a;} -static inline uae_u32 do_get_mem_word(uae_u16 *a) {return *a;} -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {*a = v;} -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = v;} +static inline uae_u32 do_get_mem_long(const void* a) {return *(const uae_u32*)a;} +static inline uae_u32 do_get_mem_word(const void* a) {return *(const uae_u16*)a;} +static inline void do_put_mem_long(void* a, uae_u32 v) {*(uae_u32*)a = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {*(uae_u16*)a = v;} #else /* CPU_CAN_ACCESS_UNALIGNED */ @@ -400,10 +400,10 @@ static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = v;} #ifdef __cplusplus extern "C" { /* only the C compiler does unaligned accesses */ #endif -extern uae_u32 do_get_mem_long(uae_u32 *a); -extern uae_u32 do_get_mem_word(uae_u16 *a); -extern void do_put_mem_long(uae_u32 *a, uae_u32 v); -extern void do_put_mem_word(uae_u16 *a, uae_u32 v); +extern uae_u32 do_get_mem_long(const void* a); +extern uae_u32 do_get_mem_word(const void* a); +extern void do_put_mem_long(void* a, uae_u32 v); +extern void do_put_mem_word(void* a, uae_u32 v); #ifdef __cplusplus } #endif @@ -411,10 +411,10 @@ extern void do_put_mem_word(uae_u16 *a, uae_u32 v); #else /* sgi */ /* Big-endian CPUs which can not do unaligned accesses (this is not the most efficient way to do this...) */ -static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint8 *b = (uint8 *)a; return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];} -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint8 *b = (uint8 *)a; return (b[0] << 8) | b[1];} -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {uint8 *b = (uint8 *)a; b[0] = v >> 24; b[1] = v >> 16; b[2] = v >> 8; b[3] = v;} -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {uint8 *b = (uint8 *)a; b[0] = v >> 8; b[1] = v;} +static inline uae_u32 do_get_mem_long(const void* a) {uint8* b = (const uint8*)a; return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];} +static inline uae_u32 do_get_mem_word(const void* a) {uint8* b = (const uint8*)a; return (b[0] << 8) | b[1];} +static inline void do_put_mem_long(void* a, uae_u32 v) {uint8* b = (uint8*)a; b[0] = v >> 24; b[1] = v >> 16; b[2] = v >> 8; b[3] = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {uint8* b = (uint8*)a; b[0] = v >> 8; b[1] = v;} #endif /* sgi */ #endif /* CPU_CAN_ACCESS_UNALIGNED */ @@ -425,19 +425,19 @@ static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {uint8 *b = (uint8 *)a /* Intel x86 */ #define X86_PPRO_OPT -static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_long(const void* a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*(const uae_u32*)a) : "cc"); return retval;} #ifdef X86_PPRO_OPT -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswapl %k0\n" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_word(const void* a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswapl %k0\n" : "=&r" (retval) : "m" (*(const uae_u16*)a) : "cc"); return retval;} #else -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_word(const void* a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*(const uae_u16*)a) : "cc"); return retval;} #endif #define HAVE_GET_WORD_UNSWAPPED #define do_get_mem_word_unswapped(a) ((uae_u32)*((uae_u16 *)(a))) -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;} +static inline void do_put_mem_long(void* a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *(uae_u32*)a = v;} #ifdef X86_PPRO_OPT -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); *(uae_u16*)a = v;} #else -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *(uae_u16*)a = v;} #endif #define HAVE_OPTIMIZED_BYTESWAP_32 /* bswap doesn't affect condition codes */ @@ -452,18 +452,18 @@ static inline uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v #elif defined(CPU_CAN_ACCESS_UNALIGNED) /* Other little-endian CPUs which can do unaligned accesses */ -static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 x = *a; return (x >> 24) | (x >> 8) & 0xff00 | (x << 8) & 0xff0000 | (x << 24);} -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint16 x = *a; return (x >> 8) | (x << 8);} -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {*a = (v >> 24) | (v >> 8) & 0xff00 | (v << 8) & 0xff0000 | (v << 24);} -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = (v >> 8) | (v << 8);} +static inline uae_u32 do_get_mem_long(const void* a) {uint32 x = *(uae_u32*)a; return (x >> 24) | (x >> 8) & 0xff00 | (x << 8) & 0xff0000 | (x << 24);} +static inline uae_u32 do_get_mem_word(const void* a) {uint16 x = *(uae_u16*)a; return (x >> 8) | (x << 8);} +static inline void do_put_mem_long(void* a, uae_u32 v) {*(uae_u32*)a = (v >> 24) | (v >> 8) & 0xff00 | (v << 8) & 0xff0000 | (v << 24);} +static inline void do_put_mem_word(void* a, uae_u32 v) {*(uae_u32*)a = (v >> 8) | (v << 8);} #else /* CPU_CAN_ACCESS_UNALIGNED */ /* Other little-endian CPUs which can not do unaligned accesses (this needs optimization) */ -static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint8 *b = (uint8 *)a; return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];} -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint8 *b = (uint8 *)a; return (b[0] << 8) | b[1];} -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {uint8 *b = (uint8 *)a; b[0] = v >> 24; b[1] = v >> 16; b[2] = v >> 8; b[3] = v;} -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {uint8 *b = (uint8 *)a; b[0] = v >> 8; b[1] = v;} +static inline uae_u32 do_get_mem_long(const void* a) {const uint8* b = (const uint8*)a; return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];} +static inline uae_u32 do_get_mem_word(const void* a) {const uint8* b = (const uint8*)a; return (b[0] << 8) | b[1];} +static inline void do_put_mem_long(void* a, uae_u32 v) {uint8* b = (uint8*)a; b[0] = v >> 24; b[1] = v >> 16; b[2] = v >> 8; b[3] = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {uint8* b = (uint8*)a; b[0] = v >> 8; b[1] = v;} #endif /* CPU_CAN_ACCESS_UNALIGNED */ diff --git a/BasiliskII/src/Windows/.gitignore b/BasiliskII/src/Windows/.gitignore new file mode 100644 index 000000000..c28aa9ea8 --- /dev/null +++ b/BasiliskII/src/Windows/.gitignore @@ -0,0 +1,3 @@ +# Visual Studio generated files +.vs +*.sdf diff --git a/BasiliskII/src/Windows/Makefile.in b/BasiliskII/src/Windows/Makefile.in index dfa59a60e..c6923e4a1 100755 --- a/BasiliskII/src/Windows/Makefile.in +++ b/BasiliskII/src/Windows/Makefile.in @@ -40,19 +40,19 @@ CXXFLAGS = @CXXFLAGS@ $(SDL_CFLAGS) CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../CrossPlatform @CPUINCLUDES@ -I../slirp DEFS = @DEFS@ @DEFINES@ LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -lwsock32 -liphlpapi +LIBS = @LIBS@ -lws2_32 -liphlpapi CPUSRCS = @CPUSRCS@ -HOST_CC = gcc -HOST_CXX = g++ -HOST_CFLAGS = -O2 -HOST_CXXFLAGS = -O2 +HOST_CC = cc +HOST_CXX = c++ +HOST_CFLAGS = @CFLAGS@ +HOST_CXXFLAGS = @CXXFLAGS@ HOST_LDFLAGS = ## Files -XPLATSRCS = vm_alloc.cpp vm_alloc.h sigsegv.cpp sigsegv.h video_vosf.h video_blit.cpp video_blit.h +XPLATSRCS = ../CrossPlatform/vm_alloc.cpp ../CrossPlatform/sigsegv.cpp ../CrossPlatform/video_blit.cpp -CDENABLESRCS = cdenable/cache.cpp cdenable/eject_nt.cpp cdenable/ntcd.cpp +CDENABLESRCS = @CDENABLESRCS@ ROUTERSRCS = router/arp.cpp router/dump.cpp router/dynsockets.cpp router/ftp.cpp \ router/icmp.cpp router/mib/interfaces.cpp router/iphelp.cpp router/ipsocket.cpp \ @@ -64,11 +64,11 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window timer_windows.cpp ../adb.cpp ../serial.cpp serial_windows.cpp \ ../ether.cpp ether_windows.cpp ../sony.cpp ../disk.cpp ../cdrom.cpp \ ../scsi.cpp ../dummy/scsi_dummy.cpp ../video.cpp ../SDL/video_sdl.cpp \ - video_blit.cpp ../audio.cpp ../SDL/audio_sdl.cpp clip_windows.cpp \ + ../audio.cpp ../SDL/audio_sdl.cpp clip_windows.cpp \ ../extfs.cpp extfs_windows.cpp ../user_strings.cpp user_strings_windows.cpp \ - vm_alloc.cpp sigsegv.cpp posix_emu.cpp util_windows.cpp \ + posix_emu.cpp util_windows.cpp \ ../dummy/prefs_editor_dummy.cpp BasiliskII.rc \ - $(CDENABLESRCS) $(ROUTERSRCS) $(CPUSRCS) $(SLIRP_OBJS) + $(CDENABLESRCS) $(ROUTERSRCS) $(CPUSRCS) $(SLIRP_OBJS) $(XPLATSRCS) UI_SRCS = ../prefs.cpp prefs_windows.cpp prefs_editor_gtk.cpp xpram_windows.cpp \ ../prefs_items.cpp ../user_strings.cpp user_strings_windows.cpp util_windows.cpp \ @@ -91,9 +91,6 @@ endif all: $(PROGS) -$(XPLATSRCS): %: ../CrossPlatform/% - $(LN_S) $< $@ - OBJ_DIR = obj $(OBJ_DIR):: @[ -d $(OBJ_DIR) ] || mkdir $(OBJ_DIR) > /dev/null 2>&1 @@ -114,17 +111,16 @@ SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file)))) VPATH := VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS)))) -$(APP): $(XPLATSRCS) $(OBJ_DIR) $(OBJS) +$(APP): $(OBJ_DIR) $(OBJS) $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) $(SDL_LIBS) -$(UI_APP): $(XPLATSRCS) $(OBJ_DIR) $(UI_OBJS) - $(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) $(GTK_LIBS) -mwindows -mno-cygwin +$(UI_APP): $(OBJ_DIR) $(UI_OBJS) + $(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) $(GTK_LIBS) -mwindows mostlyclean: rm -f $(APP) $(UI_APP) $(OBJ_DIR)/* core* *.core *~ *.bak clean: mostlyclean - rm -f $(XPLATSRCS) rm -f cpuemu.cpp cpudefs.cpp cputmp*.s cpufast*.s cpustbl.cpp cputbl.h compemu.cpp compstbl.cpp comptbl.h distclean: clean @@ -149,7 +145,7 @@ $(OBJ_DIR)/%.o : %.cpp $(OBJ_DIR)/%.o : %.s $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c $< -o $@ $(OBJ_DIR)/prefs_editor_gtk.o: prefs_editor_gtk.cpp - $(CXX) -O2 -mno-cygwin -mms-bitfields $(CPPFLAGS) $(DEFS) $(GTK_CFLAGS) -c $< -o $@ + $(CXX) -O2 -mms-bitfields $(CPPFLAGS) $(DEFS) $(GTK_CFLAGS) $(CXXFLAGS) -c $< -o $@ # Windows resources $(OBJ_DIR)/%.o: %.rc diff --git a/BasiliskII/src/Windows/b2ether/inc/ntddpack.h b/BasiliskII/src/Windows/b2ether/inc/ntddpack.h index 62af4f3f1..7b10609a2 100755 --- a/BasiliskII/src/Windows/b2ether/inc/ntddpack.h +++ b/BasiliskII/src/Windows/b2ether/inc/ntddpack.h @@ -1,9 +1,7 @@ -// #include - #ifndef __NTDDPACKET #define __NTDDPACKET 1 -// #include +#include #define MAX_LINK_NAME_LENGTH 124 @@ -12,7 +10,7 @@ typedef struct _PACKET_OID_DATA { ULONG Oid; ULONG Length; UCHAR Data[1]; -} ATTRIBUTE_PACKED PACKET_OID_DATA, *PPACKET_OID_DATA; +} PACKET_OID_DATA, *PPACKET_OID_DATA; #pragma pack() diff --git a/BasiliskII/src/Windows/b2ether/packet32.cpp b/BasiliskII/src/Windows/b2ether/packet32.cpp index 72efb1fe9..429ca92c8 100755 --- a/BasiliskII/src/Windows/b2ether/packet32.cpp +++ b/BasiliskII/src/Windows/b2ether/packet32.cpp @@ -26,14 +26,6 @@ #include #include #include "cpu_emulation.h" -typedef unsigned long ULONG_PTR, *PULONG_PTR; - -// VC6 does not have this, Platform SDK has. -// In case of errors, try to comment out, the needed -// definitions are below (#ifndef _NTDDNDIS_) - -// Most people don't have the Platform SDK, so I take this one out. -// #include #include "inc/ntddpack.h" @@ -42,23 +34,6 @@ typedef unsigned long ULONG_PTR, *PULONG_PTR; #include "b2ether/multiopt.h" #include "b2ether/inc/b2ether_hl.h" - - -#ifndef _NTDDNDIS_ -#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 -#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 -#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 -#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 -#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 - -#define OID_802_3_PERMANENT_ADDRESS 0x01010101 -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#define OID_802_3_MULTICAST_LIST 0x01010103 - -#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E -#endif - #define DEBUG_PACKETS 0 #define DEBUG 0 #include "debug.h" diff --git a/BasiliskII/src/Windows/cdenable/eject_nt.cpp b/BasiliskII/src/Windows/cdenable/eject_nt.cpp index 414ce4b97..a9d5291aa 100755 --- a/BasiliskII/src/Windows/cdenable/eject_nt.cpp +++ b/BasiliskII/src/Windows/cdenable/eject_nt.cpp @@ -30,11 +30,11 @@ extern "C" { #include "eject_nt.h" -LPTSTR szVolumeFormat = TEXT("\\\\.\\%c:"); -LPTSTR szRootFormat = TEXT("%c:\\"); -LPTSTR szErrorFormat = TEXT("Error %d: %s\n"); +LPCTSTR szVolumeFormat = TEXT("\\\\.\\%c:"); +LPCTSTR szRootFormat = TEXT("%c:\\"); +LPCTSTR szErrorFormat = TEXT("Error %d: %s\n"); -void ReportError(LPTSTR szMsg) +void ReportError(LPCTSTR szMsg) { // _tprintf(szErrorFormat, GetLastError(), szMsg); } diff --git a/BasiliskII/src/Windows/clip_windows.cpp b/BasiliskII/src/Windows/clip_windows.cpp index c4ee65bc0..2b0af334e 100755 --- a/BasiliskII/src/Windows/clip_windows.cpp +++ b/BasiliskII/src/Windows/clip_windows.cpp @@ -233,7 +233,7 @@ static void do_getscrap(void **handle, uint32 type, int32 offset) D(bug(" clipping TEXT\n")); // Convert text from ISO-Latin1 to Mac charset - uint8 *p = Mac2HostAddr(scrap_area); + uint8* p = static_cast(Mac2HostAddr(scrap_area)); for (uint32 i = 0; i < length; i++) { uint8 c = data[i]; if (c < 0x80) { diff --git a/BasiliskII/src/Windows/configure.ac b/BasiliskII/src/Windows/configure.ac index fc9027047..7f51b2e22 100755 --- a/BasiliskII/src/Windows/configure.ac +++ b/BasiliskII/src/Windows/configure.ac @@ -64,10 +64,10 @@ case "$target_cpu" in esac dnl Checks for programs. -AC_PROG_CC +AC_PROG_CC([cc clang gcc]) AC_PROG_CC_C_O AC_PROG_CPP -AC_PROG_CXX +AC_PROG_CXX([c++ clang++ g++]) AC_PROG_MAKE_SET AC_PROG_EGREP AC_PROG_LN_S @@ -89,6 +89,7 @@ dnl Checks for header files. AC_HEADER_STDC dnl Checks for typedefs, structures, and compiler characteristics. +AX_CXX_COMPILE_STDCXX_11(noext, mandatory) AC_C_BIGENDIAN AC_C_CONST AC_C_INLINE @@ -131,7 +132,7 @@ AC_CACHE_CHECK([whether VirtualProtect works], #define HAVE_WIN32_VM 1 #define CONFIGURE_TEST_VM_MAP #define TEST_VM_PROT_$test_def - #include "../Unix/vm_alloc.cpp" + #include "../CrossPlatform/vm_alloc.cpp" ], ac_cv_VirtualProtect_works=no, rm -f core, dnl When cross-compiling, assume it works ac_cv_VirtualProtect_works="yes" @@ -141,7 +142,7 @@ AC_CACHE_CHECK([whether VirtualProtect works], #define HAVE_WIN32_VM 1 #define CONFIGURE_TEST_VM_MAP #define TEST_VM_PROT_RDWR_WRITE - #include "../Unix/vm_alloc.cpp" + #include "../CrossPlatform/vm_alloc.cpp" ], , ac_cv_VirtualProtect_works=no, dnl When cross-compiling, assume it works ac_cv_VirtualProtect_works="yes" @@ -163,8 +164,8 @@ AC_CACHE_CHECK([whether your system supports Windows exceptions], AC_TRY_RUN([ #define HAVE_WIN32_EXCEPTIONS 1 #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../Unix/vm_alloc.cpp" - #include "../Unix/sigsegv.cpp" + #include "../CrossPlatform/vm_alloc.cpp" + #include "../CrossPlatform/sigsegv.cpp" ], ac_cv_have_win32_exceptions=yes, ac_cv_have_win32_exceptions=no, @@ -188,8 +189,8 @@ AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], AC_TRY_RUN([ #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 #define CONFIGURE_TEST_SIGSEGV_RECOVERY - #include "../Unix/vm_alloc.cpp" - #include "../Unix/sigsegv.cpp" + #include "../CrossPlatform/vm_alloc.cpp" + #include "../CrossPlatform/sigsegv.cpp" ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, dnl When cross-compiling, do not assume anything. ac_cv_have_skip_instruction=no @@ -304,6 +305,11 @@ elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then fi fi +dnl If building using mingw, prefer 64-bit time_t. +case "$host_os" in + mingw*) DEFINES="$DEFINES -D__MINGW_USE_VC2005_COMPAT" +esac + dnl Enable JIT compiler, if possible. if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o" @@ -523,6 +529,9 @@ dnl UAE CPU sources for all non-m68k-native architectures. CPUINCLUDES="-I../uae_cpu" CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS" +dnl Eventually, these should be optional. +CDENABLESRCS="cdenable/cache.cpp cdenable/eject_nt.cpp cdenable/ntcd.cpp" + dnl We really want SDL for now AC_CHECK_TOOL(sdl_config, sdl-config, [AC_MSG_ERROR([Sorry, you currently need SDL for this port])]) SDL_CFLAGS=`$sdl_config --cflags` @@ -552,6 +561,7 @@ dnl Generate Makefile. AC_SUBST(DEFINES) AC_SUBST(CPUINCLUDES) AC_SUBST(CPUSRCS) +AC_SUBST(CDENABLESRCS) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/BasiliskII/src/Windows/ether_windows.cpp b/BasiliskII/src/Windows/ether_windows.cpp index 1f59d8305..0179c21c8 100755 --- a/BasiliskII/src/Windows/ether_windows.cpp +++ b/BasiliskII/src/Windows/ether_windows.cpp @@ -22,11 +22,6 @@ #include "sysdeps.h" -#include -#include -#include -#include - #include "cpu_emulation.h" #include "main.h" #include "macos_util.h" @@ -40,6 +35,14 @@ #include "router/router.h" #include "util_windows.h" #include "libslirp.h" + +#include +using std::min; + +#include +#include +#include +#include // Define to let the slirp library determine the right timeout for select() #define USE_SLIRP_TIMEOUT 1 @@ -144,7 +147,7 @@ static LPPACKET write_packet_pool = 0; static int echo_count = 0; typedef uint8 echo_t[1514]; static echo_t pending_packet[MAX_ECHO]; -static int pending_packet_sz[MAX_ECHO]; +static unsigned pending_packet_sz[MAX_ECHO]; // List of attached protocols @@ -676,13 +679,13 @@ void EtherIRQ(void) // Add multicast address int16 ether_add_multicast(uint32 pb) { - return ether_do_add_multicast(Mac2HostAddr(pb + eMultiAddr)); + return ether_do_add_multicast(static_cast(Mac2HostAddr(pb + eMultiAddr))); } // Disable multicast address int16 ether_del_multicast(uint32 pb) { - return ether_do_del_multicast(Mac2HostAddr(pb + eMultiAddr)); + return ether_do_del_multicast(static_cast(Mac2HostAddr(pb + eMultiAddr))); } // Transmit one packet @@ -862,7 +865,7 @@ int16 ether_detach_ph(uint16 type) } #if MONITOR -static void dump_packet( uint8 *packet, int length ) +static void dump_packet( const uint8 *packet, int length ) { char buf[1000], sm[10]; @@ -1023,7 +1026,7 @@ unsigned int WINAPI ether_thread_write_packets(void *arg) return(0); } -static BOOL write_packet( uint8 *packet, int len ) +static BOOL write_packet( uint8 *packet, unsigned len ) { LPPACKET Packet; @@ -1034,7 +1037,7 @@ static BOOL write_packet( uint8 *packet, int len ) memcpy( Packet->Buffer, packet, len ); EnterCriticalSection( &fetch_csection ); - pending_packet_sz[echo_count] = min(sizeof(pending_packet),len); + pending_packet_sz[echo_count] = min(unsigned(sizeof(pending_packet)),len); memcpy( pending_packet[echo_count], packet, pending_packet_sz[echo_count] ); echo_count = (echo_count+1) & (~(MAX_ECHO-1)); LeaveCriticalSection( &fetch_csection ); @@ -1117,7 +1120,7 @@ void enqueue_packet( const uint8 *buf, int sz ) LeaveCriticalSection( &queue_csection ); } -static int dequeue_packet( uint8 *buf ) +static int dequeue_packet( void *buf ) { int sz; @@ -1405,7 +1408,7 @@ VOID CALLBACK packet_read_completion( D(bug("packet_read_completion bytes=%d, error code=%d\n",dwNumberOfBytesTransfered,dwErrorCode)); if(thread_active && !dwErrorCode) { - int count = min(dwNumberOfBytesTransfered,1514); + int count = min(dwNumberOfBytesTransfered,DWORD(1514)); if(count) { int j = echo_count; for(int i=MAX_ECHO; i; i--) { diff --git a/BasiliskII/src/Windows/main_windows.cpp b/BasiliskII/src/Windows/main_windows.cpp index 7d555c98c..1400701fb 100755 --- a/BasiliskII/src/Windows/main_windows.cpp +++ b/BasiliskII/src/Windows/main_windows.cpp @@ -209,7 +209,7 @@ static void usage(const char *prg_name) int main(int argc, char **argv) { - char str[256]; + char errstr[256]; bool cd_boot = false; // Initialize variables @@ -297,9 +297,8 @@ int main(int argc, char **argv) #endif assert(sdl_flags != 0); if (SDL_Init(sdl_flags) == -1) { - char str[256]; - sprintf(str, "Could not initialize SDL: %s.\n", SDL_GetError()); - ErrorAlert(str); + sprintf(errstr, "Could not initialize SDL: %s.\n", SDL_GetError()); + ErrorAlert(errstr); QuitEmulator(); } atexit(SDL_Quit); @@ -314,8 +313,8 @@ int main(int argc, char **argv) // Install the handler for SIGSEGV if (!sigsegv_install_handler(sigsegv_handler)) { - sprintf(str, GetString(STR_SIG_INSTALL_ERR), "SIGSEGV", strerror(errno)); - ErrorAlert(str); + sprintf(errstr, GetString(STR_SIG_INSTALL_ERR), "SIGSEGV", strerror(errno)); + ErrorAlert(errstr); QuitEmulator(); } @@ -353,7 +352,7 @@ int main(int argc, char **argv) #if DIRECT_ADDRESSING // RAMBaseMac shall always be zero - MEMBaseDiff = (uintptr)RAMBaseHost; + MEMBase = RAMBaseHost; RAMBaseMac = 0; ROMBaseMac = Host2MacAddr(ROMBaseHost); #endif @@ -402,8 +401,8 @@ int main(int argc, char **argv) // SDL threads available, start 60Hz thread tick_thread_active = ((tick_thread = SDL_CreateThread(tick_func, NULL)) != NULL); if (!tick_thread_active) { - sprintf(str, GetString(STR_TICK_THREAD_ERR), strerror(errno)); - ErrorAlert(str); + sprintf(errstr, GetString(STR_TICK_THREAD_ERR), strerror(errno)); + ErrorAlert(errstr); QuitEmulator(); } D(bug("60Hz thread started\n")); diff --git a/BasiliskII/src/Windows/posix_emu.cpp b/BasiliskII/src/Windows/posix_emu.cpp index 518a526fc..c0016db2f 100755 --- a/BasiliskII/src/Windows/posix_emu.cpp +++ b/BasiliskII/src/Windows/posix_emu.cpp @@ -323,11 +323,6 @@ static bool is_ntfs_volume(LPCTSTR rootdir) // !!UNC void init_posix_emu(void) { - if(!validate_stat_struct) { - ErrorAlert( "Invalid struct my_stat -- edit posix_emu.h" ); - QuitEmulator(); - } - #if DEBUG_EXTFS debug_extfs = PrefsFindInt16("debugextfs"); diff --git a/BasiliskII/src/Windows/posix_emu.h b/BasiliskII/src/Windows/posix_emu.h index f50775581..e4dc0cfa1 100755 --- a/BasiliskII/src/Windows/posix_emu.h +++ b/BasiliskII/src/Windows/posix_emu.h @@ -78,6 +78,21 @@ extern int my_errno; // must hook all other functions that manipulate file names #ifndef NO_POSIX_API_HOOK +#undef stat +#undef fstat +#undef open +#undef rename +#undef access +#undef mkdir +#undef remove +#undef creat +#undef close +#undef lseek +#undef read +#undef write +#undef ftruncate +#undef locking + #define stat my_stat #define fstat my_fstat #define open my_open @@ -110,13 +125,16 @@ struct my_stat { short st_uid; short st_gid; _dev_t st_rdev; +#if __MINGW32__ && !defined _USE_32BIT_TIME_T + __int64 st_size; +#else _off_t st_size; +#endif time_t st_atime; time_t st_mtime; time_t st_ctime; }; - -// Your compiler may have different "struct stat" -> edit "struct my_stat" -#define validate_stat_struct ( sizeof(struct my_stat) == sizeof(struct stat) ) +static_assert(sizeof(struct stat) == sizeof(struct my_stat), + "Your compiler may have different struct stat -> edit struct my_stat"); #define st_crtime st_ctime diff --git a/BasiliskII/src/Windows/router/tcp.cpp b/BasiliskII/src/Windows/router/tcp.cpp index 4b0800dd7..c0328e083 100755 --- a/BasiliskII/src/Windows/router/tcp.cpp +++ b/BasiliskII/src/Windows/router/tcp.cpp @@ -283,9 +283,9 @@ static int alloc_socket() // sockets[i].src_port = sockets[i].dest_port = 0; memset( &sockets[i].overlapped_read, 0, sizeof(sockets[i].overlapped_read) ); - sockets[i].overlapped_read.hEvent = (HANDLE)i; + sockets[i].overlapped_read.hEvent = HANDLE(intptr_t(i)); memset( &sockets[i].overlapped_write, 0, sizeof(sockets[i].overlapped_write) ); - sockets[i].overlapped_write.hEvent = (HANDLE)i; + sockets[i].overlapped_write.hEvent = HANDLE(intptr_t(i)); sockets[i].bytes_received = 0; sockets[i].bytes_written = 0; @@ -691,7 +691,7 @@ static void CALLBACK tcp_read_completion( { EnterCriticalSection( &tcp_section ); - const int t = (int)lpOverlapped->hEvent; + const int t = intptr_t(lpOverlapped->hEvent); sockets[t].bytes_received = bytes_read; @@ -775,7 +775,7 @@ static void CALLBACK tcp_write_completion( { EnterCriticalSection( &tcp_section ); - const int t = (int)lpOverlapped->hEvent; + const int t = intptr_t(lpOverlapped->hEvent); sockets[t].bytes_written = bytes_written; sockets[t].bytes_remaining_to_send -= bytes_written; @@ -1332,7 +1332,7 @@ void write_tcp( tcp_t *tcp, int len ) - Expire time-waits. - Handle resend timeouts. */ -static unsigned int WINAPI tcp_connect_close_thread(void *arg) +static DWORD WINAPI tcp_connect_close_thread(void *arg) { WSAEVENT wait_handles[MAX_SOCKETS]; @@ -1428,7 +1428,7 @@ static unsigned int WINAPI tcp_connect_close_thread(void *arg) return 0; } -static unsigned int WINAPI tcp_listen_thread(void *arg) +static DWORD WINAPI tcp_listen_thread(void *arg) { WSAEVENT wait_handles[MAX_SOCKETS]; @@ -1550,11 +1550,8 @@ void init_tcp() init_tcp_listen_ports(); - unsigned int tcp_tid; - tcp_handle = (HANDLE)_beginthreadex( 0, 0, tcp_connect_close_thread, 0, 0, &tcp_tid ); - - unsigned int tcp_l_tid; - tcp_l_handle = (HANDLE)_beginthreadex( 0, 0, tcp_listen_thread, 0, 0, &tcp_l_tid ); + tcp_handle = CreateThread(nullptr, 0, tcp_connect_close_thread, nullptr, 0, nullptr); + tcp_l_handle = CreateThread(nullptr, 0, tcp_listen_thread, nullptr, 0, nullptr); } void final_tcp() diff --git a/BasiliskII/src/Windows/serial_windows.cpp b/BasiliskII/src/Windows/serial_windows.cpp index 5a062b32b..7615e8bb1 100755 --- a/BasiliskII/src/Windows/serial_windows.cpp +++ b/BasiliskII/src/Windows/serial_windows.cpp @@ -23,9 +23,6 @@ // TODO: serial i/o threads should have high priority. #include "sysdeps.h" -#include -#include - #include "main.h" #include "util_windows.h" #include "macos_util.h" @@ -34,6 +31,12 @@ #include "serial_defs.h" #include "cpu_emulation.h" +#include +using std::min; + +#include +#include + // This must be always on. #define DEBUG 1 #undef OutputDebugString @@ -166,8 +169,8 @@ class XSERDPort : public SERDPort { private: bool configure(uint16 config); void set_handshake(uint32 s, bool with_dtr); - static unsigned int WINAPI input_func(void *arg); - static unsigned int WINAPI output_func(void *arg); + static DWORD WINAPI input_func(LPVOID arg); + static DWORD WINAPI output_func(LPVOID arg); static int acknowledge_error(HANDLE h, bool is_read); bool set_timeouts(int bauds, int parity_bits, int stop_bits); @@ -178,12 +181,12 @@ class XSERDPort : public SERDPort { bool quitting; // Flag: Quit threads HANDLE input_thread_active; // Handle: Input thread installed (was a bool) - unsigned int input_thread_id; + DWORD input_thread_id; HANDLE input_signal; // Signal for input thread: execute command uint32 input_pb, input_dce; // Command parameters for input thread HANDLE output_thread_active; // Handle: Output thread installed (was a bool) - unsigned int output_thread_id; + DWORD output_thread_id; HANDLE output_signal; // Signal for output thread: execute command uint32 output_pb, output_dce; // Command parameters for output thread @@ -246,7 +249,7 @@ void SerialExit(void) int16 XSERDPort::open(uint16 config) { // Don't open NULL name devices - if (!device_name || !*device_name) + if (!*device_name) return openErr; D(bug(TEXT("XSERDPort::open device=%s,config=0x%X\r\n"),device_name,(int)config)); @@ -296,8 +299,8 @@ int16 XSERDPort::open(uint16 config) D(bug("Semaphores created\r\n")); - input_thread_active = (HANDLE)_beginthreadex( 0, 0, input_func, (LPVOID)this, 0, &input_thread_id ); - output_thread_active = (HANDLE)_beginthreadex( 0, 0, output_func, (LPVOID)this, 0, &output_thread_id ); + input_thread_active = CreateThread( NULL, 0, input_func, this, 0, &input_thread_id ); + output_thread_active = CreateThread( NULL, 0, output_func, this, 0, &output_thread_id ); if (!input_thread_active || !output_thread_active) goto open_error; @@ -310,12 +313,12 @@ int16 XSERDPort::open(uint16 config) if (input_thread_active) { TerminateThread(input_thread_active,0); CloseHandle(input_signal); - input_thread_active = false; + input_thread_active = NULL; } if (output_thread_active) { TerminateThread(output_thread_active,0); CloseHandle(output_signal); - output_thread_active = false; + output_thread_active = NULL; } if(fd != INVALID_HANDLE_VALUE) { CloseHandle(fd); @@ -674,13 +677,13 @@ int16 XSERDPort::close() if (input_thread_active) { quitting = true; ReleaseSemaphore(input_signal,1,NULL); - input_thread_active = false; + input_thread_active = NULL; CloseHandle(input_signal); } if (output_thread_active) { quitting = true; ReleaseSemaphore(output_signal,1,NULL); - output_thread_active = false; + output_thread_active = NULL; // bugfix: was: CloseHandle(&output_signal); CloseHandle(output_signal); } @@ -1018,7 +1021,7 @@ static void dump_dirst_bytes( BYTE *buf, int32 actual ) if(debug_serial != DB_SERIAL_LOUD) return; BYTE b[256]; - int32 i, bytes = min(actual,sizeof(b)-3); + int32 i, bytes = min(actual,int32(sizeof(b)-3)); for (i=0; i #include #include + +// MinGW Windows headers don't define min/max when compiling in C++ +// mode, so make sure other environments behave the same way. +#if defined __cplusplus && !defined NOMINMAX +#define NOMINMAX +#endif #define WIN32_LEAN_AND_MEAN #include #include @@ -79,6 +85,11 @@ /* ExtFS is supported */ #define SUPPORTS_EXTFS 1 +/* Disable specific warnings */ +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wswitch" +#endif + /* POSIX data types missing from Microsoft's CRT */ #ifdef _MSC_VER typedef ptrdiff_t ssize_t; @@ -225,25 +236,25 @@ static inline int spin_trylock(spinlock_t *lock) #define HAVE_OPTIMIZED_BYTESWAP_16 #ifdef _MSC_VER -static inline uae_u32 do_get_mem_long(uae_u32 *a) {return _byteswap_ulong(*a);} -static inline uae_u32 do_get_mem_word(uae_u16 *a) {return _byteswap_ushort(*a);} -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {*a = _byteswap_ulong(v);} -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {*a = _byteswap_ushort(v);} +static inline uae_u32 do_get_mem_long(const void* a) {return _byteswap_ulong(*(const uae_u32*)a);} +static inline uae_u32 do_get_mem_word(const void* a) {return _byteswap_ushort(*(const uae_u16*)a);} +static inline void do_put_mem_long(void* a, uae_u32 v) {*(uae_u32*)a = _byteswap_ulong(v);} +static inline void do_put_mem_word(void* a, uae_u32 v) {*(uae_u16*)a = _byteswap_ushort(v);} static inline uae_u32 do_byteswap_32_g(uae_u32 v) {return _byteswap_ulong(v);} static inline uae_u32 do_byteswap_16_g(uae_u32 v) {return _byteswap_ushort(v);} #else /* Intel x86 */ -static inline uae_u32 do_get_mem_long(uae_u32 *a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_long(const void* a) {uint32 retval; __asm__ ("bswap %0" : "=r" (retval) : "0" (*(const uae_u32*)a) : "cc"); return retval;} #ifdef X86_PPRO_OPT -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswapl %k0\n" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_word(const void* a) {uint32 retval; __asm__ ("movzwl %w1,%k0\n\tshll $16,%k0\n\tbswapl %k0\n" : "=&r" (retval) : "m" (*(const uae_u16*)a) : "cc"); return retval;} #else -static inline uae_u32 do_get_mem_word(uae_u16 *a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*a) : "cc"); return retval;} +static inline uae_u32 do_get_mem_word(const void* a) {uint32 retval; __asm__ ("xorl %k0,%k0\n\tmovw %w1,%w0\n\trolw $8,%w0" : "=&r" (retval) : "m" (*(const uae_u16*)a) : "cc"); return retval;} #endif -static inline void do_put_mem_long(uae_u32 *a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *a = v;} +static inline void do_put_mem_long(void* a, uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v) : "cc"); *(uae_u32*)a = v;} #ifdef X86_PPRO_OPT -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); *a = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {__asm__ ("bswapl %0" : "=&r" (v) : "0" (v << 16) : "cc"); *(uae_u16*)a = v;} #else -static inline void do_put_mem_word(uae_u16 *a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *a = v;} +static inline void do_put_mem_word(void* a, uae_u32 v) {__asm__ ("rolw $8,%0" : "=r" (v) : "0" (v) : "cc"); *(uae_u16*)a = v;} #endif /* bswap doesn't affect condition codes */ static inline uae_u32 do_byteswap_32_g(uae_u32 v) {__asm__ ("bswap %0" : "=r" (v) : "0" (v)); return v;} @@ -277,7 +288,7 @@ static inline uae_u32 do_byteswap_16_g(uae_u32 v) #if defined(__GNUC__) #define do_byteswap_16(x) \ (__extension__ \ - ({ register uint16 __v, __x = (x); \ + ({ uint16 __v, __x = (x); \ if (__builtin_constant_p(__x)) \ __v = do_byteswap_16_c(__x); \ else \ @@ -286,7 +297,7 @@ static inline uae_u32 do_byteswap_16_g(uae_u32 v) #define do_byteswap_32(x) \ (__extension__ \ - ({ register uint32 __v, __x = (x); \ + ({ uint32 __v, __x = (x); \ if (__builtin_constant_p(__x)) \ __v = do_byteswap_32_c(__x); \ else \ @@ -305,8 +316,8 @@ static inline uae_u32 do_byteswap_16_g(uae_u32 v) #define htons(x) do_byteswap_16(x) #endif -#define do_get_mem_byte(a) ((uae_u32)*((uae_u8 *)(a))) -#define do_put_mem_byte(a, v) (*(uae_u8 *)(a) = (v)) +#define do_get_mem_byte(a) ((uae_u32)*((const uae_u8*)(a))) +#define do_put_mem_byte(a, v) (*(uae_u8*)(a) = (v)) #define call_mem_get_func(func, addr) ((*func)(addr)) #define call_mem_put_func(func, addr, v) ((*func)(addr, v)) @@ -329,8 +340,4 @@ static inline uae_u32 do_byteswap_16_g(uae_u32 v) #endif #define REGPARAM2 -#ifdef _MSC_VER -#define ATTRIBUTE_PACKED -#endif - #endif diff --git a/BasiliskII/src/adb.cpp b/BasiliskII/src/adb.cpp index 27d1de73b..c05c00008 100644 --- a/BasiliskII/src/adb.cpp +++ b/BasiliskII/src/adb.cpp @@ -152,7 +152,7 @@ void ADBOp(uint8 op, uint8 *data) break; case 3: // Address/HandlerID data[0] = 2; - data[1] = mouse_reg_3[0] & 0xf0 | (rand() & 0x0f); + data[1] = (mouse_reg_3[0] & 0xf0) | (rand() & 0x0f); data[2] = mouse_reg_3[1]; break; default: @@ -211,7 +211,7 @@ void ADBOp(uint8 op, uint8 *data) } case 3: // Address/HandlerID data[0] = 2; - data[1] = key_reg_3[0] & 0xf0 | (rand() & 0x0f); + data[1] = (key_reg_3[0] & 0xf0) | (rand() & 0x0f); data[2] = key_reg_3[1]; break; default: diff --git a/BasiliskII/src/audio.cpp b/BasiliskII/src/audio.cpp index 00a89996f..d95004e00 100644 --- a/BasiliskII/src/audio.cpp +++ b/BasiliskII/src/audio.cpp @@ -82,7 +82,7 @@ static int32 AudioGetInfo(uint32 infoPtr, uint32 selector, uint32 sourceID) uint32 h = r.a[0]; if (h == 0) return memFullErr; - WriteMacInt16(infoPtr + sil_count, audio_sample_sizes.size()); + WriteMacInt16(infoPtr + sil_count, uint16(audio_sample_sizes.size())); WriteMacInt32(infoPtr + sil_infoHandle, h); uint32 sp = ReadMacInt32(h); for (unsigned i=0; id[1] & 0x80) != 0; if ((r->d[1] & 0x78) == 0x38) { // XPRAM - uint8 reg = (r->d[1] << 5) & 0xe0 | (r->d[1] >> 10) & 0x1f; + uint8 reg = ((r->d[1] << 5) & 0xe0) | ((r->d[1] >> 10) & 0x1f); if (is_read) { r->d[2] = XPRAM[reg]; bool localtalk = !(XPRAM[0xe0] || XPRAM[0xe1]); // LocalTalk enabled? @@ -210,7 +210,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r) } case M68K_EMUL_OP_ADBOP: // ADBOp() replacement - ADBOp(r->d[0], Mac2HostAddr(ReadMacInt32(r->a[0]))); + ADBOp(r->d[0], static_cast(Mac2HostAddr(ReadMacInt32(r->a[0])))); break; case M68K_EMUL_OP_INSTIME: // InsTime() replacement @@ -398,7 +398,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r) stack = 2; break; case 3: // SCSICmd - WriteMacInt16(r->a[7] + 6, SCSICmd(ReadMacInt16(r->a[7]), Mac2HostAddr(ReadMacInt32(r->a[7] + 2)))); + WriteMacInt16(r->a[7] + 6, SCSICmd(ReadMacInt16(r->a[7]), static_cast(Mac2HostAddr(ReadMacInt32(r->a[7] + 2))))); stack = 6; break; case 4: // SCSIComplete @@ -528,7 +528,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r) uint32 adr = ReadMacInt32(r->a[0]); if (adr == 0) break; - uint8 *p = Mac2HostAddr(adr); + uint8* p = static_cast(Mac2HostAddr(adr)); uint32 size = ReadMacInt32(adr - 8) & 0xffffff; CheckLoad(type, id, p, size); break; @@ -565,7 +565,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r) break; default: - printf("FATAL: EMUL_OP called with bogus opcode %08x\n", opcode); + printf("FATAL: EMUL_OP called with bogus opcode %04x\n", opcode); printf("d0 %08x d1 %08x d2 %08x d3 %08x\n" "d4 %08x d5 %08x d6 %08x d7 %08x\n" "a0 %08x a1 %08x a2 %08x a3 %08x\n" diff --git a/BasiliskII/src/include/debug.h b/BasiliskII/src/include/debug.h index 414ad3242..b9152689e 100644 --- a/BasiliskII/src/include/debug.h +++ b/BasiliskII/src/include/debug.h @@ -30,7 +30,7 @@ #include #include -static inline void _cdecl vwinbug(const char *s, va_list vargs) +static inline void vwinbug(const char *s, va_list vargs) { char msg[1024], date[50], hours[50]; struct _timeb tstruct; @@ -45,7 +45,7 @@ static inline void _cdecl vwinbug(const char *s, va_list vargs) OutputDebugStringA(msg); } -static inline void _cdecl vwwinbug( const wchar_t *s, va_list vargs) +static inline void vwwinbug( const wchar_t *s, va_list vargs) { wchar_t msg[1024], date[50], hours[50]; struct _timeb tstruct; @@ -60,14 +60,14 @@ static inline void _cdecl vwwinbug( const wchar_t *s, va_list vargs) OutputDebugStringW(msg); } -static inline void _cdecl winbug( const char *s, ...) +static inline void winbug( const char *s, ...) { va_list vargs; va_start(vargs, s); vwinbug(s, vargs); va_end(vargs); } -static inline void _cdecl wwinbug(const wchar_t *s, ...) +static inline void wwinbug(const wchar_t *s, ...) { va_list vargs; va_start(vargs, s); @@ -76,7 +76,7 @@ static inline void _cdecl wwinbug(const wchar_t *s, ...) } #ifdef __cplusplus -static inline void _cdecl winbug(wchar_t *s, ...) +static inline void winbug(wchar_t *s, ...) { va_list vargs; va_start(vargs, s); diff --git a/BasiliskII/src/include/scsi.h b/BasiliskII/src/include/scsi.h index 13c47e1bf..b29f90a37 100644 --- a/BasiliskII/src/include/scsi.h +++ b/BasiliskII/src/include/scsi.h @@ -38,6 +38,6 @@ extern void SCSIExit(void); extern void scsi_set_cmd(int cmd_length, uint8 *cmd); extern bool scsi_is_target_present(int id); extern bool scsi_set_target(int id, int lun); -extern bool scsi_send_cmd(size_t data_length, bool reading, int sg_index, uint8 **sg_ptr, uint32 *sg_len, uint16 *stat, uint32 timeout); +extern bool scsi_send_cmd(size_t data_length, bool reading, int sg_index, void* const* sg_ptr, uint32* sg_len, uint16* stat, uint32 timeout); #endif diff --git a/BasiliskII/src/include/video.h b/BasiliskII/src/include/video.h index 78526e67d..d08e4e097 100644 --- a/BasiliskII/src/include/video.h +++ b/BasiliskII/src/include/video.h @@ -159,10 +159,10 @@ class monitor_desc { const video_mode &get_current_mode(void) const {return *current_mode;} // Get Apple mode id for given depth - uint16 depth_to_apple_mode(video_depth depth) const {return apple_mode_for_depth[depth];} + uint8 depth_to_apple_mode(video_depth depth) const {return apple_mode_for_depth[depth];} // Get current color depth - uint16 get_apple_mode(void) const {return depth_to_apple_mode(current_mode->depth);} + uint8 get_apple_mode(void) const {return depth_to_apple_mode(current_mode->depth);} // Get bytes-per-row value for specified resolution/depth // (if the mode isn't supported, make a good guess) @@ -191,7 +191,7 @@ class monitor_desc { vector::const_iterator invalid_mode(void) const {return modes.end();} // Find specified mode (depth/resolution) (or invalid_mode() if not found) - vector::const_iterator find_mode(uint16 apple_mode, uint32 id) const; + vector::const_iterator find_mode(uint8 apple_mode, uint32 id) const; // Find maximum supported depth for given resolution ID video_depth max_depth_of_resolution(uint32 id) const; @@ -226,9 +226,9 @@ class monitor_desc { uint32 gamma_table; // Mac address of gamma table int alloc_gamma_table_size; // Allocated size of gamma table - uint16 current_apple_mode; // Currently selected depth/resolution + uint8 current_apple_mode; // Currently selected depth/resolution uint32 current_id; - uint16 preferred_apple_mode; // Preferred depth/resolution + uint8 preferred_apple_mode; // Preferred depth/resolution uint32 preferred_id; uint32 slot_param; // Mac address of Slot Manager parameter block @@ -237,7 +237,7 @@ class monitor_desc { // MacOS, the Apple modes must start at 0x80 and be contiguous. Therefore // we maintain an array to map the depth codes to the corresponding Apple // mode. - uint16 apple_mode_for_depth[6]; + uint8 apple_mode_for_depth[6]; // The following functions are implemented by platform-specific code public: diff --git a/BasiliskII/src/main.cpp b/BasiliskII/src/main.cpp index dcb86e9c2..9455d3874 100644 --- a/BasiliskII/src/main.cpp +++ b/BasiliskII/src/main.cpp @@ -177,7 +177,7 @@ bool InitAll(const char *vmdir) XPRAM[0x56] = 0x42; // 'B' XPRAM[0x57] = 0x32; // '2' const monitor_desc &main_monitor = *VideoMonitors[0]; - XPRAM[0x58] = uint8(main_monitor.depth_to_apple_mode(main_monitor.get_current_mode().depth)); + XPRAM[0x58] = main_monitor.depth_to_apple_mode(main_monitor.get_current_mode().depth); XPRAM[0x59] = 0; #if EMULATED_68K diff --git a/BasiliskII/src/native_cpu/cpu_emulation.h b/BasiliskII/src/native_cpu/cpu_emulation.h index 822ee0478..4170a1bb1 100644 --- a/BasiliskII/src/native_cpu/cpu_emulation.h +++ b/BasiliskII/src/native_cpu/cpu_emulation.h @@ -27,27 +27,27 @@ */ // RAM and ROM pointers (allocated and set by main_*.cpp) -extern uint32 RAMBaseMac; // RAM base (Mac address space), does not include Low Mem when != 0 -extern uint8 *RAMBaseHost; // RAM base (host address space) +extern uaecptr RAMBaseMac; // RAM base (Mac address space), does not include Low Mem when != 0 +extern uae_u8* RAMBaseHost; // RAM base (host address space) extern uint32 RAMSize; // Size of RAM -extern uint32 ROMBaseMac; // ROM base (Mac address space) -extern uint8 *ROMBaseHost; // ROM base (host address space) +extern uaecptr ROMBaseMac; // ROM base (Mac address space) +extern uae_u8* ROMBaseHost; // ROM base (host address space) extern uint32 ROMSize; // Size of ROM // Mac memory access functions -static inline uint32 ReadMacInt32(uint32 addr) {return *(uint32 *)addr;} -static inline uint32 ReadMacInt16(uint32 addr) {return *(uint16 *)addr;} -static inline uint32 ReadMacInt8(uint32 addr) {return *(uint8 *)addr;} -static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = l;} -static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = w;} -static inline void WriteMacInt8(uint32 addr, uint32 b) {*(uint8 *)addr = b;} -static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;} -static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;} -static inline void *Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);} -static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);} -static inline void *Host2Mac_memcpy(uint32 dest, const void *src, size_t n) {return memcpy(Mac2HostAddr(dest), src, n);} -static inline void *Mac2Mac_memcpy(uint32 dest, uint32 src, size_t n) {return memcpy(Mac2HostAddr(dest), Mac2HostAddr(src), n);} +static inline uint32 ReadMacInt32(uaecptr addr) {return *(uint32*)addr;} +static inline uint32 ReadMacInt16(uaecptr addr) {return *(uint16*)addr;} +static inline uint32 ReadMacInt8(uaecptr addr) {return *(uint8*)addr;} +static inline void WriteMacInt32(uaecptr addr, uint32 l) {*(uint32*)addr = l;} +static inline void WriteMacInt16(uaecptr addr, uint16 w) {*(uint16*)addr = w;} +static inline void WriteMacInt8(uaecptr addr, uint8 b) {*(uint8*)addr = b;} +static inline void* Mac2HostAddr(uaecptr addr) {return (void*)addr;} +static inline uaecptr Host2MacAddr(const void* addr) {return (uaecptr)addr;} +static inline void* Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);} +static inline void* Mac2Host_memcpy(void* dest, uaecptr src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);} +static inline void* Host2Mac_memcpy(uaecptr dest, const void* src, size_t n) {return memcpy(Mac2HostAddr(dest), src, n);} +static inline void* Mac2Mac_memcpy(uaecptr dest, uaecptr src, size_t n) {return memcpy(Mac2HostAddr(dest), Mac2HostAddr(src), n);} /* @@ -57,7 +57,7 @@ static inline void *Mac2Mac_memcpy(uint32 dest, uint32 src, size_t n) {return me // 680x0 emulation functions struct M68kRegisters; extern void Start680x0(void); // Reset and start 680x0 -extern "C" void Execute68k(uint32 addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine +extern "C" void Execute68k(uaecptr addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine extern "C" void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute MacOS 68k trap from EMUL_OP routine // Interrupt functions diff --git a/BasiliskII/src/powerrom_cpu/cpu_emulation.h b/BasiliskII/src/powerrom_cpu/cpu_emulation.h index dbddfbbc9..f0a7cb5b7 100644 --- a/BasiliskII/src/powerrom_cpu/cpu_emulation.h +++ b/BasiliskII/src/powerrom_cpu/cpu_emulation.h @@ -27,23 +27,23 @@ */ // RAM and ROM pointers (allocated and set by main_*.cpp) -extern uint32 RAMBaseMac; // RAM base (Mac address space), does not include Low Mem when != 0 -extern uint8 *RAMBaseHost; // RAM base (host address space) +extern uaecptr RAMBaseMac; // RAM base (Mac address space), does not include Low Mem when != 0 +extern uint8* RAMBaseHost; // RAM base (host address space) extern uint32 RAMSize; // Size of RAM -extern uint32 ROMBaseMac; // ROM base (Mac address space) -extern uint8 *ROMBaseHost; // ROM base (host address space) +extern uaecptr ROMBaseMac; // ROM base (Mac address space) +extern uint8* ROMBaseHost; // ROM base (host address space) extern uint32 ROMSize; // Size of ROM // Mac memory access functions -static inline uint32 ReadMacInt32(uint32 addr) {return ntohl(*(uint32 *)addr);} -static inline uint32 ReadMacInt16(uint32 addr) {return ntohs(*(uint16 *)addr);} -static inline uint32 ReadMacInt8(uint32 addr) {return *(uint8 *)addr;} -static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = htonl(l);} -static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = htons(w);} -static inline void WriteMacInt8(uint32 addr, uint32 b) {*(uint8 *)addr = b;} -static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;} -static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;} +static inline uint32 ReadMacInt32(uaecptr addr) {return ntohl(*(uint32*)addr);} +static inline uint32 ReadMacInt16(uaecptr addr) {return ntohs(*(uint16*)addr);} +static inline uint32 ReadMacInt8(uaecptr addr) {return *(uint8*)addr;} +static inline void WriteMacInt32(uaecptr addr, uint32 l) {*(uint32*)addr = htonl(l);} +static inline void WriteMacInt16(uaecptr addr, uint32 w) {*(uint16*)addr = htons(w);} +static inline void WriteMacInt8(uaecptr addr, uint32 b) {*(uint8*)addr = b;} +static inline void* Mac2HostAddr(uaecptr addr) {return (void*)addr;} +static inline uaecptr Host2MacAddr(const void* addr) {return (uaecptr)addr;} /* @@ -57,7 +57,7 @@ extern void Exit680x0(void); // 680x0 emulation functions struct M68kRegisters; extern void Start680x0(void); // Reset and start 680x0 -extern "C" void Execute68k(uint32 addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine +extern "C" void Execute68k(uaecptr addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine extern "C" void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute MacOS 68k trap from EMUL_OP routine // Interrupt functions diff --git a/BasiliskII/src/powerrom_cpu/powerrom_cpu.cpp b/BasiliskII/src/powerrom_cpu/powerrom_cpu.cpp index d91b9049f..405c8c623 100644 --- a/BasiliskII/src/powerrom_cpu/powerrom_cpu.cpp +++ b/BasiliskII/src/powerrom_cpu/powerrom_cpu.cpp @@ -1255,7 +1255,7 @@ void TriggerNMI(void) * r->a[7] and r->sr are unused! */ -static asm void execute_68k(register uint32 addr, register M68kRegisters *r) +static asm void execute_68k(register uaecptr addr, register M68kRegisters* r) { // Create stack frame mflr r0 @@ -1330,10 +1330,10 @@ static asm void execute_68k(register uint32 addr, register M68kRegisters *r) blr } -void Execute68k(uint32 addr, M68kRegisters *r) +void Execute68k(uaecptr addr, M68kRegisters* r) { uint16 proc[4] = {M68K_JSR, addr >> 16, addr & 0xffff, M68K_EXEC_RETURN}; - execute_68k((uint32)proc, r); + execute_68k((uaecptr)proc, r); } diff --git a/BasiliskII/src/scsi.cpp b/BasiliskII/src/scsi.cpp index 442dc1f95..b0951e45d 100644 --- a/BasiliskII/src/scsi.cpp +++ b/BasiliskII/src/scsi.cpp @@ -78,7 +78,7 @@ static bool reading; // Flag: reading from device const int SG_TABLE_SIZE = 1024; static int sg_index; // Index of first unused entry in S/G table -static uint8 *sg_ptr[SG_TABLE_SIZE]; // Scatter/gather table data pointer (host address space) +static void* sg_ptr[SG_TABLE_SIZE]; // Scatter/gather table data pointer (host address space) static uint32 sg_len[SG_TABLE_SIZE]; // Scatter/gather table data length static uint32 sg_total_length; // Total data length @@ -117,7 +117,7 @@ static int16 exec_tib(uint32 tib) WriteMacInt32(tib - 8, ptr + len); // fall through to scNoInc case scNoInc: - if ((sg_index > 0) && (Mac2HostAddr(ptr) == sg_ptr[sg_index-1] + sg_len[sg_index-1])) { + if ((sg_index > 0) && (Mac2HostAddr(ptr) == static_cast(sg_ptr[sg_index-1]) + sg_len[sg_index-1])) { sg_len[sg_index-1] += len; // Merge to previous entry } else { if (sg_index == SG_TABLE_SIZE) { diff --git a/BasiliskII/src/slirp/ip_icmp.c b/BasiliskII/src/slirp/ip_icmp.c index 75a4614a5..507bdedbd 100644 --- a/BasiliskII/src/slirp/ip_icmp.c +++ b/BasiliskII/src/slirp/ip_icmp.c @@ -65,10 +65,7 @@ static int icmp_flush[19] = { /* * Process a received ICMP message. */ -void -icmp_input(m, hlen) - struct mbuf *m; - int hlen; +void icmp_input(struct mbuf *m, int hlen) { register struct icmp *icp; register struct ip *ip=mtod(m, struct ip *); @@ -200,13 +197,7 @@ icmp_input(m, hlen) */ #define ICMP_MAXDATALEN (IP_MSS-28) -void -icmp_error(msrc, type, code, minsize, message) - struct mbuf *msrc; - u_char type; - u_char code; - int minsize; - char *message; +void icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize, char *message) { unsigned hlen, shlen, s_ip_len; register struct ip *ip; @@ -320,9 +311,7 @@ icmp_error(msrc, type, code, minsize, message) /* * Reflect the ip packet back to the source */ -void -icmp_reflect(m) - struct mbuf *m; +void icmp_reflect(struct mbuf *m) { register struct ip *ip = mtod(m, struct ip *); int hlen = ip->ip_hl << 2; diff --git a/BasiliskII/src/slirp/libslirp.h b/BasiliskII/src/slirp/libslirp.h index 8a1aa31e6..ee22e23b8 100644 --- a/BasiliskII/src/slirp/libslirp.h +++ b/BasiliskII/src/slirp/libslirp.h @@ -2,8 +2,7 @@ #define _LIBSLIRP_H #ifdef _WIN32 -#include -int inet_aton(const char *cp, struct in_addr *ia); +#include #else #include #include @@ -13,6 +12,17 @@ int inet_aton(const char *cp, struct in_addr *ia); extern "C" { #endif +#ifndef HAVE_INET_ATON +int inet_aton(const char *cp, struct in_addr *ia); +#endif + +#if defined _WIN32_WINNT && _WIN32_WINNT < _WIN32_WINNT_VISTA +#ifdef __cplusplus +#define restrict +#endif +const char* inet_ntop(int af, const void* restrict src, char* restrict dst, socklen_t size); +#endif + int slirp_init(void); int slirp_select_fill(int *pnfds, diff --git a/BasiliskII/src/slirp/misc.c b/BasiliskII/src/slirp/misc.c index b80caf662..5955cf994 100644 --- a/BasiliskII/src/slirp/misc.c +++ b/BasiliskII/src/slirp/misc.c @@ -63,7 +63,42 @@ void redir_x(u_int32_t inaddr, int start_port, int display, int screen) #ifndef HAVE_INET_ATON int inet_aton(const char *cp, struct in_addr *ia) { +#if !defined _WIN32_WINNT || _WIN32_WINNT >= _WIN32_WINNT_VISTA return inet_pton(AF_INET, cp, &ia->s_addr); +#else + u_int32_t addr = inet_addr(cp); + if (addr == 0xffffffff) + return 0; + ia->s_addr = addr; + return 1; +#endif +} +#endif + +#if defined _WIN32_WINNT && _WIN32_WINNT < _WIN32_WINNT_VISTA +const char* inet_ntop(int af, const void* restrict src, char* restrict dst, socklen_t size) +{ + if (af != AF_INET) + { + WSASetLastError(WSAEAFNOSUPPORT); + return NULL; + } + + if (src == NULL || dst == NULL || size == 0) + { + WSASetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + strncpy(dst, inet_ntoa(*(const struct in_addr*)src), size); + if (dst[size - 1] != '\0') + { + dst[0] = '\0'; + WSASetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + return dst; } #endif diff --git a/BasiliskII/src/slirp/slirp.h b/BasiliskII/src/slirp/slirp.h index b845caa77..df9433c73 100644 --- a/BasiliskII/src/slirp/slirp.h +++ b/BasiliskII/src/slirp/slirp.h @@ -27,6 +27,11 @@ typedef unsigned long ioctlsockopt_t; # include # include +// Microsoft's headers don't define ssize_t. +#ifdef _MSC_VER +typedef ptrdiff_t ssize_t; +#endif + # define USE_FIONBIO 1 /* Basilisk II Router defines those */ @@ -148,10 +153,6 @@ void *malloc(size_t arg); void free(void *ptr); #endif -#ifndef HAVE_INET_ATON -int inet_aton(const char *cp, struct in_addr *ia); -#endif - #include #ifdef _WIN32 #include diff --git a/BasiliskII/src/slirp/socket.c b/BasiliskII/src/slirp/socket.c index 2c0e067ea..b1847d699 100644 --- a/BasiliskII/src/slirp/socket.c +++ b/BasiliskII/src/slirp/socket.c @@ -456,7 +456,7 @@ sorecvfrom(so) (struct sockaddr *)&addr, &addrlen); DEBUG_MISC((dfd, " did recvfrom %d, errno = %d-%s\n", m->m_len, errno,strerror(errno))); - if(m->m_len<0) { + if((ssize_t)m->m_len<0) { u_char code=ICMP_UNREACH_PORT; int error = WSAGetLastError(); diff --git a/BasiliskII/src/slirp/tcp_output.c b/BasiliskII/src/slirp/tcp_output.c index 0d5c0ce5a..d2c1fd670 100644 --- a/BasiliskII/src/slirp/tcp_output.c +++ b/BasiliskII/src/slirp/tcp_output.c @@ -135,7 +135,7 @@ int tcp_output(register struct tcpcb *tp) len = min(so->so_snd.sb_cc, win) - off; - if (len < 0) { + if ((int)len < 0) { /* * If FIN has been sent but not acked, * but we haven't been called to retransmit, diff --git a/BasiliskII/src/slot_rom.cpp b/BasiliskII/src/slot_rom.cpp index d46d03298..25059f639 100644 --- a/BasiliskII/src/slot_rom.cpp +++ b/BasiliskII/src/slot_rom.cpp @@ -211,17 +211,17 @@ static uint32 VMonitor(const monitor_desc &m, uint32 videoType, uint32 videoName Offs(0x40, gammaDir); // Gamma directory Rsrc(0x7d, 6); // Video attributes: Default to color, built-in if (m.has_depth(VDEPTH_1BIT)) - Offs(uint8(m.depth_to_apple_mode(VDEPTH_1BIT)), vidMode1); // Video mode parameters for 1 bit + Offs(m.depth_to_apple_mode(VDEPTH_1BIT), vidMode1); // Video mode parameters for 1 bit if (m.has_depth(VDEPTH_2BIT)) - Offs(uint8(m.depth_to_apple_mode(VDEPTH_2BIT)), vidMode2); // Video mode parameters for 2 bit + Offs(m.depth_to_apple_mode(VDEPTH_2BIT), vidMode2); // Video mode parameters for 2 bit if (m.has_depth(VDEPTH_4BIT)) - Offs(uint8(m.depth_to_apple_mode(VDEPTH_4BIT)), vidMode4); // Video mode parameters for 4 bit + Offs(m.depth_to_apple_mode(VDEPTH_4BIT), vidMode4); // Video mode parameters for 4 bit if (m.has_depth(VDEPTH_8BIT)) - Offs(uint8(m.depth_to_apple_mode(VDEPTH_8BIT)), vidMode8); // Video mode parameters for 8 bit + Offs(m.depth_to_apple_mode(VDEPTH_8BIT), vidMode8); // Video mode parameters for 8 bit if (m.has_depth(VDEPTH_16BIT)) - Offs(uint8(m.depth_to_apple_mode(VDEPTH_16BIT)), vidMode16); // Video mode parameters for 16 bit + Offs(m.depth_to_apple_mode(VDEPTH_16BIT), vidMode16); // Video mode parameters for 16 bit if (m.has_depth(VDEPTH_32BIT)) - Offs(uint8(m.depth_to_apple_mode(VDEPTH_32BIT)), vidMode32); // Video mode parameters for 32 bit + Offs(m.depth_to_apple_mode(VDEPTH_32BIT), vidMode32); // Video mode parameters for 32 bit EndOfList(); return ret; } diff --git a/BasiliskII/src/sony.cpp b/BasiliskII/src/sony.cpp index 804239b78..462890079 100644 --- a/BasiliskII/src/sony.cpp +++ b/BasiliskII/src/sony.cpp @@ -263,7 +263,7 @@ int16 SonyOpen(uint32 pb, uint32 dce) // Set up DCE WriteMacInt32(dce + dCtlPosition, 0); - WriteMacInt16(dce + dCtlQHdr + qFlags, ReadMacInt16(dce + dCtlQHdr + qFlags) & 0xff00 | 3); // Version number, must be >=3 or System 8 will replace us + WriteMacInt16(dce + dCtlQHdr + qFlags, (ReadMacInt16(dce + dCtlQHdr + qFlags) & 0xff00) | 3); // Version number, must be >=3 or System 8 will replace us acc_run_called = false; // Install driver again with refnum -2 (HD20) @@ -520,7 +520,7 @@ int16 SonyStatus(uint32 pb, uint32 dce) break; case 10: // Get disk type and MFM info - WriteMacInt32(pb + csParam, ReadMacInt32(info->status + dsMFMDrive) & 0xffffff00 | 0xfe); // 0xfe = SWIM2 controller + WriteMacInt32(pb + csParam, (ReadMacInt32(info->status + dsMFMDrive) & 0xffffff00) | 0xfe); // 0xfe = SWIM2 controller break; // case 0x4350: // Measure disk speed at a given track ('CP') (not supported) diff --git a/BasiliskII/src/timer.cpp b/BasiliskII/src/timer.cpp index 1383d8eeb..316d8d38a 100644 --- a/BasiliskII/src/timer.cpp +++ b/BasiliskII/src/timer.cpp @@ -173,7 +173,7 @@ void TimerReset(void) int16 InsTime(uint32 tm, uint16 trap) { D(bug("InsTime %08lx, trap %04x\n", tm, trap)); - WriteMacInt16(tm + qType, ReadMacInt16(tm + qType) & 0x1fff | (trap << 4) & 0x6000); + WriteMacInt16(tm + qType, (ReadMacInt16(tm + qType) & 0x1fff) | ((trap << 4) & 0x6000)); if (find_desc(tm) >= 0) printf("WARNING: InsTime(): Task re-inserted\n"); else { diff --git a/BasiliskII/src/uae_cpu/basilisk_glue.cpp b/BasiliskII/src/uae_cpu/basilisk_glue.cpp index b29c77026..9e6e7afc2 100644 --- a/BasiliskII/src/uae_cpu/basilisk_glue.cpp +++ b/BasiliskII/src/uae_cpu/basilisk_glue.cpp @@ -49,7 +49,7 @@ int MacFrameLayout; // Frame buffer layout #endif #if DIRECT_ADDRESSING -uintptr MEMBaseDiff; // Global offset between a Mac address and its Host equivalent +uae_u8* MEMBase; // Global offset between a Mac address and its Host equivalent #endif #if USE_JIT @@ -71,8 +71,8 @@ bool Init680x0(void) RAMBaseMac = (uintptr)RAMBaseHost; ROMBaseMac = (uintptr)ROMBaseHost; #elif DIRECT_ADDRESSING - // Mac address space = host address space minus constant offset (MEMBaseDiff) - // NOTE: MEMBaseDiff is set up in main_unix.cpp/main() + // Mac address space = host address space minus constant offset (MEMBase) + // NOTE: MEMBase is set up in main_unix.cpp/main() RAMBaseMac = 0; ROMBaseMac = Host2MacAddr(ROMBaseHost); #else @@ -225,7 +225,7 @@ void Execute68kTrap(uint16 trap, struct M68kRegisters *r) * r->a[7] and r->sr are unused! */ -void Execute68k(uint32 addr, struct M68kRegisters *r) +void Execute68k(uaecptr addr, struct M68kRegisters* r) { int i; diff --git a/BasiliskII/src/uae_cpu/compiler/codegen_x86.cpp b/BasiliskII/src/uae_cpu/compiler/codegen_x86.cpp index f03c4f3cf..d0de8f916 100644 --- a/BasiliskII/src/uae_cpu/compiler/codegen_x86.cpp +++ b/BasiliskII/src/uae_cpu/compiler/codegen_x86.cpp @@ -3130,45 +3130,45 @@ static __inline__ void raw_jmp_m(uae_u32 base) } -static __inline__ void raw_call(uae_u32 t) +static __inline__ void raw_call(uintptr t) { #if USE_NEW_RTASM CALLm(t); #else emit_byte(0xe8); - emit_long(t-(uae_u32)target-4); + emit_long(t-uintptr(target)-4); #endif } -static __inline__ void raw_jmp(uae_u32 t) +static __inline__ void raw_jmp(uintptr t) { #if USE_NEW_RTASM JMPm(t); #else emit_byte(0xe9); - emit_long(t-(uae_u32)target-4); + emit_long(t-uintptr(target)-4); #endif } -static __inline__ void raw_jl(uae_u32 t) +static __inline__ void raw_jl(uintptr t) { emit_byte(0x0f); emit_byte(0x8c); - emit_long(t-(uintptr)target-4); + emit_long(t-uintptr(target)-4); } -static __inline__ void raw_jz(uae_u32 t) +static __inline__ void raw_jz(uintptr t) { emit_byte(0x0f); emit_byte(0x84); - emit_long(t-(uintptr)target-4); + emit_long(t-uintptr(target)-4); } -static __inline__ void raw_jnz(uae_u32 t) +static __inline__ void raw_jnz(uintptr t) { emit_byte(0x0f); emit_byte(0x85); - emit_long(t-(uintptr)target-4); + emit_long(t-uintptr(target)-4); } static __inline__ void raw_jnz_l_oponly(void) diff --git a/BasiliskII/src/uae_cpu/compiler/codegen_x86.h b/BasiliskII/src/uae_cpu/compiler/codegen_x86.h index 08538b7af..734c2278b 100644 --- a/BasiliskII/src/uae_cpu/compiler/codegen_x86.h +++ b/BasiliskII/src/uae_cpu/compiler/codegen_x86.h @@ -376,7 +376,7 @@ typedef unsigned int _ul; #define _b110 6 #define _b111 7 -#define _OFF4(D) (_UL(D) - _UL(x86_get_target())) +#define _OFF4(D) (_UL(D - uintptr(x86_get_target()))) #define _CKD8(D) _ck_d(8, ((_uc) _OFF4(D)) ) #define _D8(D) (_B(0), ((*(_PUC(x86_get_target())-1))= _CKD8(D))) @@ -1259,23 +1259,23 @@ enum { /* _format Opcd ,Mod ,r ,m ,mem=dsp+sib ,imm... */ // FIXME: no prefix is availble to encode a 32-bit operand size in 64-bit mode -#define CALLm(M) _O_D32 (0xe8 ,(int)(M) ) +#define CALLm(M) _O_D32 (0xe8 ,uintptr(M) ) #define _CALLLsr(R) (_REXLrr(0, R), _O_Mrm (0xff ,_b11,_b010,_r4(R) )) #define _CALLQsr(R) (_REXLrr(0, R), _O_Mrm (0xff ,_b11,_b010,_r8(R) )) #define CALLsr(R) ( X86_TARGET_64BIT ? _CALLQsr(R) : _CALLLsr(R)) -#define CALLsm(D,B,I,S) (_REXLrm(0, B, I), _O_r_X (0xff ,_b010 ,(int)(D),B,I,S )) +#define CALLsm(D,B,I,S) (_REXLrm(0, B, I), _O_r_X (0xff ,_b010 ,int32(D),B,I,S )) // FIXME: no prefix is availble to encode a 32-bit operand size in 64-bit mode -#define JMPSm(M) _O_D8 (0xeb ,(int)(M) ) -#define JMPm(M) _O_D32 (0xe9 ,(int)(M) ) +#define JMPSm(M) _O_D8 (0xeb ,uintptr(M) ) +#define JMPm(M) _O_D32 (0xe9 ,uintptr(M) ) #define _JMPLsr(R) (_REXLrr(0, R), _O_Mrm (0xff ,_b11,_b100,_r4(R) )) #define _JMPQsr(R) (_REXLrr(0, R), _O_Mrm (0xff ,_b11,_b100,_r8(R) )) #define JMPsr(R) ( X86_TARGET_64BIT ? _JMPQsr(R) : _JMPLsr(R)) -#define JMPsm(D,B,I,S) (_REXLrm(0, B, I), _O_r_X (0xff ,_b100 ,(int)(D),B,I,S )) +#define JMPsm(D,B,I,S) (_REXLrm(0, B, I), _O_r_X (0xff ,_b100 ,int32(D),B,I,S )) /* _format Opcd ,Mod ,r ,m ,mem=dsp+sib ,imm... */ -#define JCCSii(CC, D) _O_B (0x70|(CC) ,(_sc)(int)(D) ) -#define JCCSim(CC, D) _O_D8 (0x70|(CC) ,(int)(D) ) +#define JCCSii(CC, D) _O_B (0x70|(CC) ,_sc(D) ) +#define JCCSim(CC, D) _O_D8 (0x70|(CC) ,int32(D) ) #define JOSm(D) JCCSim(X86_CC_O, D) #define JNOSm(D) JCCSim(X86_CC_NO, D) #define JBSm(D) JCCSim(X86_CC_B, D) diff --git a/BasiliskII/src/uae_cpu/compiler/compemu.h b/BasiliskII/src/uae_cpu/compiler/compemu.h index 9a612fb21..452022c7e 100644 --- a/BasiliskII/src/uae_cpu/compiler/compemu.h +++ b/BasiliskII/src/uae_cpu/compiler/compemu.h @@ -49,13 +49,13 @@ extern void compiler_dumpstate(void); #define MAXRUN 1024 #define cacheline(x) (((uintptr)x)&TAGMASK) -extern uae_u8* start_pc_p; +extern const uae_u8* start_pc_p; extern uae_u32 start_pc; struct blockinfo_t; struct cpu_history { - uae_u16 * location; + const uae_u16* location; }; union cacheline { @@ -272,7 +272,7 @@ extern bigstate live; extern int touchcnt; -#define IMM uae_s32 +#define IMM intptr #define R1 uae_u32 #define R2 uae_u32 #define R4 uae_u32 @@ -524,9 +524,9 @@ extern uae_u32 get_const(int r); extern int is_const(int r); extern void register_branch(uae_u32 not_taken, uae_u32 taken, uae_u8 cond); -#define comp_get_ibyte(o) do_get_mem_byte((uae_u8 *)(comp_pc_p + (o) + 1)) -#define comp_get_iword(o) do_get_mem_word((uae_u16 *)(comp_pc_p + (o))) -#define comp_get_ilong(o) do_get_mem_long((uae_u32 *)(comp_pc_p + (o))) +#define comp_get_ibyte(o) do_get_mem_byte(comp_pc_p + (o) + 1) +#define comp_get_iword(o) do_get_mem_word(comp_pc_p + (o)) +#define comp_get_ilong(o) do_get_mem_long(comp_pc_p + (o)) struct blockinfo_t; @@ -556,7 +556,7 @@ typedef struct blockinfo_t { cpuop_func* direct_pen; cpuop_func* direct_pcc; - uae_u8* pc_p; + const uae_u8* pc_p; uae_u32 c1; uae_u32 c2; diff --git a/BasiliskII/src/uae_cpu/compiler/compemu_fpp.cpp b/BasiliskII/src/uae_cpu/compiler/compemu_fpp.cpp index bb536634f..390c65644 100644 --- a/BasiliskII/src/uae_cpu/compiler/compemu_fpp.cpp +++ b/BasiliskII/src/uae_cpu/compiler/compemu_fpp.cpp @@ -215,10 +215,8 @@ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra) } case 2: { - uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+ - m68k_pc_offset; - uae_s32 PC16off =(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2) --2); + uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+m68k_pc_offset; + uae_s32 PC16off =(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); ad=S1; mov_l_ri(ad,address+PC16off); break; @@ -231,7 +229,7 @@ STATIC_INLINE int get_fp_value (uae_u32 opcode, uae_u16 extra) break; case 4: { - uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+ m68k_pc_offset; + uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+m68k_pc_offset; ad=S1; // Immediate addressing mode && Operation Length == Byte -> // Use the low-order byte of the extension word. @@ -419,8 +417,7 @@ STATIC_INLINE int put_fp_value (int val, uae_u32 opcode, uae_u16 extra) } case 2: { - uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+ - m68k_pc_offset; + uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+m68k_pc_offset; uae_s32 PC16off =(uae_s32)(uae_s16)comp_get_iword((m68k_pc_offset+=2)-2); ad=S1; mov_l_ri(ad,address+PC16off); @@ -434,8 +431,7 @@ STATIC_INLINE int put_fp_value (int val, uae_u32 opcode, uae_u16 extra) break; case 4: { - uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+ - m68k_pc_offset; + uae_u32 address=start_pc+((char *)comp_pc_p-(char *)start_pc_p)+m68k_pc_offset; ad=S1; mov_l_ri(ad,address); m68k_pc_offset+=sz2[size]; @@ -926,7 +922,7 @@ static const fpu_register const_loge_10 = 2.30258509299404568402; static const fpu_register power10[] = { 1e0, 1e1, 1e2, 1e4, 1e8, 1e16, 1e32, 1e64, 1e128, 1e256 #if USE_LONG_DOUBLE -, 1e512, 1e1024, 1e2048, 1e4096 +, 1e512L, 1e1024L, 1e2048L, 1e4096L #endif }; @@ -955,7 +951,7 @@ static uae_u16 x86_fpucw[]={ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) { - int reg; + int reg, reg2; int src; switch ((extra >> 13) & 0x7) { @@ -969,7 +965,7 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) case 6: case 7: { - uae_u32 ad, list = 0; + uae_u32 list = 0; int incr = 0; if (extra & 0x2000) { uae_u32 ad; @@ -984,8 +980,8 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) default: FAIL(1); return; } - ad=get_fp_ad (opcode, &ad); - if (ad<0) { + int reg2 = get_fp_ad (opcode, &ad); + if (reg2<0) { abort(); m68k_setpc (m68k_getpc () - 4); fpuop_illg (opcode,extra); @@ -1009,15 +1005,15 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) if (list & 0x80) { fmov_ext_mr((uintptr)temp_fp,reg); delay; - sub_l_ri(ad,4); + sub_l_ri(reg2,4); mov_l_rm(S2,(uintptr)temp_fp); - writelong_clobber(ad,S2,S3); - sub_l_ri(ad,4); + writelong_clobber(reg2,S2,S3); + sub_l_ri(reg2,4); mov_l_rm(S2,(uintptr)temp_fp+4); - writelong_clobber(ad,S2,S3); - sub_l_ri(ad,4); + writelong_clobber(reg2,S2,S3); + sub_l_ri(reg2,4); mov_w_rm(S2,(uintptr)temp_fp+8); - writeword_clobber(ad,S2,S3); + writeword_clobber(reg2,S2,S3); } list <<= 1; } @@ -1028,22 +1024,22 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) fmov_ext_mr((uintptr)temp_fp,reg); delay; mov_w_rm(S2,(uintptr)temp_fp+8); - writeword_clobber(ad,S2,S3); - add_l_ri(ad,4); + writeword_clobber(reg2,S2,S3); + add_l_ri(reg2,4); mov_l_rm(S2,(uintptr)temp_fp+4); - writelong_clobber(ad,S2,S3); - add_l_ri(ad,4); + writelong_clobber(reg2,S2,S3); + add_l_ri(reg2,4); mov_l_rm(S2,(uintptr)temp_fp); - writelong_clobber(ad,S2,S3); - add_l_ri(ad,4); + writelong_clobber(reg2,S2,S3); + add_l_ri(reg2,4); } list <<= 1; } } if ((opcode & 0x38) == 0x18) - mov_l_rr((opcode & 7)+8,ad); + mov_l_rr((opcode & 7)+8,reg2); if ((opcode & 0x38) == 0x20) - mov_l_rr((opcode & 7)+8,ad); + mov_l_rr((opcode & 7)+8,reg2); } else { /* FMOVEM memory->FPP */ @@ -1057,8 +1053,8 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) default: FAIL(1); return; } - ad=get_fp_ad (opcode, &ad); - if (ad<0) { + int reg2=get_fp_ad (opcode, &ad); + if (reg2<0) { abort(); m68k_setpc (m68k_getpc () - 4); write_log("no ad\n"); @@ -1084,14 +1080,14 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) for (reg = 7; reg >= 0; reg--) { uae_u32 wrd1, wrd2, wrd3; if (list & 0x80) { - sub_l_ri(ad,4); - readlong(ad,S2,S3); + sub_l_ri(reg2,4); + readlong(reg2,S2,S3); mov_l_mr((uintptr)(temp_fp),S2); - sub_l_ri(ad,4); - readlong(ad,S2,S3); + sub_l_ri(reg2,4); + readlong(reg2,S2,S3); mov_l_mr((uintptr)(temp_fp)+4,S2); - sub_l_ri(ad,4); - readword(ad,S2,S3); + sub_l_ri(reg2,4); + readword(reg2,S2,S3); mov_w_mr(((uintptr)temp_fp)+8,S2); delay2; fmov_ext_rm(reg,(uintptr)(temp_fp)); @@ -1103,15 +1099,15 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) for (reg = 0; reg < 8; reg++) { uae_u32 wrd1, wrd2, wrd3; if (list & 0x80) { - readword(ad,S2,S3); + readword(reg2,S2,S3); mov_w_mr(((uintptr)temp_fp)+8,S2); - add_l_ri(ad,4); - readlong(ad,S2,S3); + add_l_ri(reg2,4); + readlong(reg2,S2,S3); mov_l_mr((uintptr)(temp_fp)+4,S2); - add_l_ri(ad,4); - readlong(ad,S2,S3); + add_l_ri(reg2,4); + readlong(reg2,S2,S3); mov_l_mr((uintptr)(temp_fp),S2); - add_l_ri(ad,4); + add_l_ri(reg2,4); delay2; fmov_ext_rm(reg,(uintptr)(temp_fp)); } @@ -1119,9 +1115,9 @@ void comp_fpp_opp (uae_u32 opcode, uae_u16 extra) } } if ((opcode & 0x38) == 0x18) - mov_l_rr((opcode & 7)+8,ad); + mov_l_rr((opcode & 7)+8,reg2); if ((opcode & 0x38) == 0x20) - mov_l_rr((opcode & 7)+8,ad); + mov_l_rr((opcode & 7)+8,reg2); } } return; diff --git a/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp b/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp index f31febced..60ae188e5 100644 --- a/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp +++ b/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp @@ -45,7 +45,9 @@ #define USE_MATCH 0 /* kludge for Brian, so he can compile under MSVC++ */ -#define USE_NORMAL_CALLING_CONVENTION 1 && defined(_MSC_VER) +#ifdef _WIN32 +#define USE_NORMAL_CALLING_CONVENTION 1 +#endif #ifndef WIN32 #include @@ -205,7 +207,7 @@ static inline unsigned int cft_map (unsigned int f) #endif } -uae_u8* start_pc_p; +const uae_u8* start_pc_p; uae_u32 start_pc; uae_u32 current_block_pc_p; static uintptr current_block_start_target; @@ -327,7 +329,7 @@ static __inline__ blockinfo* get_blockinfo(uae_u32 cl) return cache_tags[cl+1].bi; } -static __inline__ blockinfo* get_blockinfo_addr(void* addr) +static __inline__ blockinfo* get_blockinfo_addr(const void* addr) { blockinfo* bi=get_blockinfo(cacheline(addr)); @@ -543,7 +545,7 @@ static __inline__ void mark_callers_recompile(blockinfo * bi) } } -static __inline__ blockinfo* get_blockinfo_addr_new(void* addr, int setstate) +static __inline__ blockinfo* get_blockinfo_addr_new(const void* addr, int setstate) { blockinfo* bi=get_blockinfo_addr(addr); int i; @@ -555,7 +557,7 @@ static __inline__ blockinfo* get_blockinfo_addr_new(void* addr, int setstate) bi=hold_bi[i]; hold_bi[i]=NULL; - bi->pc_p=(uae_u8 *)addr; + bi->pc_p=(const uae_u8 *)addr; invalidate_block(bi); add_to_active(bi); add_to_cl_list(bi); @@ -723,7 +725,7 @@ static __inline__ void alloc_blockinfos(void) static uae_u8* target; -static void emit_init(void) +static void emit_init(void) { } @@ -5469,9 +5471,9 @@ static void writemem_real(int address, int source, int size, int tmp, int clobbe f=source; switch(size) { - case 1: mov_b_bRr(address,source,MEMBaseDiff); break; - case 2: mov_w_rr(f,source); bswap_16(f); mov_w_bRr(address,f,MEMBaseDiff); break; - case 4: mov_l_rr(f,source); bswap_32(f); mov_l_bRr(address,f,MEMBaseDiff); break; + case 1: mov_b_bRr(address,source,intptr(MEMBase)); break; + case 2: mov_w_rr(f,source); bswap_16(f); mov_w_bRr(address,f,intptr(MEMBase)); break; + case 4: mov_l_rr(f,source); bswap_32(f); mov_l_bRr(address,f,intptr(MEMBase)); break; } forget_about(tmp); forget_about(f); @@ -5528,9 +5530,9 @@ static void readmem_real(int address, int dest, int size, int tmp) f=dest; switch(size) { - case 1: mov_b_brR(dest,address,MEMBaseDiff); break; - case 2: mov_w_brR(dest,address,MEMBaseDiff); bswap_16(dest); break; - case 4: mov_l_brR(dest,address,MEMBaseDiff); bswap_32(dest); break; + case 1: mov_b_brR(dest,address,intptr(MEMBase)); break; + case 2: mov_w_brR(dest,address,intptr(MEMBase)); bswap_16(dest); break; + case 4: mov_l_brR(dest,address,intptr(MEMBase)); bswap_32(dest); break; } forget_about(tmp); } @@ -5568,7 +5570,7 @@ void get_n_addr(int address, int dest, int tmp) #if REAL_ADDRESSING mov_l_rr(dest, address); #elif DIRECT_ADDRESSING - lea_l_brr(dest,address,MEMBaseDiff); + lea_l_brr(dest,address,intptr(MEMBase)); #endif forget_about(tmp); } @@ -6567,7 +6569,7 @@ void compiler_dumpstate(void) return; write_log("### Host addresses\n"); - write_log("MEM_BASE : %x\n", MEMBaseDiff); + write_log("MEM_BASE : %x\n", MEMBase); write_log("PC_P : %p\n", ®s.pc_p); write_log("SPCFLAGS : %p\n", ®s.spcflags); write_log("D0-D7 : %p-%p\n", ®s.regs[0], ®s.regs[7]); @@ -6663,7 +6665,7 @@ static void compile_block(cpu_history* pc_hist, int blocklen) liveflags[blocklen]=0x1f; /* All flags needed afterwards */ i=blocklen; while (i--) { - uae_u16* currpcp=pc_hist[i].location; + const uae_u16* currpcp=pc_hist[i].location; uae_u32 op=DO_GET_OPCODE(currpcp); #if USE_CHECKSUM_INFO diff --git a/BasiliskII/src/uae_cpu/compiler/gencomp.c b/BasiliskII/src/uae_cpu/compiler/gencomp.c index 2e16972d5..fad867218 100644 --- a/BasiliskII/src/uae_cpu/compiler/gencomp.c +++ b/BasiliskII/src/uae_cpu/compiler/gencomp.c @@ -1359,7 +1359,7 @@ gen_opcode (unsigned long int opcode) case i_BCLR: case i_BSET: case i_BTST: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ genamode (curi->smode, "srcreg", curi->size, "src", 1, 0); genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0); start_brace(); @@ -1541,7 +1541,7 @@ gen_opcode (unsigned long int opcode) failure; break; case i_RTD: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ genamode (curi->smode, "srcreg", curi->size, "offs", 1, 0); /* offs is constant */ comprintf("\tadd_l_ri(offs,4);\n"); @@ -1557,7 +1557,7 @@ gen_opcode (unsigned long int opcode) isjump; break; case i_LINK: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ genamode (curi->smode, "srcreg", sz_long, "src", 1, 0); genamode (curi->dmode, "dstreg", curi->size, "offs", 1, 0); comprintf("\tsub_l_ri(15,4);\n" @@ -1569,7 +1569,7 @@ gen_opcode (unsigned long int opcode) genastore ("src", curi->smode, "srcreg", sz_long, "src"); break; case i_UNLK: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ genamode (curi->smode, "srcreg", curi->size, "src", 1, 0); comprintf("\tmov_l_rr(15,src);\n" "\treadlong(15,src,scratchie);\n" @@ -1790,7 +1790,7 @@ gen_opcode (unsigned long int opcode) break; case i_Scc: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ genamode (curi->smode, "srcreg", curi->size, "src", 2, 0); start_brace (); comprintf ("\tint val = scratchie++;\n"); @@ -1837,7 +1837,7 @@ gen_opcode (unsigned long int opcode) failure; break; case i_MULU: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ comprintf("\tdont_care_flags();\n"); genamode (curi->smode, "srcreg", sz_word, "src", 1, 0); genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0); @@ -1852,7 +1852,7 @@ gen_opcode (unsigned long int opcode) genastore ("dst", curi->dmode, "dstreg", sz_long, "dst"); break; case i_MULS: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ comprintf("\tdont_care_flags();\n"); genamode (curi->smode, "srcreg", sz_word, "src", 1, 0); genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0); @@ -1886,7 +1886,7 @@ gen_opcode (unsigned long int opcode) genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0); genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0); if (curi->smode!=immi) { -/* failure; /* UNTESTED: NEW: from "Ipswitch Town" release */ + /* UNTESTED: NEW: from "Ipswitch Town" release */ if (!noflags) { uses_cmov; start_brace(); @@ -2039,7 +2039,7 @@ gen_opcode (unsigned long int opcode) break; case i_ASL: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ mayfail; if (curi->smode==Dreg) { comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n" @@ -2186,7 +2186,7 @@ gen_opcode (unsigned long int opcode) break; case i_LSR: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ mayfail; if (curi->smode==Dreg) { comprintf("if ((uae_u32)srcreg==(uae_u32)dstreg) {\n" @@ -2337,7 +2337,7 @@ gen_opcode (unsigned long int opcode) genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0); genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0); if (curi->smode!=immi) { -/* failure; /* UNTESTED: NEW: from "Ipswitch Town" release */ + /* UNTESTED: NEW: from "Ipswitch Town" release */ if (!noflags) { uses_cmov; start_brace(); @@ -2609,7 +2609,7 @@ gen_opcode (unsigned long int opcode) failure; break; case i_MULL: -/* failure; /* NEW: from "Ipswitch Town" release */ + /* NEW: from "Ipswitch Town" release */ if (!noflags) { failure; break; diff --git a/BasiliskII/src/uae_cpu/cpu_emulation.h b/BasiliskII/src/uae_cpu/cpu_emulation.h index cd588ec10..d3c3a969e 100644 --- a/BasiliskII/src/uae_cpu/cpu_emulation.h +++ b/BasiliskII/src/uae_cpu/cpu_emulation.h @@ -58,19 +58,19 @@ enum { // Mac memory access functions #include "memory.h" -static inline uint32 ReadMacInt32(uint32 addr) {return get_long(addr);} -static inline uint32 ReadMacInt16(uint32 addr) {return get_word(addr);} -static inline uint32 ReadMacInt8(uint32 addr) {return get_byte(addr);} -static inline void WriteMacInt32(uint32 addr, uint32 l) {put_long(addr, l);} -static inline void WriteMacInt16(uint32 addr, uint32 w) {put_word(addr, w);} -static inline void WriteMacInt8(uint32 addr, uint32 b) {put_byte(addr, b);} -static inline uint8 *Mac2HostAddr(uint32 addr) {return get_real_address(addr);} -static inline uint32 Host2MacAddr(uint8 *addr) {return get_virtual_address(addr);} +static inline uint32 ReadMacInt32(uaecptr addr) {return get_long(addr);} +static inline uint32 ReadMacInt16(uaecptr addr) {return get_word(addr);} +static inline uint32 ReadMacInt8(uaecptr addr) {return get_byte(addr);} +static inline void WriteMacInt32(uaecptr addr, uint32 l) {put_long(addr, l);} +static inline void WriteMacInt16(uaecptr addr, uint16 w) {put_word(addr, w);} +static inline void WriteMacInt8(uaecptr addr, uint8 b) {put_byte(addr, b);} +static inline void* Mac2HostAddr(uaecptr addr) {return get_real_address(addr);} +static inline uaecptr Host2MacAddr(const void* addr) {return get_virtual_address(addr);} -static inline void *Mac_memset(uint32 addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);} -static inline void *Mac2Host_memcpy(void *dest, uint32 src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);} -static inline void *Host2Mac_memcpy(uint32 dest, const void *src, size_t n) {return memcpy(Mac2HostAddr(dest), src, n);} -static inline void *Mac2Mac_memcpy(uint32 dest, uint32 src, size_t n) {return memcpy(Mac2HostAddr(dest), Mac2HostAddr(src), n);} +static inline void* Mac_memset(uaecptr addr, int c, size_t n) {return memset(Mac2HostAddr(addr), c, n);} +static inline void* Mac2Host_memcpy(void* dest, uaecptr src, size_t n) {return memcpy(dest, Mac2HostAddr(src), n);} +static inline void* Host2Mac_memcpy(uaecptr dest, const void* src, size_t n) {return memcpy(Mac2HostAddr(dest), src, n);} +static inline void* Mac2Mac_memcpy(uaecptr dest, uaecptr src, size_t n) {return memcpy(Mac2HostAddr(dest), Mac2HostAddr(src), n);} /* @@ -92,7 +92,7 @@ const bool UseJIT = false; // 680x0 emulation functions struct M68kRegisters; extern void Start680x0(void); // Reset and start 680x0 -extern "C" void Execute68k(uint32 addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine +extern "C" void Execute68k(uaecptr addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine extern "C" void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute MacOS 68k trap from EMUL_OP routine // Interrupt functions diff --git a/BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp b/BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp index f5a1aeb49..8de668c47 100644 --- a/BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp +++ b/BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp @@ -167,7 +167,7 @@ PRIVATE void FFPU dump_registers(const char * str) #endif } -PRIVATE void FFPU dump_first_bytes(uae_u8 * buffer, uae_s32 actual) +PRIVATE void FFPU dump_first_bytes(const uae_u8* buffer, uae_s32 actual) { #if FPU_DEBUG && FPU_DUMP_FIRST_BYTES char temp_buf1[256], temp_buf2[10]; @@ -347,7 +347,7 @@ PRIVATE inline void FFPU make_extended_no_normalize( ) { // is it zero? - if ((wrd1 && 0x7fff0000) == 0 && wrd2 == 0 && wrd3 == 0) { + if ((wrd1 & 0x7fff0000) == 0 && wrd2 == 0 && wrd3 == 0) { make_zero_positive(result); return; } @@ -673,8 +673,8 @@ PRIVATE inline int FFPU get_fp_value (uae_u32 opcode, uae_u16 extra, fpu_registe fpu_debug(("get_fp_value m68k_getpc()=%X\n",m68k_getpc())); fpu_debug(("get_fp_value ad=%X\n",ad)); fpu_debug(("get_fp_value get_long (ad)=%X\n",get_long (ad))); - dump_first_bytes( get_real_address(ad)-64, 64 ); - dump_first_bytes( get_real_address(ad), 64 ); + dump_first_bytes( static_cast(get_real_address(ad))-64, 64 ); + dump_first_bytes( static_cast(get_real_address(ad)), 64 ); switch (size) { case 0: @@ -1768,13 +1768,13 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra) FPU registers[reg] = (double)(FPU registers[reg] * src); } else if (fl_dest.nan || fl_source.nan || - fl_dest.zero && fl_source.infinity || - fl_dest.infinity && fl_source.zero ) { + (fl_dest.zero && fl_source.infinity) || + (fl_dest.infinity && fl_source.zero)) { make_nan( FPU registers[reg] ); } else if (fl_dest.zero || fl_source.zero ) { - if (fl_dest.negative && !fl_source.negative || - !fl_dest.negative && fl_source.negative) { + if ((fl_dest.negative && !fl_source.negative) || + (!fl_dest.negative && fl_source.negative)) { make_zero_negative(FPU registers[reg]); } else { @@ -1782,8 +1782,8 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra) } } else { - if( fl_dest.negative && !fl_source.negative || - !fl_dest.negative && fl_source.negative) { + if ((fl_dest.negative && !fl_source.negative) || + (!fl_dest.negative && fl_source.negative)) { make_inf_negative(FPU registers[reg]); } else { @@ -1971,13 +1971,13 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra) FPU registers[reg] *= src; } else if (fl_dest.nan || fl_source.nan || - fl_dest.zero && fl_source.infinity || - fl_dest.infinity && fl_source.zero ) { + (fl_dest.zero && fl_source.infinity) || + (fl_dest.infinity && fl_source.zero)) { make_nan( FPU registers[reg] ); } else if (fl_dest.zero || fl_source.zero ) { - if (fl_dest.negative && !fl_source.negative || - !fl_dest.negative && fl_source.negative) { + if ((fl_dest.negative && !fl_source.negative) || + (!fl_dest.negative && fl_source.negative)) { make_zero_negative(FPU registers[reg]); } else { @@ -1985,8 +1985,8 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra) } } else { - if( fl_dest.negative && !fl_source.negative || - !fl_dest.negative && fl_source.negative) { + if ((fl_dest.negative && !fl_source.negative) || + (!fl_dest.negative && fl_source.negative)) { make_inf_negative(FPU registers[reg]); } else { diff --git a/BasiliskII/src/uae_cpu/gencpu.c b/BasiliskII/src/uae_cpu/gencpu.c index 1653adab9..1827e8b10 100644 --- a/BasiliskII/src/uae_cpu/gencpu.c +++ b/BasiliskII/src/uae_cpu/gencpu.c @@ -2189,14 +2189,14 @@ static void gen_opcode (unsigned long int opcode) case i_CINVA: /* gb-- srcreg now contains the cache field */ printf ("\tif (srcreg&0x2)\n"); - printf ("\t\tflush_icache(%d);\n", 30 + ((opcode >> 3) & 3)); + printf ("\t\tflush_icache(%lu);\n", 30 + ((opcode >> 3) & 3)); break; case i_CPUSHL: case i_CPUSHP: case i_CPUSHA: /* gb-- srcreg now contains the cache field */ printf ("\tif (srcreg&0x2)\n"); - printf ("\t\tflush_icache(%d);\n", 40 + ((opcode >> 3) & 3)); + printf ("\t\tflush_icache(%lu);\n", 40 + ((opcode >> 3) & 3)); break; case i_MOVE16: if ((opcode & 0xfff8) == 0xf620) { diff --git a/BasiliskII/src/uae_cpu/m68k.h b/BasiliskII/src/uae_cpu/m68k.h index f329cb3ed..cb24a9725 100644 --- a/BasiliskII/src/uae_cpu/m68k.h +++ b/BasiliskII/src/uae_cpu/m68k.h @@ -30,11 +30,11 @@ #ifndef SAHF_SETO_PROFITABLE /* PUSH/POP instructions are naturally 64-bit sized on x86-64, thus - unsigned long hereunder is either 64-bit or 32-bit wide depending + uintptr hereunder is either 64-bit or 32-bit wide depending on the target. */ struct flag_struct { - unsigned long cznv; - unsigned long x; + uintptr cznv; + uintptr x; }; #define FLAGVAL_Z 0x40 diff --git a/BasiliskII/src/uae_cpu/memory.cpp b/BasiliskII/src/uae_cpu/memory.cpp index 676a24369..407d96056 100644 --- a/BasiliskII/src/uae_cpu/memory.cpp +++ b/BasiliskII/src/uae_cpu/memory.cpp @@ -134,51 +134,43 @@ static uae_u32 REGPARAM2 ram_bget(uaecptr) REGPARAM; static void REGPARAM2 ram_lput(uaecptr, uae_u32) REGPARAM; static void REGPARAM2 ram_wput(uaecptr, uae_u32) REGPARAM; static void REGPARAM2 ram_bput(uaecptr, uae_u32) REGPARAM; -static uae_u8 *REGPARAM2 ram_xlate(uaecptr addr) REGPARAM; +static uae_u8* REGPARAM2 ram_xlate(uaecptr addr) REGPARAM; -static uintptr RAMBaseDiff; // RAMBaseHost - RAMBaseMac +static uae_u8* RAMBase; // RAMBaseHost - RAMBaseMac uae_u32 REGPARAM2 ram_lget(uaecptr addr) { - uae_u32 *m; - m = (uae_u32 *)(RAMBaseDiff + addr); - return do_get_mem_long(m); + return do_get_mem_long(RAMBase + addr); } uae_u32 REGPARAM2 ram_wget(uaecptr addr) { - uae_u16 *m; - m = (uae_u16 *)(RAMBaseDiff + addr); - return do_get_mem_word(m); + return do_get_mem_word(RAMBase + addr); } uae_u32 REGPARAM2 ram_bget(uaecptr addr) { - return (uae_u32)*(uae_u8 *)(RAMBaseDiff + addr); + return *(RAMBase + addr); } void REGPARAM2 ram_lput(uaecptr addr, uae_u32 l) { - uae_u32 *m; - m = (uae_u32 *)(RAMBaseDiff + addr); - do_put_mem_long(m, l); + do_put_mem_long(RAMBase + addr, l); } void REGPARAM2 ram_wput(uaecptr addr, uae_u32 w) { - uae_u16 *m; - m = (uae_u16 *)(RAMBaseDiff + addr); - do_put_mem_word(m, w); + do_put_mem_word(RAMBase + addr, w); } void REGPARAM2 ram_bput(uaecptr addr, uae_u32 b) { - *(uae_u8 *)(RAMBaseDiff + addr) = b; + *(RAMBase + addr) = b; } -uae_u8 *REGPARAM2 ram_xlate(uaecptr addr) +uae_u8* REGPARAM2 ram_xlate(uaecptr addr) { - return (uae_u8 *)(RAMBaseDiff + addr); + return RAMBase + addr; } /* Mac RAM (24 bit addressing) */ @@ -189,49 +181,45 @@ static uae_u32 REGPARAM2 ram24_bget(uaecptr) REGPARAM; static void REGPARAM2 ram24_lput(uaecptr, uae_u32) REGPARAM; static void REGPARAM2 ram24_wput(uaecptr, uae_u32) REGPARAM; static void REGPARAM2 ram24_bput(uaecptr, uae_u32) REGPARAM; -static uae_u8 *REGPARAM2 ram24_xlate(uaecptr addr) REGPARAM; +static uae_u8* REGPARAM2 ram24_xlate(uaecptr addr) REGPARAM; uae_u32 REGPARAM2 ram24_lget(uaecptr addr) { - uae_u32 *m; - m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff)); + uae_u32* m = (uae_u32*)(RAMBase + (addr & 0xffffff)); return do_get_mem_long(m); } uae_u32 REGPARAM2 ram24_wget(uaecptr addr) { - uae_u16 *m; - m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff)); + uae_u16* m = (uae_u16*)(RAMBase + (addr & 0xffffff)); return do_get_mem_word(m); } uae_u32 REGPARAM2 ram24_bget(uaecptr addr) { - return (uae_u32)*(uae_u8 *)(RAMBaseDiff + (addr & 0xffffff)); + return *(RAMBase + (addr & 0xffffff)); } void REGPARAM2 ram24_lput(uaecptr addr, uae_u32 l) { - uae_u32 *m; - m = (uae_u32 *)(RAMBaseDiff + (addr & 0xffffff)); + uae_u32* m = (uae_u32*)(RAMBase + (addr & 0xffffff)); do_put_mem_long(m, l); } void REGPARAM2 ram24_wput(uaecptr addr, uae_u32 w) { - uae_u16 *m; - m = (uae_u16 *)(RAMBaseDiff + (addr & 0xffffff)); + uae_u16* m = (uae_u16*)(RAMBase + (addr & 0xffffff)); do_put_mem_word(m, w); } void REGPARAM2 ram24_bput(uaecptr addr, uae_u32 b) { - *(uae_u8 *)(RAMBaseDiff + (addr & 0xffffff)) = b; + *(RAMBase + (addr & 0xffffff)) = b; } -uae_u8 *REGPARAM2 ram24_xlate(uaecptr addr) +uae_u8* REGPARAM2 ram24_xlate(uaecptr addr) { - return (uae_u8 *)(RAMBaseDiff + (addr & 0xffffff)); + return RAMBase + (addr & 0xffffff); } /* Mac ROM (32 bit addressing) */ @@ -242,27 +230,23 @@ static uae_u32 REGPARAM2 rom_bget(uaecptr) REGPARAM; static void REGPARAM2 rom_lput(uaecptr, uae_u32) REGPARAM; static void REGPARAM2 rom_wput(uaecptr, uae_u32) REGPARAM; static void REGPARAM2 rom_bput(uaecptr, uae_u32) REGPARAM; -static uae_u8 *REGPARAM2 rom_xlate(uaecptr addr) REGPARAM; +static uae_u8* REGPARAM2 rom_xlate(uaecptr addr) REGPARAM; -static uintptr ROMBaseDiff; // ROMBaseHost - ROMBaseMac +static uae_u8* ROMBase; // ROMBaseHost - ROMBaseMac uae_u32 REGPARAM2 rom_lget(uaecptr addr) { - uae_u32 *m; - m = (uae_u32 *)(ROMBaseDiff + addr); - return do_get_mem_long(m); + return do_get_mem_long(ROMBase + addr); } uae_u32 REGPARAM2 rom_wget(uaecptr addr) { - uae_u16 *m; - m = (uae_u16 *)(ROMBaseDiff + addr); - return do_get_mem_word(m); + return do_get_mem_word(ROMBase + addr); } uae_u32 REGPARAM2 rom_bget(uaecptr addr) { - return (uae_u32)*(uae_u8 *)(ROMBaseDiff + addr); + return *(ROMBase + addr); } void REGPARAM2 rom_lput(uaecptr addr, uae_u32 b) @@ -285,7 +269,7 @@ void REGPARAM2 rom_bput(uaecptr addr, uae_u32 b) uae_u8 *REGPARAM2 rom_xlate(uaecptr addr) { - return (uae_u8 *)(ROMBaseDiff + addr); + return ROMBase + addr; } /* Mac ROM (24 bit addressing) */ @@ -293,30 +277,26 @@ uae_u8 *REGPARAM2 rom_xlate(uaecptr addr) static uae_u32 REGPARAM2 rom24_lget(uaecptr) REGPARAM; static uae_u32 REGPARAM2 rom24_wget(uaecptr) REGPARAM; static uae_u32 REGPARAM2 rom24_bget(uaecptr) REGPARAM; -static uae_u8 *REGPARAM2 rom24_xlate(uaecptr addr) REGPARAM; +static uae_u8* REGPARAM2 rom24_xlate(uaecptr addr) REGPARAM; uae_u32 REGPARAM2 rom24_lget(uaecptr addr) { - uae_u32 *m; - m = (uae_u32 *)(ROMBaseDiff + (addr & 0xffffff)); - return do_get_mem_long(m); + return do_get_mem_long(ROMBase + (addr & 0xffffff)); } uae_u32 REGPARAM2 rom24_wget(uaecptr addr) { - uae_u16 *m; - m = (uae_u16 *)(ROMBaseDiff + (addr & 0xffffff)); - return do_get_mem_word(m); + return do_get_mem_word(ROMBase + (addr & 0xffffff)); } uae_u32 REGPARAM2 rom24_bget(uaecptr addr) { - return (uae_u32)*(uae_u8 *)(ROMBaseDiff + (addr & 0xffffff)); + return *(ROMBase + (addr & 0xffffff)); } -uae_u8 *REGPARAM2 rom24_xlate(uaecptr addr) +uae_u8* REGPARAM2 rom24_xlate(uaecptr addr) { - return (uae_u8 *)(ROMBaseDiff + (addr & 0xffffff)); + return ROMBaseDiff + (addr & 0xffffff); } /* Frame buffer */ @@ -341,131 +321,108 @@ static void REGPARAM2 frame_host_565_wput(uaecptr, uae_u32) REGPARAM; static uae_u32 REGPARAM2 frame_host_888_lget(uaecptr) REGPARAM; static void REGPARAM2 frame_host_888_lput(uaecptr, uae_u32) REGPARAM; -static uae_u8 *REGPARAM2 frame_xlate(uaecptr addr) REGPARAM; +static uae_u8* REGPARAM2 frame_xlate(uaecptr addr) REGPARAM; -static uintptr FrameBaseDiff; // MacFrameBaseHost - MacFrameBaseMac +static uae_u8* FrameBase; // MacFrameBaseHost - MacFrameBaseMac uae_u32 REGPARAM2 frame_direct_lget(uaecptr addr) { - uae_u32 *m; - m = (uae_u32 *)(FrameBaseDiff + addr); - return do_get_mem_long(m); + return do_get_mem_long(FrameBase + addr); } uae_u32 REGPARAM2 frame_direct_wget(uaecptr addr) { - uae_u16 *m; - m = (uae_u16 *)(FrameBaseDiff + addr); - return do_get_mem_word(m); + return do_get_mem_word(FrameBase + addr); } uae_u32 REGPARAM2 frame_direct_bget(uaecptr addr) { - return (uae_u32)*(uae_u8 *)(FrameBaseDiff + addr); + return *(FrameBase + addr); } void REGPARAM2 frame_direct_lput(uaecptr addr, uae_u32 l) { - uae_u32 *m; - m = (uae_u32 *)(FrameBaseDiff + addr); - do_put_mem_long(m, l); + do_put_mem_long(FrameBase + addr, l); } void REGPARAM2 frame_direct_wput(uaecptr addr, uae_u32 w) { - uae_u16 *m; - m = (uae_u16 *)(FrameBaseDiff + addr); - do_put_mem_word(m, w); + do_put_mem_word(FrameBase + addr, w); } void REGPARAM2 frame_direct_bput(uaecptr addr, uae_u32 b) { - *(uae_u8 *)(FrameBaseDiff + addr) = b; + *(FrameBase + addr) = b; } uae_u32 REGPARAM2 frame_host_555_lget(uaecptr addr) { - uae_u32 *m, l; - m = (uae_u32 *)(FrameBaseDiff + addr); - l = *m; + uae_u32 l = *(uae_u32*)(FrameBase + addr); return swap_words(l); } uae_u32 REGPARAM2 frame_host_555_wget(uaecptr addr) { - uae_u16 *m; - m = (uae_u16 *)(FrameBaseDiff + addr); - return *m; + return *(uae_u16*)(FrameBase + addr); } void REGPARAM2 frame_host_555_lput(uaecptr addr, uae_u32 l) { - uae_u32 *m; - m = (uae_u32 *)(FrameBaseDiff + addr); + uae_u32* m = (uae_u32*)(FrameBase + addr); *m = swap_words(l); } void REGPARAM2 frame_host_555_wput(uaecptr addr, uae_u32 w) { - uae_u16 *m; - m = (uae_u16 *)(FrameBaseDiff + addr); + uae_u16* m = (uae_u16*)(FrameBase + addr); *m = w; } uae_u32 REGPARAM2 frame_host_565_lget(uaecptr addr) { - uae_u32 *m, l; - m = (uae_u32 *)(FrameBaseDiff + addr); - l = *m; + uae_u32 l = *(uae_u32*)(FrameBase + addr); l = (l & 0x001f001f) | ((l >> 1) & 0x7fe07fe0); return swap_words(l); } uae_u32 REGPARAM2 frame_host_565_wget(uaecptr addr) { - uae_u16 *m, w; - m = (uae_u16 *)(FrameBaseDiff + addr); - w = *m; + uae_u16 w = *(uae_u16*)(FrameBase + addr); return (w & 0x1f) | ((w >> 1) & 0x7fe0); } void REGPARAM2 frame_host_565_lput(uaecptr addr, uae_u32 l) { - uae_u32 *m; - m = (uae_u32 *)(FrameBaseDiff + addr); + uae_u32* m = (uae_u32*)(FrameBase + addr); l = (l & 0x001f001f) | ((l << 1) & 0xffc0ffc0); *m = swap_words(l); } void REGPARAM2 frame_host_565_wput(uaecptr addr, uae_u32 w) { - uae_u16 *m; - m = (uae_u16 *)(FrameBaseDiff + addr); + uae_u16* m = (uae_u16*)(FrameBase + addr); *m = (w & 0x1f) | ((w << 1) & 0xffc0); } uae_u32 REGPARAM2 frame_host_888_lget(uaecptr addr) { - uae_u32 *m, l; - m = (uae_u32 *)(FrameBaseDiff + addr); - return *m; + return *(uae_u32*)(FrameBase + addr); } void REGPARAM2 frame_host_888_lput(uaecptr addr, uae_u32 l) { - uae_u32 *m; - m = (uae_u32 *)(MacFrameBaseHost + addr - MacFrameBaseMac); + uae_u32* m = (uae_u32*)(MacFrameBaseHost + addr - MacFrameBaseMac); *m = l; } -uae_u8 *REGPARAM2 frame_xlate(uaecptr addr) +uae_u8* REGPARAM2 frame_xlate(uaecptr addr) { - return (uae_u8 *)(FrameBaseDiff + addr); + return FrameBase + addr; } /* Default memory access functions */ -uae_u8 *REGPARAM2 default_xlate (uaecptr a) +uae_u8* REGPARAM2 default_xlate(uaecptr a) { write_log("Your Mac program just did something terribly stupid\n"); return NULL; @@ -535,9 +492,9 @@ void memory_init(void) // Limit RAM size to not overlap ROM uint32 ram_size = RAMSize > ROMBaseMac ? ROMBaseMac : RAMSize; - RAMBaseDiff = (uintptr)RAMBaseHost - (uintptr)RAMBaseMac; - ROMBaseDiff = (uintptr)ROMBaseHost - (uintptr)ROMBaseMac; - FrameBaseDiff = (uintptr)MacFrameBaseHost - (uintptr)MacFrameBaseMac; + RAMBase = RAMBaseHost - RAMBaseMac; + ROMBase = ROMBaseHost - ROMBaseMac; + FrameBase = MacFrameBaseHost - MacFrameBaseMac; // Map RAM and ROM if (TwentyFourBitAddressing) { diff --git a/BasiliskII/src/uae_cpu/memory.h b/BasiliskII/src/uae_cpu/memory.h index 75a6303ba..f7cf0650d 100644 --- a/BasiliskII/src/uae_cpu/memory.h +++ b/BasiliskII/src/uae_cpu/memory.h @@ -36,7 +36,7 @@ typedef uae_u32 (REGPARAM2 *mem_get_func)(uaecptr) REGPARAM; typedef void (REGPARAM2 *mem_put_func)(uaecptr, uae_u32) REGPARAM; -typedef uae_u8 *(REGPARAM2 *xlate_func)(uaecptr) REGPARAM; +typedef void* (REGPARAM2 *xlate_func)(uaecptr) REGPARAM; #undef DIRECT_MEMFUNCS_SUCCESSFUL @@ -67,12 +67,12 @@ extern addrbank frame_bank; // Frame buffer /* Default memory access functions */ -extern uae_u8 *REGPARAM2 default_xlate(uaecptr addr) REGPARAM; +extern void* REGPARAM2 default_xlate(uaecptr addr) REGPARAM; #define bankindex(addr) (((uaecptr)(addr)) >> 16) #ifdef SAVE_MEMORY_BANKS -extern addrbank *mem_banks[65536]; +extern addrbank* mem_banks[65536]; #define get_mem_bank(addr) (*mem_banks[bankindex(addr)]) #define put_mem_bank(addr, b) (mem_banks[bankindex(addr)] = (b)) #else @@ -82,7 +82,7 @@ extern addrbank mem_banks[65536]; #endif extern void memory_init(void); -extern void map_banks(addrbank *bank, int first, int count); +extern void map_banks(addrbank* bank, int first, int count); #ifndef NO_INLINE_MEMORY_ACCESS @@ -118,55 +118,55 @@ extern void byteput(uaecptr addr, uae_u32 b); #endif /* !DIRECT_ADDRESSING && !REAL_ADDRESSING */ #if REAL_ADDRESSING -const uintptr MEMBaseDiff = 0; +const uae_u8* MEMBase = NULL; #elif DIRECT_ADDRESSING -extern uintptr MEMBaseDiff; +extern uae_u8* MEMBase; #endif #if REAL_ADDRESSING || DIRECT_ADDRESSING -static __inline__ uae_u8 *do_get_real_address(uaecptr addr) +static __inline__ void* do_get_real_address(uaecptr addr) { - return (uae_u8 *)MEMBaseDiff + addr; + return MEMBase + addr; } -static __inline__ uae_u32 do_get_virtual_address(uae_u8 *addr) +static __inline__ uaecptr do_get_virtual_address(const void* addr) { - return (uintptr)addr - MEMBaseDiff; + return (const uae_u8*)addr - MEMBase; } static __inline__ uae_u32 get_long(uaecptr addr) { - uae_u32 * const m = (uae_u32 *)do_get_real_address(addr); + const uae_u32* m = (const uae_u32*)do_get_real_address(addr); return do_get_mem_long(m); } static __inline__ uae_u32 get_word(uaecptr addr) { - uae_u16 * const m = (uae_u16 *)do_get_real_address(addr); + const uae_u16* m = (const uae_u16*)do_get_real_address(addr); return do_get_mem_word(m); } static __inline__ uae_u32 get_byte(uaecptr addr) { - uae_u8 * const m = (uae_u8 *)do_get_real_address(addr); + const uae_u8* m = (const uae_u8*)do_get_real_address(addr); return do_get_mem_byte(m); } static __inline__ void put_long(uaecptr addr, uae_u32 l) { - uae_u32 * const m = (uae_u32 *)do_get_real_address(addr); + uae_u32* m = (uae_u32*)do_get_real_address(addr); do_put_mem_long(m, l); } static __inline__ void put_word(uaecptr addr, uae_u32 w) { - uae_u16 * const m = (uae_u16 *)do_get_real_address(addr); + uae_u16* m = (uae_u16*)do_get_real_address(addr); do_put_mem_word(m, w); } static __inline__ void put_byte(uaecptr addr, uae_u32 b) { - uae_u8 * const m = (uae_u8 *)do_get_real_address(addr); + uae_u8* m = (uae_u8*)do_get_real_address(addr); do_put_mem_byte(m, b); } -static __inline__ uae_u8 *get_real_address(uaecptr addr) +static __inline__ void* get_real_address(uaecptr addr) { return do_get_real_address(addr); } -static __inline__ uae_u32 get_virtual_address(uae_u8 *addr) +static __inline__ uaecptr get_virtual_address(const void* addr) { return do_get_virtual_address(addr); } @@ -195,12 +195,12 @@ static __inline__ void put_byte(uaecptr addr, uae_u32 b) { byteput_1(addr, b); } -static __inline__ uae_u8 *get_real_address(uaecptr addr) +static __inline__ void* get_real_address(uaecptr addr) { return get_mem_bank(addr).xlateaddr(addr); } /* gb-- deliberately not implemented since it shall not be used... */ -extern uae_u32 get_virtual_address(uae_u8 *addr); +extern uae_u32 get_virtual_address(const void* addr); #endif /* DIRECT_ADDRESSING || REAL_ADDRESSING */ #endif /* MEMORY_H */ diff --git a/BasiliskII/src/uae_cpu/newcpu.cpp b/BasiliskII/src/uae_cpu/newcpu.cpp index 4e45817bf..407b54026 100644 --- a/BasiliskII/src/uae_cpu/newcpu.cpp +++ b/BasiliskII/src/uae_cpu/newcpu.cpp @@ -1175,7 +1175,7 @@ void m68k_mull (uae_u32 opcode, uae_u32 src, uae_u16 extra) } #endif } -static char* ccnames[] = +static const char* const ccnames[] = { "T ","F ","HI","LS","CC","CS","NE","EQ", "VC","VS","PL","MI","GE","LT","GT","LE" }; diff --git a/BasiliskII/src/uae_cpu/newcpu.h b/BasiliskII/src/uae_cpu/newcpu.h index 1d07c36b8..6e5edfa18 100644 --- a/BasiliskII/src/uae_cpu/newcpu.h +++ b/BasiliskII/src/uae_cpu/newcpu.h @@ -81,8 +81,8 @@ struct regstruct { uae_u32 regs[16]; uae_u32 pc; - uae_u8 * pc_p; - uae_u8 * pc_oldp; + const uae_u8* pc_p; + const uae_u8* pc_oldp; spcflags_t spcflags; int intmask; @@ -112,9 +112,9 @@ extern regstruct regs, lastint_regs; #define m68k_dreg(r,num) ((r).regs[(num)]) #define m68k_areg(r,num) (((r).regs + 8)[(num)]) -#define get_ibyte(o) do_get_mem_byte((uae_u8 *)(regs.pc_p + (o) + 1)) -#define get_iword(o) do_get_mem_word((uae_u16 *)(regs.pc_p + (o))) -#define get_ilong(o) do_get_mem_long((uae_u32 *)(regs.pc_p + (o))) +#define get_ibyte(o) do_get_mem_byte(regs.pc_p + (o) + 1) +#define get_iword(o) do_get_mem_word(regs.pc_p + (o)) +#define get_ilong(o) do_get_mem_long(regs.pc_p + (o)) #ifdef HAVE_GET_WORD_UNSWAPPED #define GET_OPCODE (do_get_mem_word_unswapped (regs.pc_p)) @@ -126,24 +126,24 @@ extern regstruct regs, lastint_regs; static __inline__ uae_u32 get_ibyte_prefetch (uae_s32 o) { if (o > 3 || o < 0) - return do_get_mem_byte((uae_u8 *)(regs.pc_p + o + 1)); + return do_get_mem_byte(regs.pc_p + o + 1); - return do_get_mem_byte((uae_u8 *)(((uae_u8 *)®s.prefetch) + o + 1)); + return do_get_mem_byte(((uae_u8 *)®s.prefetch) + o + 1); } static __inline__ uae_u32 get_iword_prefetch (uae_s32 o) { if (o > 3 || o < 0) - return do_get_mem_word((uae_u16 *)(regs.pc_p + o)); + return do_get_mem_word(regs.pc_p + o); - return do_get_mem_word((uae_u16 *)(((uae_u8 *)®s.prefetch) + o)); + return do_get_mem_word(((uae_u8 *)®s.prefetch) + o); } static __inline__ uae_u32 get_ilong_prefetch (uae_s32 o) { if (o > 3 || o < 0) - return do_get_mem_long((uae_u32 *)(regs.pc_p + o)); + return do_get_mem_long(regs.pc_p + o); if (o == 0) return do_get_mem_long(®s.prefetch); - return (do_get_mem_word (((uae_u16 *)®s.prefetch) + 1) << 16) | do_get_mem_word ((uae_u16 *)(regs.pc_p + 4)); + return (do_get_mem_word (((uae_u16 *)®s.prefetch) + 1) << 16) | do_get_mem_word (regs.pc_p + 4); } #endif @@ -157,7 +157,7 @@ static __inline__ void fill_prefetch_0 (void) r = *(uae_u32 *)regs.pc_p; regs.prefetch = r; #else - r = do_get_mem_long ((uae_u32 *)regs.pc_p); + r = do_get_mem_long (regs.pc_p); do_put_mem_long (®s.prefetch, r); #endif #endif @@ -201,9 +201,9 @@ static __inline__ uae_u32 next_ilong (void) static __inline__ void m68k_setpc (uaecptr newpc) { #if REAL_ADDRESSING || DIRECT_ADDRESSING - regs.pc_p = get_real_address(newpc); + regs.pc_p = static_cast(get_real_address(newpc)); #else - regs.pc_p = regs.pc_oldp = get_real_address(newpc); + regs.pc_p = regs.pc_oldp = static_cast(get_real_address(newpc)); regs.pc = newpc; #endif } @@ -213,7 +213,7 @@ static __inline__ uaecptr m68k_getpc (void) #if REAL_ADDRESSING || DIRECT_ADDRESSING return get_virtual_address(regs.pc_p); #else - return regs.pc + ((char *)regs.pc_p - (char *)regs.pc_oldp); + return regs.pc + (regs.pc_p - regs.pc_oldp); #endif } diff --git a/BasiliskII/src/video.cpp b/BasiliskII/src/video.cpp index 8f84f48de..d8c3f24e5 100644 --- a/BasiliskII/src/video.cpp +++ b/BasiliskII/src/video.cpp @@ -91,7 +91,7 @@ monitor_desc::monitor_desc(const vector &available_modes, video_dept slot_id = next_slot_id++; // Initialize Apple mode list - uint16 mode = 0x80; + uint8 mode = 0x80; for (int depth = VDEPTH_1BIT; depth <= VDEPTH_32BIT; depth++) { if (has_depth(video_depth(depth))) apple_mode_for_depth[depth] = mode++; @@ -157,7 +157,7 @@ bool monitor_desc::has_resolution(uint32 id) const * Find specified mode (depth/resolution) (or invalid_mode() if not found) */ -vector::const_iterator monitor_desc::find_mode(uint16 apple_mode, uint32 id) const +vector::const_iterator monitor_desc::find_mode(uint8 apple_mode, uint32 id) const { vector::const_iterator i, end = modes.end(); for (i = modes.begin(); i != end; ++i) { @@ -224,12 +224,14 @@ void monitor_desc::set_gray_palette(void) void monitor_desc::load_ramp_palette(void) { // Find tables for gamma correction - uint8 *red_gamma = NULL, *green_gamma = NULL, *blue_gamma = NULL; + const uint8* red_gamma = NULL; + const uint8* green_gamma = NULL; + const uint8* blue_gamma = NULL; bool have_gamma = false; int data_width = 0; if (gamma_table) { uint32 table = gamma_table; - red_gamma = Mac2HostAddr(table + gFormulaData + ReadMacInt16(table + gFormulaSize)); + red_gamma = static_cast(Mac2HostAddr(table + gFormulaData + ReadMacInt16(table + gFormulaSize))); int chan_cnt = ReadMacInt16(table + gChanCnt); if (chan_cnt == 1) green_gamma = blue_gamma = red_gamma; @@ -500,7 +502,7 @@ int16 monitor_desc::driver_control(uint16 code, uint32 param, uint32 dce) return paramErr; if (mode != current_apple_mode) { - vector::const_iterator i = find_mode(mode, current_id); + vector::const_iterator i = find_mode(uint8(mode), current_id); if (i == invalid_mode()) return paramErr; switch_mode(i, param, dce); @@ -526,11 +528,13 @@ int16 monitor_desc::driver_control(uint16 code, uint32 param, uint32 dce) return paramErr; // Find tables for gamma correction - uint8 *red_gamma = NULL, *green_gamma = NULL, *blue_gamma = NULL; + const uint8* red_gamma = NULL; + const uint8* green_gamma = NULL; + const uint8* blue_gamma = NULL; bool have_gamma = false; int data_width = 0; if (gamma_table) { - red_gamma = Mac2HostAddr(gamma_table + gFormulaData + ReadMacInt16(gamma_table + gFormulaSize)); + red_gamma = static_cast(Mac2HostAddr(gamma_table + gFormulaData + ReadMacInt16(gamma_table + gFormulaSize))); int chan_cnt = ReadMacInt16(gamma_table + gChanCnt); if (chan_cnt == 1) green_gamma = blue_gamma = red_gamma; @@ -636,7 +640,7 @@ int16 monitor_desc::driver_control(uint16 code, uint32 param, uint32 dce) return noErr; case cscSetDefaultMode: { // Set default color depth - uint16 mode = ReadMacInt8(param + csMode); + uint8 mode = ReadMacInt8(param + csMode); D(bug(" SetDefaultMode %02x\n", mode)); preferred_apple_mode = mode; return noErr; @@ -654,7 +658,7 @@ int16 monitor_desc::driver_control(uint16 code, uint32 param, uint32 dce) return paramErr; if (mode != current_apple_mode || id != current_id) { - vector::const_iterator i = find_mode(mode, id); + vector::const_iterator i = find_mode(uint8(mode), id); if (i == invalid_mode()) return paramErr; switch_mode(i, param, dce); @@ -667,7 +671,7 @@ int16 monitor_desc::driver_control(uint16 code, uint32 param, uint32 dce) uint16 mode = ReadMacInt16(param + csMode); uint32 id = ReadMacInt32(param + csData); D(bug(" SavePreferredConfiguration %04x, %08x\n", mode, id)); - preferred_apple_mode = mode; + preferred_apple_mode = uint8(mode); preferred_id = id; return noErr; } @@ -702,7 +706,7 @@ int16 monitor_desc::driver_status(uint16 code, uint32 param) switch (code) { case cscGetMode: // Get current color depth - D(bug(" GetMode -> %04x, base %08x\n", current_apple_mode, mac_frame_base)); + D(bug(" GetMode -> %02x, base %08x\n", current_apple_mode, mac_frame_base)); WriteMacInt16(param + csMode, current_apple_mode); WriteMacInt16(param + csPage, 0); WriteMacInt32(param + csBaseAddr, mac_frame_base); @@ -780,7 +784,7 @@ int16 monitor_desc::driver_status(uint16 code, uint32 param) return noErr; case cscGetCurrentMode: // Get current video mode (depth and resolution) - D(bug(" GetCurMode -> %04x/%08x, base %08x\n", current_apple_mode, current_id, mac_frame_base)); + D(bug(" GetCurMode -> %02x/%08x, base %08x\n", current_apple_mode, current_id, mac_frame_base)); WriteMacInt16(param + csMode, current_apple_mode); WriteMacInt32(param + csData, current_id); WriteMacInt16(param + csPage, 0); @@ -817,7 +821,7 @@ int16 monitor_desc::driver_status(uint16 code, uint32 param) return noErr; case cscGetPreferredConfiguration: // Get default video mode (depth and resolution) - D(bug(" GetPreferredConfiguration -> %04x/%08x\n", preferred_apple_mode, preferred_id)); + D(bug(" GetPreferredConfiguration -> %02x/%08x\n", preferred_apple_mode, preferred_id)); WriteMacInt16(param + csMode, preferred_apple_mode); WriteMacInt32(param + csData, preferred_id); return noErr;