- 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: workaround for IRIX pthreads bug in Delay_usec()
[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
- 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
(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:
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

View File

@ -222,50 +222,33 @@ EXTRASYSSRCS=
CAN_NATIVE_M68K=no
case "$target_os" in
linux*)
ETHERSRC=Linux/ether_linux.cpp
SCSISRC=Linux/scsi_linux.cpp
ETHERSRC=ether_unix.cpp
AUDIOSRC=audio_oss_esd.cpp
SCSISRC=Linux/scsi_linux.cpp
;;
freebsd*3.*)
freebsd*)
ETHERSRC=ether_unix.cpp
AUDIOSRC=audio_oss_esd.cpp
DEFINES="$DEFINES -DBSD_COMP"
CXXFLAGS="$CXXFLAGS -fpermissive"
dnl Check for the CAM library
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
else
dnl Check for the sys kernel includes
AC_CHECK_HEADER(/sys/cam/cam.h)
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
AC_CHECK_HEADER(camlib.h)
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
dnl In this case I should fix this thing including a "patch"
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
SCSISRC=FreeBSD/scsi_freebsd.cpp
CXXFLAGS="$CXXFLAGS -I/sys"
CFLAGS="$CFLAGS -I/sys"
LIBS="$LIBS -lcam"
DEFINES="$DEFINES -DCAM"
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*)
CAN_NATIVE_M68K=yes
;;
@ -585,7 +568,7 @@ dnl Select appropriate CPU source and REGPARAM define.
ASM_OPTIMIZATIONS=none
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.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
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
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
*
@ -27,6 +27,11 @@
#include <errno.h>
#include <stdio.h>
#if defined(__FreeBSD__)
#include <sys/socket.h>
#include <net/if.h>
#endif
#include "cpu_emulation.h"
#include "main.h"
#include "macos_util.h"
@ -131,12 +136,14 @@ void EtherInit(void)
goto open_error;
}
#if defined(__linux__)
// Attach sheep_net to selected Ethernet card
if (!is_ethertap && ioctl(fd, SIOCSIFLINK, name) < 0) {
sprintf(str, GetString(STR_SHEEP_NET_ATTACH_WARN), strerror(errno));
WarningAlert(str);
goto open_error;
}
#endif
// Set nonblocking I/O
ioctl(fd, FIONBIO, &nonblock);
@ -320,11 +327,13 @@ int16 ether_write(uint32 wds)
// Copy packet to buffer
uint8 packet[1516], *p = packet;
int len = 0;
#if defined(__linux__)
if (is_ethertap) {
*p++ = 0; // Ethertap discards the first 2 bytes
*p++ = 0; // Linux ethertap discards the first 2 bytes
*p++ = 0;
len += 2;
}
#endif
for (;;) {
int w = ReadMacInt16(wds);
if (w == 0)
@ -391,7 +400,11 @@ void EtherInterrupt(void)
for (;;) {
// Read packet from sheep_net device
#if defined(__linux__)
ssize_t length = read(fd, packet, is_ethertap ? 1516 : 1514);
#else
ssize_t length = read(fd, packet, 1514);
#endif
if (length < 14)
break;
@ -405,10 +418,12 @@ void EtherInterrupt(void)
// Pointer to packet data (Ethernet header)
uint8 *p = packet;
#if defined(__linux__)
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;
}
#endif
// Get packet type
uint16 type = ntohs(*(uint16 *)(p + 12));

View File

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