mirror of
https://github.com/open-simh/simh.git
synced 2026-01-25 11:55:43 +00:00
Notes For V3.8
The makefile now works for Linux and most Unix's. Howevr, for Solaris and MacOS, you must first export the OSTYPE environment variable: > export OSTYPE > make Otherwise, you will get build errors. 1. New Features 1.1 3.8-0 1.1.1 SCP and Libraries - BREAK, NOBREAK, and SHOW BREAK with no argument will set, clear, and show (respectively) a breakpoint at the current PC. 1.2 GRI - Added support for the GRI-99 processor. 1.3 HP2100 - Added support for the BACI terminal interface. - Added support for RTE OS/VMA/EMA, SIGNAL, VIS firmware extensions. 1.4 Nova - Added support for 64KW memory (implemented in third-party CPU's). 1.5 PDP-11 - Added support for DC11, RC11, KE11A, KG11A. - Added modem control support for DL11. - Added ASCII character support for all 8b devices. 2. Bugs Fixed Please see the revision history on http://simh.trailing-edge.com or in the source module sim_rev.h.
This commit is contained in:
committed by
Mark Pizzolato
parent
3cb7c60d5d
commit
59aa4a73b1
284
sim_ether.c
284
sim_ether.c
@@ -49,8 +49,8 @@
|
||||
networking is needed - there may be known workarounds.
|
||||
|
||||
Define one of the two macros below to enable networking:
|
||||
USE_NETWORK - Create statically linked network code
|
||||
USE_SHARED - Create dynamically linked network code (_WIN32 only)
|
||||
USE_NETWORK - Create statically linked network code
|
||||
USE_SHARED - Create dynamically linked network code (_WIN32 only)
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
@@ -140,9 +140,9 @@
|
||||
|
||||
17-May-07 DTH Fixed non-ethernet device removal loop (from Naoki Hamada)
|
||||
15-May-07 DTH Added dynamic loading of wpcap.dll;
|
||||
Corrected exceed max index bug in ethX lookup
|
||||
Corrected exceed max index bug in ethX lookup
|
||||
04-May-07 DTH Corrected failure to look up ethernet device names in
|
||||
the registry on Windows XP x64
|
||||
the registry on Windows XP x64
|
||||
10-Jul-06 RMS Fixed linux conditionalization (from Chaskiel Grundman)
|
||||
02-Jun-06 JDB Fixed compiler warning for incompatible sscanf parameter
|
||||
15-Dec-05 DTH Patched eth_host_devices [remove non-ethernet devices]
|
||||
@@ -623,7 +623,7 @@ t_stat eth_filter (ETH_DEV* dev, int addr_count, ETH_MAC* addresses,
|
||||
{return SCPE_NOFNC;}
|
||||
int eth_devices (int max, ETH_LIST* dev)
|
||||
{return -1;}
|
||||
#else /* endif unimplemented */
|
||||
#else /* endif unimplemented */
|
||||
|
||||
/*============================================================================*/
|
||||
/* WIN32, Linux, and xBSD routines use WinPcap and libpcap packages */
|
||||
@@ -648,8 +648,8 @@ int eth_devices (int max, ETH_LIST* dev)
|
||||
Etherial/WireShark capture_pcap.c */
|
||||
|
||||
/* Dynamic DLL load variables */
|
||||
static HINSTANCE hDll = 0; /* handle to DLL */
|
||||
static int dll_loaded = 0; /* 0=not loaded, 1=loaded, 2=DLL load failed, 3=Func load failed */
|
||||
static HINSTANCE hDll = 0; /* handle to DLL */
|
||||
static int dll_loaded = 0; /* 0=not loaded, 1=loaded, 2=DLL load failed, 3=Func load failed */
|
||||
static char* no_wpcap = "wpcap load failure";
|
||||
|
||||
/* define pointers to pcap functions needed */
|
||||
@@ -669,158 +669,158 @@ static char* (*p_pcap_lib_version) (void);
|
||||
|
||||
/* load function pointer from DLL */
|
||||
void load_function(char* function, void** func_ptr) {
|
||||
*func_ptr = GetProcAddress(hDll, function);
|
||||
if (*func_ptr == 0) {
|
||||
char* msg = "Eth: Failed to find function '%s' in wpcap.dll\r\n";
|
||||
printf (msg, function);
|
||||
if (sim_log) fprintf (sim_log, msg, function);
|
||||
dll_loaded = 3;
|
||||
}
|
||||
*func_ptr = GetProcAddress(hDll, function);
|
||||
if (*func_ptr == 0) {
|
||||
char* msg = "Eth: Failed to find function '%s' in wpcap.dll\r\n";
|
||||
printf (msg, function);
|
||||
if (sim_log) fprintf (sim_log, msg, function);
|
||||
dll_loaded = 3;
|
||||
}
|
||||
}
|
||||
|
||||
/* load wpcap.dll as required */
|
||||
int load_wpcap(void) {
|
||||
switch(dll_loaded) {
|
||||
case 0: /* not loaded */
|
||||
/* attempt to load DLL */
|
||||
hDll = LoadLibrary(TEXT("wpcap.dll"));
|
||||
if (hDll == 0) {
|
||||
/* failed to load DLL */
|
||||
char* msg = "Eth: Failed to load wpcap.dll\r\n";
|
||||
char* msg2 = "Eth: You must install WinPcap 4.x to use networking\r\n";
|
||||
printf (msg);
|
||||
printf (msg2);
|
||||
if (sim_log) {
|
||||
fprintf (sim_log, msg);
|
||||
fprintf (sim_log, msg2);
|
||||
}
|
||||
dll_loaded = 2;
|
||||
break;
|
||||
} else {
|
||||
/* DLL loaded OK */
|
||||
dll_loaded = 1;
|
||||
}
|
||||
switch(dll_loaded) {
|
||||
case 0: /* not loaded */
|
||||
/* attempt to load DLL */
|
||||
hDll = LoadLibrary(TEXT("wpcap.dll"));
|
||||
if (hDll == 0) {
|
||||
/* failed to load DLL */
|
||||
char* msg = "Eth: Failed to load wpcap.dll\r\n";
|
||||
char* msg2 = "Eth: You must install WinPcap 4.x to use networking\r\n";
|
||||
printf (msg);
|
||||
printf (msg2);
|
||||
if (sim_log) {
|
||||
fprintf (sim_log, msg);
|
||||
fprintf (sim_log, msg2);
|
||||
}
|
||||
dll_loaded = 2;
|
||||
break;
|
||||
} else {
|
||||
/* DLL loaded OK */
|
||||
dll_loaded = 1;
|
||||
}
|
||||
|
||||
/* load required functions; sets dll_load=3 on error */
|
||||
load_function("pcap_close", (void**) &p_pcap_close);
|
||||
load_function("pcap_compile", (void**) &p_pcap_compile);
|
||||
load_function("pcap_datalink", (void**) &p_pcap_datalink);
|
||||
load_function("pcap_dispatch", (void**) &p_pcap_dispatch);
|
||||
load_function("pcap_findalldevs", (void**) &p_pcap_findalldevs);
|
||||
load_function("pcap_freealldevs", (void**) &p_pcap_freealldevs);
|
||||
load_function("pcap_freecode", (void**) &p_pcap_freecode);
|
||||
load_function("pcap_geterr", (void**) &p_pcap_geterr);
|
||||
load_function("pcap_lookupnet", (void**) &p_pcap_lookupnet);
|
||||
load_function("pcap_open_live", (void**) &p_pcap_open_live);
|
||||
load_function("pcap_sendpacket", (void**) &p_pcap_sendpacket);
|
||||
load_function("pcap_setfilter", (void**) &p_pcap_setfilter);
|
||||
load_function("pcap_lib_version", (void**) &p_pcap_lib_version);
|
||||
/* load required functions; sets dll_load=3 on error */
|
||||
load_function("pcap_close", (void**) &p_pcap_close);
|
||||
load_function("pcap_compile", (void**) &p_pcap_compile);
|
||||
load_function("pcap_datalink", (void**) &p_pcap_datalink);
|
||||
load_function("pcap_dispatch", (void**) &p_pcap_dispatch);
|
||||
load_function("pcap_findalldevs", (void**) &p_pcap_findalldevs);
|
||||
load_function("pcap_freealldevs", (void**) &p_pcap_freealldevs);
|
||||
load_function("pcap_freecode", (void**) &p_pcap_freecode);
|
||||
load_function("pcap_geterr", (void**) &p_pcap_geterr);
|
||||
load_function("pcap_lookupnet", (void**) &p_pcap_lookupnet);
|
||||
load_function("pcap_open_live", (void**) &p_pcap_open_live);
|
||||
load_function("pcap_sendpacket", (void**) &p_pcap_sendpacket);
|
||||
load_function("pcap_setfilter", (void**) &p_pcap_setfilter);
|
||||
load_function("pcap_lib_version", (void**) &p_pcap_lib_version);
|
||||
|
||||
if (dll_loaded == 1) {
|
||||
/* log successful load */
|
||||
char* version = p_pcap_lib_version();
|
||||
printf("%s\n", version);
|
||||
if (sim_log)
|
||||
fprintf(sim_log, "%s\n", version);
|
||||
}
|
||||
break;
|
||||
default: /* loaded or failed */
|
||||
break;
|
||||
}
|
||||
return (dll_loaded == 1) ? 1 : 0;
|
||||
if (dll_loaded == 1) {
|
||||
/* log successful load */
|
||||
char* version = p_pcap_lib_version();
|
||||
printf("%s\n", version);
|
||||
if (sim_log)
|
||||
fprintf(sim_log, "%s\n", version);
|
||||
}
|
||||
break;
|
||||
default: /* loaded or failed */
|
||||
break;
|
||||
}
|
||||
return (dll_loaded == 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
/* define functions with dynamic revectoring */
|
||||
void pcap_close(pcap_t* a) {
|
||||
if (load_wpcap() != 0) {
|
||||
p_pcap_close(a);
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
p_pcap_close(a);
|
||||
}
|
||||
}
|
||||
|
||||
int pcap_compile(pcap_t* a, struct bpf_program* b, char* c, int d, bpf_u_int32 e) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_compile(a, b, c, d, e);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_compile(a, b, c, d, e);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int pcap_datalink(pcap_t* a) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_datalink(a);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_datalink(a);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int pcap_dispatch(pcap_t* a, int b, pcap_handler c, u_char* d) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_dispatch(a, b, c, d);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_dispatch(a, b, c, d);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int pcap_findalldevs(pcap_if_t** a, char* b) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_findalldevs(a, b);
|
||||
} else {
|
||||
*a = 0;
|
||||
strcpy(b, no_wpcap);
|
||||
return -1;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_findalldevs(a, b);
|
||||
} else {
|
||||
*a = 0;
|
||||
strcpy(b, no_wpcap);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void pcap_freealldevs(pcap_if_t* a) {
|
||||
if (load_wpcap() != 0) {
|
||||
p_pcap_freealldevs(a);
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
p_pcap_freealldevs(a);
|
||||
}
|
||||
}
|
||||
|
||||
void pcap_freecode(struct bpf_program* a) {
|
||||
if (load_wpcap() != 0) {
|
||||
p_pcap_freecode(a);
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
p_pcap_freecode(a);
|
||||
}
|
||||
}
|
||||
|
||||
char* pcap_geterr(pcap_t* a) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_geterr(a);
|
||||
} else {
|
||||
return (char*) 0;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_geterr(a);
|
||||
} else {
|
||||
return (char*) 0;
|
||||
}
|
||||
}
|
||||
|
||||
int pcap_lookupnet(const char* a, bpf_u_int32* b, bpf_u_int32* c, char* d) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_lookupnet(a, b, c, d);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_lookupnet(a, b, c, d);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
pcap_t* pcap_open_live(const char* a, int b, int c, int d, char* e) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_open_live(a, b, c, d, e);
|
||||
} else {
|
||||
return (pcap_t*) 0;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_open_live(a, b, c, d, e);
|
||||
} else {
|
||||
return (pcap_t*) 0;
|
||||
}
|
||||
}
|
||||
|
||||
int pcap_sendpacket(pcap_t* a, const u_char* b, int c) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_sendpacket(a, b, c);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_sendpacket(a, b, c);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int pcap_setfilter(pcap_t* a, struct bpf_program* b) {
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_setfilter(a, b);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if (load_wpcap() != 0) {
|
||||
return p_pcap_setfilter(a, b);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1387,40 +1387,40 @@ int eth_host_devices(int used, int max, ETH_LIST* list)
|
||||
#if defined(_WIN32)
|
||||
/* replace device description with user-defined adapter name (if defined) */
|
||||
for (i=0; i<used; i++) {
|
||||
char regkey[2048];
|
||||
char regkey[2048];
|
||||
char regval[2048];
|
||||
LONG status;
|
||||
LONG status;
|
||||
DWORD reglen, regtype;
|
||||
HKEY reghnd;
|
||||
|
||||
/* These registry keys don't seem to exist for all devices, so we simply ignore errors. */
|
||||
/* Windows XP x64 registry uses wide characters by default,
|
||||
so we force use of narrow characters by using the 'A'(ANSI) version of RegOpenKeyEx.
|
||||
This could cause some problems later, if this code is internationalized. Ideally,
|
||||
the pcap lookup will return wide characters, and we should use them to build a wide
|
||||
registry key, rather than hardcoding the string as we do here. */
|
||||
if(list[i].name[strlen( "\\Device\\NPF_" )] == '{') {
|
||||
sprintf( regkey, "SYSTEM\\CurrentControlSet\\Control\\Network\\"
|
||||
"{4D36E972-E325-11CE-BFC1-08002BE10318}\\%hs\\Connection", list[i].name+
|
||||
strlen( "\\Device\\NPF_" ) );
|
||||
if((status = RegOpenKeyExA (HKEY_LOCAL_MACHINE, regkey, 0, KEY_QUERY_VALUE, ®hnd)) != ERROR_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
reglen = sizeof(regval);
|
||||
/* These registry keys don't seem to exist for all devices, so we simply ignore errors. */
|
||||
/* Windows XP x64 registry uses wide characters by default,
|
||||
so we force use of narrow characters by using the 'A'(ANSI) version of RegOpenKeyEx.
|
||||
This could cause some problems later, if this code is internationalized. Ideally,
|
||||
the pcap lookup will return wide characters, and we should use them to build a wide
|
||||
registry key, rather than hardcoding the string as we do here. */
|
||||
if(list[i].name[strlen( "\\Device\\NPF_" )] == '{') {
|
||||
sprintf( regkey, "SYSTEM\\CurrentControlSet\\Control\\Network\\"
|
||||
"{4D36E972-E325-11CE-BFC1-08002BE10318}\\%hs\\Connection", list[i].name+
|
||||
strlen( "\\Device\\NPF_" ) );
|
||||
if((status = RegOpenKeyExA (HKEY_LOCAL_MACHINE, regkey, 0, KEY_QUERY_VALUE, ®hnd)) != ERROR_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
reglen = sizeof(regval);
|
||||
|
||||
/* look for user-defined adapter name, bail if not found */
|
||||
/* same comment about Windows XP x64 (above) using RegQueryValueEx */
|
||||
/* look for user-defined adapter name, bail if not found */
|
||||
/* same comment about Windows XP x64 (above) using RegQueryValueEx */
|
||||
if((status = RegQueryValueExA (reghnd, "Name", NULL, ®type, regval, ®len)) != ERROR_SUCCESS) {
|
||||
RegCloseKey (reghnd);
|
||||
continue;
|
||||
}
|
||||
RegCloseKey (reghnd);
|
||||
continue;
|
||||
}
|
||||
/* make sure value is the right type, bail if not acceptable */
|
||||
if((regtype != REG_SZ) || (reglen > sizeof(regval))) {
|
||||
RegCloseKey (reghnd);
|
||||
continue;
|
||||
}
|
||||
if((regtype != REG_SZ) || (reglen > sizeof(regval))) {
|
||||
RegCloseKey (reghnd);
|
||||
continue;
|
||||
}
|
||||
/* registry value seems OK, finish up and replace description */
|
||||
RegCloseKey (reghnd );
|
||||
RegCloseKey (reghnd );
|
||||
sprintf (list[i].desc, "%s", regval);
|
||||
}
|
||||
} /* for */
|
||||
|
||||
Reference in New Issue
Block a user