- FreeBSD configure script cleanups [Michael Alyn Miller]

- ether_linux.cpp moved and renamed to ether_unix.cpp, now also works with
  the tap driver under FreeBSD [Michael Alyn Miller]
- fpu_x86_asm.h: fixed problem in with newer GCC pre-processors
This commit is contained in:
cebix 2001-03-29 14:20:55 +00:00
parent 0cf579b49e
commit 3b54f1f8de
5 changed files with 37 additions and 31 deletions

View File

@ -4,6 +4,9 @@ V0.9 - <insert date here>
- Unix: -Ofast option is supplied to MIPSPro compiler [Brian J. Johnson] - Unix: -Ofast option is supplied to MIPSPro compiler [Brian J. Johnson]
- Unix: workaround for IRIX pthreads bug in Delay_usec() - Unix: workaround for IRIX pthreads bug in Delay_usec()
[Brian J. Johnson] [Brian J. Johnson]
- Unix: FreeBSD configure script cleanups [Michael Alyn Miller]
- Unix: ether_linux.cpp moved and renamed to ether_unix.cpp, now
also works with the tap driver under FreeBSD [Michael Alyn Miller]
V0.9 (snapshot) - 17.Feb.2001 V0.9 (snapshot) - 17.Feb.2001
- adapted for mon V3.0 which is now the required minimum - adapted for mon V3.0 which is now the required minimum

View File

@ -382,6 +382,11 @@ ether <ethernet card description>
your network administrator about the nets and zones you can use your network administrator about the nets and zones you can use
(instead of the ones given in the example above). (instead of the ones given in the example above).
FreeBSD:
The "ethertap" method described above also works under FreeBSD, but since
no-one has found the time to write a section for this manual, you're on
your own here...
AmigaOS: AmigaOS:
You have to specify the name of the SANA-II Ethernet device and the device You have to specify the name of the SANA-II Ethernet device and the device
unit as "<device name>/<unit>" (e.g. "ariadne.device/0"). If the given unit as "<device name>/<unit>" (e.g. "ariadne.device/0"). If the given

View File

@ -222,50 +222,33 @@ EXTRASYSSRCS=
CAN_NATIVE_M68K=no CAN_NATIVE_M68K=no
case "$target_os" in case "$target_os" in
linux*) linux*)
ETHERSRC=Linux/ether_linux.cpp ETHERSRC=ether_unix.cpp
SCSISRC=Linux/scsi_linux.cpp
AUDIOSRC=audio_oss_esd.cpp AUDIOSRC=audio_oss_esd.cpp
SCSISRC=Linux/scsi_linux.cpp
;; ;;
freebsd*3.*) freebsd*)
ETHERSRC=ether_unix.cpp
AUDIOSRC=audio_oss_esd.cpp AUDIOSRC=audio_oss_esd.cpp
DEFINES="$DEFINES -DBSD_COMP" DEFINES="$DEFINES -DBSD_COMP"
CXXFLAGS="$CXXFLAGS -fpermissive"
dnl Check for the CAM library dnl Check for the CAM library
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
else else
dnl Check for the sys kernel includes dnl Check for the sys kernel includes
AC_CHECK_HEADER(/sys/cam/cam.h) AC_CHECK_HEADER(camlib.h)
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
dnl In this case I should fix this thing including a "patch" dnl In this case I should fix this thing including a "patch"
dnl to access directly to the functions in the kernel :) --Orlando dnl to access directly to the functions in the kernel :) --Orlando
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
else else
SCSISRC=FreeBSD/scsi_freebsd.cpp SCSISRC=FreeBSD/scsi_freebsd.cpp
CXXFLAGS="$CXXFLAGS -I/sys"
CFLAGS="$CFLAGS -I/sys"
LIBS="$LIBS -lcam" LIBS="$LIBS -lcam"
DEFINES="$DEFINES -DCAM" DEFINES="$DEFINES -DCAM"
fi fi
fi fi
;; ;;
freebsd*)
DEFINES="$DEFINES -DBSD_COMP"
dnl Check for the SCSI library
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no)
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then
AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.])
else
dnl Check for the sys kernel includes
AC_CHECK_HEADER(scsi.h sys/scsiio.h)
if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.])
else
SCSISRC=FreeBSD/scsi_freebsd.cpp
LIBS="$LIBS -lscsi"
fi
fi
;;
netbsd*) netbsd*)
CAN_NATIVE_M68K=yes CAN_NATIVE_M68K=yes
;; ;;
@ -585,7 +568,7 @@ dnl Select appropriate CPU source and REGPARAM define.
ASM_OPTIMIZATIONS=none ASM_OPTIMIZATIONS=none
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
FPUSRCS="../uae_cpu/fpp.cpp" FPUSRCS="../uae_cpu/fpp.cpp"
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
dnl i386 CPU dnl i386 CPU
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
if [[ "x$HAVE_GAS" = "xyes" ]]; then if [[ "x$HAVE_GAS" = "xyes" ]]; then

