This commit is contained in:
RichardG867
2021-01-12 21:49:13 -03:00
43 changed files with 1701 additions and 385 deletions

View File

@@ -0,0 +1,20 @@
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box distribution.
#
# CMake build script.
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
#
# Copyright 2020,2021 David Hrdlička.
#
add_library(net OBJECT network.c net_pcap.c net_slirp.c net_dp8390.c net_3c503.c
net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c)
add_subdirectory(slirp)
target_link_libraries(86Box slirp)

View File

@@ -81,15 +81,15 @@ struct bpf_program {
typedef struct pcap_if pcap_if_t;
typedef struct timeval {
typedef struct net_timeval {
long tv_sec;
long tv_usec;
} timeval;
} net_timeval;
#define PCAP_ERRBUF_SIZE 256
struct pcap_pkthdr {
struct timeval ts;
struct net_timeval ts;
bpf_u_int32 caplen;
bpf_u_int32 len;
};

View File

@@ -2264,6 +2264,26 @@ pcnet_word_write(nic_t *dev, uint32_t addr, uint16_t val)
}
}
static uint8_t
pcnet_byte_read(nic_t *dev, uint32_t addr)
{
uint8_t val = 0xff;
if (!BCR_DWIO(dev)) {
switch (addr & 0x0f) {
case 0x04:
pcnetSoftReset(dev);
val = 0;
break;
}
}
pcnetUpdateIrq(dev);
pcnetlog(3, "%s: pcnet_word_read: addr = %04x, val = %04x, DWIO not set = %04x\n", dev->name, addr & 0x0f, val, !BCR_DWIO(dev));
return(val);
}
static uint16_t
pcnet_word_read(nic_t *dev, uint32_t addr)
@@ -2449,7 +2469,9 @@ pcnet_read(nic_t *dev, uint32_t addr, int len)
(pcnet_aprom_readb(dev, addr + 2) << 16) | (pcnet_aprom_readb(dev, addr + 3) << 24);
}
} else {
if (len == 2)
if (len == 1)
retval = pcnet_byte_read(dev, addr);
else if (len == 2)
retval = pcnet_word_read(dev, addr);
else if (len == 4)
retval = pcnet_dword_read(dev, addr);

View File

@@ -0,0 +1,20 @@
#
# 86Box A hypervisor and IBM PC system emulator that specializes in
# running old operating systems and software designed for IBM
# PC systems and compatibles from 1981 through fairly recent
# system designs based on the PCI bus.
#
# This file is part of the 86Box distribution.
#
# CMake build script.
#
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
#
# Copyright 2020,2021 David Hrdlička.
#
add_library(slirp STATIC arp_table.c bootp.c cksum.c dnssearch.c if.c ip_icmp.c
ip_input.c ip_output.c mbuf.c misc.c sbuf.c slirp.c socket.c tcp_input.c
tcp_output.c tcp_subr.c tcp_timer.c udp.c util.c version.c)
target_link_libraries(slirp wsock32 iphlpapi)

View File

@@ -38,6 +38,7 @@
#include "slirp.h"
#include "ip_icmp.h"
#include <stddef.h>
static struct ip *ip_reass(Slirp *slirp, struct ip *ip, struct ipq *fp);
static void ip_freef(Slirp *slirp, struct ipq *fp);

View File

@@ -14,6 +14,7 @@
*/
#include "slirp.h"
#include <stddef.h>
#define MBUF_THRESH 30

View File

@@ -4,6 +4,7 @@
*/
#include "slirp.h"
#include <stdbool.h>
#ifdef G_OS_UNIX
#include <sys/un.h>
#endif
@@ -366,7 +367,7 @@ char *slirp_connection_info(Slirp *slirp)
so->so_rcv.sb_cc, so->so_snd.sb_cc);
}
return g_string_free(str, FALSE);
return g_string_free(str, false);
}
int slirp_bind_outbound(struct socket *so, unsigned short af)