[Mit-cadr-cvs] r296 - trunk/emulator/usim
bparker at common-lisp.net
bparker at common-lisp.net
Fri Sep 23 00:52:31 UTC 2011
Author: bparker
Date: Thu Sep 22 17:52:29 2011
New Revision: 296
Log:
rjs fixes from 8/22/2011
Added:
trunk/emulator/usim/ether.c (contents, props changed)
trunk/emulator/usim/template.disk9
trunk/emulator/usim/uart.c (contents, props changed)
Modified:
trunk/emulator/usim/Makefile
trunk/emulator/usim/decode.c
trunk/emulator/usim/disk.c
trunk/emulator/usim/diskmaker.c
trunk/emulator/usim/iob.c
trunk/emulator/usim/main.c
trunk/emulator/usim/ucode.c
trunk/emulator/usim/ucode.h
trunk/emulator/usim/usim.h
Modified: trunk/emulator/usim/Makefile
==============================================================================
--- trunk/emulator/usim/Makefile Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/Makefile Thu Sep 22 17:52:29 2011 (r296)
@@ -16,6 +16,10 @@
OS = LINUX
endif
+ifeq ($(OS_NAME), NetBSD)
+OS = NETBSD
+endif
+
#--------- options ---------
DISPLAY = SDL
@@ -26,12 +30,12 @@
#----------- code ------------
-USIM_SRC = main.c decode.c ucode.c disk.c iob.c chaos.c syms.c config.c
+USIM_SRC = main.c decode.c ucode.c disk.c iob.c chaos.c ether.c uart.c syms.c config.c
USIM_HDR = ucode.h config.h
ifeq ($(DISPLAY), SDL)
DISPLAY_SRC = sdl.c
-USIM_LIBS = -lSDL -lpthread
+USIM_LIBS = -lSDL
DEFINES = -DDISPLAY_SDL
endif
@@ -74,6 +78,12 @@
LFLAGS = $(M32) -L/usr/lib
endif
+# NetBSD
+ifeq ($(OS), NETBSD)
+CFLAGS = -O2 -g -mfpmath=sse -msse -march=athlon-4 $(DEFINES) -I/usr/pkg/include
+LFLAGS = -L/usr/pkg/lib
+endif
+
# override above if 64 bit
ifeq ($(MACH_NAME), x86_64)
M32 = -m32
@@ -81,6 +91,7 @@
endif
#DEFINES=-DLASHUP
+DEFINES=-DCADR2
USIM_OBJ = $(USIM_SRC:.c=.o) $(DISPLAY_SRC:.c=.o) $(KEYBOARD_SRC:.c=.o)
Modified: trunk/emulator/usim/decode.c
==============================================================================
--- trunk/emulator/usim/decode.c Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/decode.c Thu Sep 22 17:52:29 2011 (r296)
@@ -14,7 +14,7 @@
#include <fcntl.h>
#include <sys/types.h>
-#if defined(LINUX) || defined(OSX)
+#if defined(LINUX) || defined(OSX) || defined(BSD)
#include <unistd.h>
#endif
Modified: trunk/emulator/usim/disk.c
==============================================================================
--- trunk/emulator/usim/disk.c Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/disk.c Thu Sep 22 17:52:29 2011 (r296)
@@ -14,7 +14,7 @@
#include <string.h>
#include <fcntl.h>
-#if defined(LINUX) || defined(OSX)
+#if defined(LINUX) || defined(OSX) || defined(BSD)
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
Modified: trunk/emulator/usim/diskmaker.c
==============================================================================
--- trunk/emulator/usim/diskmaker.c Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/diskmaker.c Thu Sep 22 17:52:29 2011 (r296)
@@ -22,7 +22,7 @@
#include <fcntl.h>
#include <string.h>
-#if defined(LINUX) || defined(OSX)
+#if defined(LINUX) || defined(OSX) || defined(BSD)
#include <unistd.h>
#endif
@@ -49,6 +49,7 @@
int show;
int extract;
int modify;
+int label;
unsigned int buffer[256];
@@ -302,8 +303,14 @@
if (ret < 256*4)
break;
}
-
close(fd1);
+
+ memset(b, 0, sizeof(b));
+ while (count < parts[index].size) {
+ if (write_block(fd, offset+count, b))
+ break;
+ count++;
+ }
} else {
/* zero blocks */
memset(b, 0, sizeof(b));
@@ -545,6 +552,39 @@
return 0;
}
+int
+modify_labl(char *template, char *img_filename)
+{
+ int fd;
+
+ if (template == NULL) {
+ fprintf(stderr, "missing template filename\n");
+ return -1;
+ }
+
+ if (img_filename == NULL) {
+ fprintf(stderr, "missing image filename\n");
+ return -1;
+ }
+
+ if (parse_template(template))
+ return -1;
+
+ printf("modifying %s\n", img_filename);
+
+ fd = open(img_filename, O_RDWR);
+ if (fd < 0) {
+ perror(img_filename);
+ return -1;
+ }
+
+ printf("re-write label\n");
+ make_labl(fd);
+
+ close(fd);
+
+ return 0;
+}
void
default_template(void)
@@ -745,8 +785,8 @@
} else {
unsigned char b[256*4];
- printf("extracting partition '%s' from %s\n",
- part_name, filename);
+ printf("extracting partition '%s' at %o from %s\n",
+ part_name, offset, filename);
fd_out = open(extract_filename, O_RDWR|O_CREAT, 0666);
if (fd_out < 0) {
@@ -776,6 +816,7 @@
fprintf(stderr, "usage:\n");
fprintf(stderr, "-p show existing disk image\n");
fprintf(stderr, "-c create new disk image\n");
+ fprintf(stderr, "-l rewrite label\n");
fprintf(stderr, "-t <template-filename>\n");
fprintf(stderr, "-f <disk-image-filename>\n");
fprintf(stderr, "-x <partition-name>\n");
@@ -794,7 +835,7 @@
if (argc <= 1)
usage();
- while ((c = getopt(argc, argv, "cdt:f:pm:x:")) != -1) {
+ while ((c = getopt(argc, argv, "cdlt:f:pm:x:")) != -1) {
switch (c) {
case 'c':
create++;
@@ -815,6 +856,10 @@
part_name = strdup(optarg);
modify++;
break;
+
+ case 'l':
+ label++;
+ break;
case 'x':
part_name = strdup(optarg);
extract++;
@@ -844,5 +889,9 @@
extract_partition(img_filename, part_name, part_name);
}
+ if (label) {
+ modify_labl(template_filename, img_filename);
+ }
+
exit(0);
}
Added: trunk/emulator/usim/ether.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/emulator/usim/ether.c Thu Sep 22 17:52:29 2011 (r296)
@@ -0,0 +1,313 @@
+/*
+ * ether.c
+ *
+ * simple CADR2 ethernet simulation, register definitions are for the
+ * OpenCores ethernet controller.
+ *
+ * $Id$
+ */
+
+#include "usim.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#if defined(LINUX) || defined(OSX) || defined(BSD)
+#include <sys/time.h>
+#endif
+
+#if defined(BSD)
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_tap.h>
+#include <net/if_ether.h>
+
+int tap_fd;
+#endif
+
+struct ether_desc {
+ uint16_t status;
+ uint16_t len;
+ uint32_t ptr;
+};
+
+#define ETHER_DESC_TX_READY (1 << 15)
+#define ETHER_DESC_TX_IRQ (1 << 14)
+#define ETHER_DESC_TX_WRAP (1 << 13)
+#define ETHER_DESC_TX_PAD (1 << 12)
+#define ETHER_DESC_TX_CRC (1 << 11)
+
+#define ETHER_DESC_RX_EMPTY (1 << 15)
+#define ETHER_DESC_RX_IRQ (1 << 14)
+#define ETHER_DESC_RX_WRAP (1 << 13)
+
+#define ETHER_INT_RXC (1 << 6)
+#define ETHER_INT_TXC (1 << 5)
+#define ETHER_INT_BUSY (1 << 4)
+#define ETHER_INT_RXE (1 << 3)
+#define ETHER_INT_RXB (1 << 2)
+#define ETHER_INT_TXE (1 << 1)
+#define ETHER_INT_TXB (1 << 0)
+
+#define ETHER_MODE_RECSMALL (1 << 16)
+#define ETHER_MODE_PAD (1 << 15)
+#define ETHER_MODE_HUGEN (1 << 14)
+#define ETHER_MODE_CRCEN (1 << 13)
+#define ETHER_MODE_DLYCRCEN (1 << 12)
+#define ETHER_MODE_FULLD (1 << 10)
+#define ETHER_MODE_EXDFREN (1 << 9)
+#define ETHER_MODE_NOBCKOF (1 << 8)
+#define ETHER_MODE_LOOPBCK (1 << 7)
+#define ETHER_MODE_IFG (1 << 6)
+#define ETHER_MODE_PRO (1 << 5)
+#define ETHER_MODE_IAM (1 << 4)
+#define ETHER_MODE_BRO (1 << 3)
+#define ETHER_MODE_NOPRE (1 << 2)
+#define ETHER_MODE_TXEN (1 << 1)
+#define ETHER_MODE_RXEN (1 << 0)
+
+struct ether_descs {
+ union {
+ uint32_t _desc_array[256];
+ struct ether_desc _desc_structs[128];
+ } ed_u;
+};
+
+#define desc_array ed_u._desc_array
+#define desc_structs ed_u._desc_structs
+
+struct ether_descs descs;
+
+uint32_t moder, int_source, int_mask, ipgt, ipgr1, ipgr2, packetlen;
+uint32_t collconf, tx_bd_num, ctrlmoder, miimoder, miicommand;
+uint32_t miiaddress, miitx_data, miirx_data, miistatus;
+uint8_t eaddr[6];
+uint32_t hash0, hash1, txctrl;
+uint32_t packet[375];
+int enabled;
+
+extern void assert_xbus_interrupt(void);
+void set_hwaddr(void);
+
+int
+ether_init(void)
+{
+#ifdef BSD
+ int one = 1;
+ struct ifreq ifr;
+ int s;
+#endif
+ moder = 0x0000a000;
+ int_source = 0x0;
+ int_mask = 0x0;
+ ipgt = 0x12;
+ ipgr1 = 0x0c;
+ ipgr2 = 0x12;
+ packetlen = 0x00400600;
+ collconf = 0x000f003f;
+ tx_bd_num = 0x00000040;
+ miimoder = 0x64;
+ enabled = 0;
+
+#ifdef BSD
+ if (geteuid() != 0) {
+ printf("Not root, ethernet disabled\n");
+ return -1;
+ }
+
+ if ((tap_fd = open("/dev/tap", O_RDWR)) < 0) {
+ fprintf(stderr, "Couldn't open tap: %s\n", strerror(errno));
+ return -1;
+ }
+
+ ioctl(tap_fd, FIONBIO, &one);
+ enabled = 1;
+
+ memset(&ifr, 0, sizeof(ifr));
+ if (ioctl(tap_fd, TAPGIFNAME, &ifr) == -1) {
+ fprintf(stderr, "Could not get interface name\n");
+ }
+
+ s = socket(PF_LINK, SOCK_DGRAM, 0);
+
+ if (ioctl(s, SIOCGIFFLAGS, &ifr) == -1) {
+ fprintf(stderr, "Could not get interface flags\n");
+ }
+
+ if ((ifr.ifr_flags & IFF_UP) == 0) {
+ ifr.ifr_flags |= IFF_UP;
+
+ if (ioctl(s, SIOCSIFFLAGS, &ifr) == -1) {
+ fprintf(stderr, "Could not set IFF_UP\n");
+ }
+ }
+
+ close(s);
+#endif
+ return 0;
+}
+
+void
+ether_poll(void)
+{
+ int i, j, words;
+ uint16_t status;
+ uint32_t ptr, crc;
+ size_t len;
+ ssize_t ret;
+
+ if (enabled) {
+
+ if (moder & ETHER_MODE_TXEN) {
+ for (i = 0; i < tx_bd_num; i++) {
+ status = descs.desc_structs[i].status;
+ if (status & ETHER_DESC_TX_READY) {
+ len = (size_t) descs.desc_structs[i].len;
+ ptr = descs.desc_structs[i].ptr;
+ words = (len + 3) >> 2;
+ for (j = 0; j < words; j++) {
+ read_phy_mem(ptr + j, &packet[j]);
+ }
+ if (status & ETHER_DESC_TX_PAD)
+ len = MAX(len, 60);
+
+ ret = write(tap_fd, packet, len);
+ if (ret != len) {
+ perror("write");
+ }
+
+ status &= ~ETHER_DESC_TX_READY;
+ descs.desc_structs[i].status = status;
+
+ if (status & ETHER_DESC_TX_IRQ)
+ int_source |= ETHER_INT_TXB;
+ }
+
+ if (status & ETHER_DESC_TX_WRAP) break;
+ }
+ }
+
+ if (moder & ETHER_MODE_RXEN) {
+ for (i = tx_bd_num; i < 0x80; i++) {
+ status = descs.desc_structs[i].status;
+ if (status & ETHER_DESC_RX_EMPTY) {
+ len = read(tap_fd, packet, sizeof(packet));
+ if (len == -1) break;
+
+ ptr = descs.desc_structs[i].ptr;
+ descs.desc_structs[i].len = (uint16_t) len;
+ words = (len + 3) >> 2;
+ for (j = 0; j < words; j++) {
+ write_phy_mem(ptr + j, packet[j]);
+ }
+
+ status &= ~ETHER_DESC_RX_EMPTY;
+ descs.desc_structs[i].status = status;
+
+ if (status & ETHER_DESC_RX_IRQ)
+ int_source |= ETHER_INT_RXB;
+ }
+
+ if (status & ETHER_DESC_RX_WRAP) break;
+ }
+ }
+#if 0
+ if (int_source & int_mask)
+ assert_xbus_interrupt();
+#endif
+ }
+}
+
+int
+ether_xbus_reg_read(int offset, unsigned int *pv)
+{
+ /*printf("ether register read, offset %o\n", offset);*/
+
+ switch (offset) {
+ case 0: *pv = moder; break;
+ case 1: *pv = int_source; break;
+ case 2: *pv = int_mask; break;
+ case 3: *pv = ipgt; break;
+ case 4: *pv = ipgr1; break;
+ case 5: *pv = ipgr2; break;
+ case 6: *pv = packetlen; break;
+ case 7: *pv = collconf; break;
+ case 8: *pv = tx_bd_num; break;
+ case 9: *pv = ctrlmoder; break;
+ case 10: *pv = miimoder; break;
+ case 11: *pv = miicommand; break;
+ case 12: *pv = miiaddress; break;
+ case 13: *pv = miitx_data; break;
+ case 14: *pv = miirx_data; break;
+ case 15: *pv = miistatus; break;
+ case 16: *pv = ((eaddr[2] << 24) | (eaddr[3] << 16) |
+ (eaddr[4] << 8) | eaddr[5]); break;
+ case 17: *pv = ((eaddr[0] << 8) | eaddr[1]); break;
+ case 18: *pv = hash0; break;
+ case 19: *pv = hash1; break;
+ case 20: *pv = txctrl; break;
+ default: *pv = 0; break;
+ }
+ return 0;
+}
+
+int
+ether_xbus_reg_write(int offset, unsigned int v)
+{
+ /*printf("ether register write, offset %o, v %o\n", offset, v);*/
+ switch (offset) {
+ case 0: moder = v; break;
+ case 1: int_source ^= v; break;
+ case 2: int_mask = v; break;
+ case 3: ipgt = v; break;
+ case 4: ipgr1 = v; break;
+ case 5: ipgr2 = v; break;
+ case 6: packetlen = v; break;
+ case 7: collconf = v; break;
+ case 8: tx_bd_num = v; break;
+ case 9: ctrlmoder = v; break;
+ case 10: miimoder = v; break;
+ case 11: miicommand = v; break;
+ case 12: miiaddress = v; break;
+ case 13: miitx_data = v; break;
+ case 16:
+ eaddr[2] = (v >> 24) & 0xff;
+ eaddr[3] = (v >> 16) & 0xff;
+ eaddr[4] = (v >> 8) & 0xff;
+ eaddr[5] = v & 0xff;
+ break;
+ case 17:
+ eaddr[0] = (v >> 8) & 0xff;
+ eaddr[1] = v & 0xff;
+ break;
+ case 18: hash0 = v; break;
+ case 19: hash1 = v; break;
+ case 20: txctrl = v; break;
+ default: break;
+ }
+ return 0;
+}
+
+int
+ether_xbus_desc_read(int offset, unsigned int *pv)
+{
+
+ /*printf("ether desc read, offset %o\n", offset);*/
+ *pv = descs.desc_array[offset];
+ return 0;
+}
+
+int
+ether_xbus_desc_write(int offset, unsigned int v)
+{
+
+ /*printf("ether desc write, offset %o, v %o\n", offset, v);*/
+ descs.desc_array[offset] = v;
+ return 0;
+}
Modified: trunk/emulator/usim/iob.c
==============================================================================
--- trunk/emulator/usim/iob.c Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/iob.c Thu Sep 22 17:52:29 2011 (r296)
@@ -13,7 +13,7 @@
#include <string.h>
#include <signal.h>
-#if defined(LINUX) || defined(OSX)
+#if defined(LINUX) || defined(OSX) || defined(BSD)
#include <sys/time.h>
#endif
Modified: trunk/emulator/usim/main.c
==============================================================================
--- trunk/emulator/usim/main.c Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/main.c Thu Sep 22 17:52:29 2011 (r296)
@@ -13,7 +13,7 @@
#include <stdlib.h>
#include <signal.h>
-#if defined(LINUX) || defined(OSX)
+#if defined(LINUX) || defined(OSX) || defined(BSD)
#include <unistd.h>
#include <sys/time.h>
#endif
@@ -43,6 +43,7 @@
extern int read_sym_files(void);
extern int iob_init(void);
extern int chaos_init(void);
+extern int ether_init(void);
extern void iob_warm_boot_key(void);
extern void run(void);
@@ -165,7 +166,7 @@
show_video_flag = 1;
mouse_sync_flag = 1;
- while ((c = getopt(argc, argv, "ab:c:dC:i:l:nmp:q:tT:sSw")) != -1) {
+ while ((c = getopt(argc, argv, "ab:B:c:dC:i:l:nmp:q:tT:sSw")) != -1) {
switch (c) {
case 'a':
alt_prom_flag = 1;
@@ -173,6 +174,9 @@
case 'b':
breakpoint_set_mcr(optarg);
break;
+ case 'B':
+ begin_trace_cycle = atol(optarg);
+ break;
case 'c':
max_cycles = atol(optarg);
break;
@@ -208,6 +212,7 @@
break;
case 'T':
switch (optarg[0]) {
+ case 'a': trace_after_flag = 1; break;
case 'd': trace_disk_flag = 1; break;
case 'i': trace_int_flag = 1; break;
case 'o': trace_io_flag = 1; break;
@@ -216,6 +221,7 @@
case 'm': trace_mcr_labels_flag = 1; break;
case 'n': trace_net_flag = 1; break;
case 'l': trace_lod_labels_flag = 1; break;
+ case 'v': trace_vm_flag = 1; break;
}
break;
case 's':
@@ -242,6 +248,7 @@
iob_init();
chaos_init();
+ ether_init();
#if 0
show_prom();
Added: trunk/emulator/usim/template.disk9
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/emulator/usim/template.disk9 Thu Sep 22 17:52:29 2011 (r296)
@@ -0,0 +1,30 @@
+#
+# Trident T-300
+# with very small FILE dir
+#
+output:
+disk.img
+#
+label:
+cyls 825
+heads 19
+blockspertrack 17
+mcr MCR1
+lod LOD2
+#brand ""
+#text ""
+comment ucadr.mcr.841
+#
+partitions:
+MCR1 021 0224 ucadr.mcr.841
+MCR2 0245 0224 nil.mcr.6
+MCR3 0471 0224
+MCR4 0715 0224
+PAGE 01141 0100000
+LOD1 0101141 061400 partition-78.50-LOD1
+LOD2 0162541 061400 LOD2
+LOD3 0244141 061400
+LOD4 0325541 061400
+FILE 0407141 0400000 FILE
+
+
Added: trunk/emulator/usim/uart.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/emulator/usim/uart.c Thu Sep 22 17:52:29 2011 (r296)
@@ -0,0 +1,38 @@
+/*
+ * uart.c
+ *
+ * $Id$
+ */
+
+#include "usim.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+extern int trace;
+
+int
+uart_xbus_read(int offset, unsigned int *pv)
+{
+ *pv = 0;
+ return 0;
+}
+
+int
+uart_xbus_write(int offset, unsigned int v)
+{
+
+ if (offset == 0) {
+ putc(v, stdout);
+ fflush(stdout);
+ } else if (offset == 1) {
+ trace = v;
+ }
+ return 0;
+}
Modified: trunk/emulator/usim/ucode.c
==============================================================================
--- trunk/emulator/usim/ucode.c Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/ucode.c Thu Sep 22 17:52:29 2011 (r296)
@@ -57,6 +57,7 @@
unsigned long trace_cycles;
unsigned long max_cycles;
unsigned long max_trace_cycles;
+unsigned long begin_trace_cycle;
static int u_pc;
static int page_fault_flag;
@@ -108,6 +109,7 @@
int trace_net_flag;
int trace_int_flag;
int trace_late_set;
+int trace_after_flag;
static int macro_pc_incrs;
@@ -130,6 +132,15 @@
extern int disk_xbus_write(int offset, unsigned int v);
extern int tv_xbus_read(int offset, unsigned int *pv);
extern int tv_xbus_write(int offset, unsigned int v);
+#ifdef CADR2
+extern int ether_xbus_reg_read(int, unsigned int *);
+extern int ether_xbus_reg_write(int, unsigned int);
+extern int ether_xbus_desc_read(int, unsigned int *);
+extern int ether_xbus_desc_write(int, unsigned int);
+extern void ether_poll();
+extern int uart_xbus_read(int, unsigned int *);
+extern int uart_xbus_write(int, unsigned int);
+#endif
extern void disassemble_ucode_loc(int loc, ucw_t u);
extern int sym_find(int mcr, char *name, int *pval);
@@ -492,6 +503,7 @@
video_read(offset, pv);
return 0;
}
+ /* Extra xbus devices */
if (pn == 037764) {
offset <<= 1;
@@ -522,16 +534,40 @@
/*int paddr = pn << 10;*/
/*
- * 77377774 disk
- * 77377760 tv
+ * 17377774 disk
+ * 17377760 tv
*/
if (offset >= 0370)
return disk_xbus_read(offset, pv);
if (offset == 0360)
return tv_xbus_read(offset, pv);
+
+ printf("xbus read %o %o\n", offset, vaddr);
+ *pv = 0;
+ return 0;
+ }
+
+#ifdef CADR2
+ if (pn == 036774) {
+ /*
+ * 17376000 ethernet registers
+ */
+ return ether_xbus_reg_read(offset, pv);
}
+ if (pn == 036775) {
+ /*
+ * 17376400 ethernet descriptors
+ */
+ return ether_xbus_desc_read(offset, pv);
+ }
+
+ if (pn == 036776) {
+ return uart_xbus_read(offset, pv);
+ }
+#endif
+
if ((page = phy_pages[pn]) == 0) {
/* page fault */
page_fault_flag = 1;
@@ -713,8 +749,29 @@
if (offset == 0360)
return tv_xbus_write(offset, v);
+
+ }
+
+#ifdef CADR2
+ if (pn == 036774) {
+ /*
+ * 17377000 ethernet
+ */
+ return ether_xbus_reg_write(offset, v);
+ }
+
+ if (pn == 036775) {
+ /*
+ * 17376000 ethernet descs
+ */
+ return ether_xbus_desc_write(offset, v);
}
+ if (pn == 036776) {
+ return uart_xbus_write(offset, v);
+ }
+#endif
+
#if 1
/* catch questionable accesses */
if (pn >= 036000) {
@@ -1969,6 +2026,9 @@
if ((cycles & 0x0ffff) == 0) {
display_poll();
chaos_poll();
+#ifdef CADR2
+ ether_poll();
+#endif
}
#define FETCH() (prom_enabled_flag ? prom_ucode[u_pc] : ucode[u_pc])
@@ -2122,6 +2182,9 @@
break;
}
+ if (trace_after_flag && (cycles > begin_trace_cycle))
+ trace = 1;
+
i_long = (u >> 45) & 1;
popj = (u >> 42) & 1;
Modified: trunk/emulator/usim/ucode.h
==============================================================================
--- trunk/emulator/usim/ucode.h Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/ucode.h Thu Sep 22 17:52:29 2011 (r296)
@@ -3,7 +3,7 @@
* $Id$
*/
-#if defined(LINUX) || defined(OSX)
+#if defined(LINUX) || defined(OSX) || defined(BSD)
typedef long long int64;
typedef unsigned long long uint64;
@@ -56,10 +56,12 @@
extern int trace_mcr_flag;
extern int stop_after_prom_flag;
extern int alt_prom_flag;
+extern int trace_after_flag;
extern unsigned long cycles;
extern unsigned long max_cycles;
extern unsigned long max_trace_cycles;
+extern unsigned long begin_trace_cycle;
extern char *sym_find_by_val(int mcr, int v);
extern char *sym_find_last(int mcr, int v, int *poffset);
Modified: trunk/emulator/usim/usim.h
==============================================================================
--- trunk/emulator/usim/usim.h Thu Aug 18 12:44:05 2011 (r295)
+++ trunk/emulator/usim/usim.h Thu Sep 22 17:52:29 2011 (r296)
@@ -11,6 +11,10 @@
#define OSX
#endif
+#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+#define BSD
+#endif
+
void assert_unibus_interrupt(int vector);
void assert_xbus_interrupt(void);
void deassert_xbus_interrupt(void);
More information about the mit-cadr-cvs
mailing list