View File

@ -1,5 +1,5 @@
/* /*
* ether_unix.cpp - Ethernet device driver, Unix specific stuff * ether_unix.cpp - Ethernet device driver, Unix specific stuff (Linux and FreeBSD)
* *
* Basilisk II (C) 1997-2001 Christian Bauer * Basilisk II (C) 1997-2001 Christian Bauer
* *
@ -27,6 +27,11 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#if defined(__FreeBSD__)
#include <sys/socket.h>
#include <net/if.h>
#endif
#include "cpu_emulation.h" #include "cpu_emulation.h"
#include "main.h" #include "main.h"
#include "macos_util.h" #include "macos_util.h"
@ -131,12 +136,14 @@ void EtherInit(void)
goto open_error; goto open_error;
} }
#if defined(__linux__)
// Attach sheep_net to selected Ethernet card // Attach sheep_net to selected Ethernet card
if (!is_ethertap && ioctl(fd, SIOCSIFLINK, name) < 0) { if (!is_ethertap && ioctl(fd, SIOCSIFLINK, name) < 0) {
sprintf(str, GetString(STR_SHEEP_NET_ATTACH_WARN), strerror(errno)); sprintf(str, GetString(STR_SHEEP_NET_ATTACH_WARN), strerror(errno));
WarningAlert(str); WarningAlert(str);
goto open_error; goto open_error;
} }
#endif
// Set nonblocking I/O // Set nonblocking I/O
ioctl(fd, FIONBIO, &nonblock); ioctl(fd, FIONBIO, &nonblock);
@ -320,11 +327,13 @@ int16 ether_write(uint32 wds)
// Copy packet to buffer // Copy packet to buffer
uint8 packet[1516], *p = packet; uint8 packet[1516], *p = packet;
int len = 0; int len = 0;
#if defined(__linux__)
if (is_ethertap) { if (is_ethertap) {
*p++ = 0; // Ethertap discards the first 2 bytes *p++ = 0; // Linux ethertap discards the first 2 bytes
*p++ = 0; *p++ = 0;
len += 2; len += 2;
} }
#endif
for (;;) { for (;;) {
int w = ReadMacInt16(wds); int w = ReadMacInt16(wds);
if (w == 0) if (w == 0)
@ -391,7 +400,11 @@ void EtherInterrupt(void)
for (;;) { for (;;) {
// Read packet from sheep_net device // Read packet from sheep_net device
#if defined(__linux__)
ssize_t length = read(fd, packet, is_ethertap ? 1516 : 1514); ssize_t length = read(fd, packet, is_ethertap ? 1516 : 1514);
#else
ssize_t length = read(fd, packet, 1514);
#endif
if (length < 14) if (length < 14)
break; break;
@ -405,10 +418,12 @@ void EtherInterrupt(void)
// Pointer to packet data (Ethernet header) // Pointer to packet data (Ethernet header)
uint8 *p = packet; uint8 *p = packet;
#if defined(__linux__)
if (is_ethertap) { if (is_ethertap) {
p += 2; // Ethertap has two random bytes before the packet p += 2; // Linux ethertap has two random bytes before the packet
length -= 2; length -= 2;
} }
#endif
// Get packet type // Get packet type
uint16 type = ntohs(*(uint16 *)(p + 12)); uint16 type = ntohs(*(uint16 *)(p + 12));

View File

@ -2,7 +2,7 @@
static void fpu_emit_macro_definitions() static void fpu_emit_macro_definitions()
{ {
# define DEFINE_MACRO(name, value) \ # define DEFINE_MACRO(name, value) \
__asm__ __volatile__ (#name ## " = " #value) __asm__ __volatile__ (#name " = " #value)
DEFINE_MACRO(BSUN, 0x00008000); DEFINE_MACRO(BSUN, 0x00008000);
DEFINE_MACRO(SNAN, 0x00004000); DEFINE_MACRO(SNAN, 0x00004000);
DEFINE_MACRO(OPERR, 0x00002000); DEFINE_MACRO(OPERR, 0x00002000);
@ -96,7 +96,7 @@ cat > $ofile << EOF
static void fpu_emit_macro_definitions() static void fpu_emit_macro_definitions()
{ {
# define DEFINE_MACRO(name, value) \\ # define DEFINE_MACRO(name, value) \\
__asm__ __volatile__ (#name ## " = " #value) __asm__ __volatile__ (#name " = " #value)
EOF EOF
# processing with awk # processing with awk