Modified Supnik emulator for the 11

Steven M. Schultz sms at moe.2bsd.com
Thu Aug 26 08:08:53 AEST 1999


Scott -

	Howdy!

> From: staylor at mrynet.com (S. Akmentins-Teilors)

> Having had absolutely no luck getting the Begemot emulator
> to work under FreeBSD 4.0-CURRENT, I've been modifying the 

	Hmmm, the Begemot emulator is difficult to set up due to an
	inscrutable configfile format but it runs here under BSD/OS 4.0.1
	after making a couple 'tweeks'.

	I wonder if the problems you're having are due to FreeBSD switching
	to ELF.  At one time BSD/OS used a.out also and "P11" built/ran
	just fine - the the OS switched to ELF and P11 would no longer build.
	I had thought simply editing the instab.s would be enough but after
	doing that P11 wouldn't run right at all.

	What I did was add a "-u" option to 'geni' and then regenerate the
	instab.s file ("geni -u ...") _without_ the underscore characters
	present.  The compiler no longer generates leading '_' characters so
	having them in the instab.s file causes problems.  Regenerating 
	and assembling instab.s cleared up all the problems I was having.

	Below are the changes I've made to P11 - some are specific to getting
	the various IOprogs to run under BSD/OS but the changes to geni.c
	are OS independent.

	THe other change I had to make was to 'devices.c' to speed up the
	clock - it's still not right for a PPro-200 but is better than it
	was (the clock was running far too slow, now it's just ~10% too slow).

> And if anyone has managed to get the Begemot emulator
> working on recent FreeBSD-4.0-CURRENT versions, I'd be

	Not FreeBSD but if you're getting bit by the same thing I did earlier
	under another BSD that switched from a.out to ELF the changes below
	may be useful to you.

	Steven Schultz
	sms at moe.2bsd.com

*** ./Utils/geni.c.old	Sat Oct 11 14:01:39 1997
--- ./Utils/geni.c	Thu Aug 19 21:07:56 1999
***************
*** 49,54 ****
--- 49,55 ----
  int 	code;			/* current instruction code */
  int	ccc;			/* current microinstruction count */
  int	coo = -1;		/* what output to generate */
+ int	no_ul = 0;		/* Don't generate leading _ */
  int	profiler_output;
  char	*ul;			/* the undeline character, if needed */
  char	*ofile;			/* output file name */
***************
*** 123,131 ****
  	int	opt;
  
  	set_argv0(argv[0]);
! 	while((opt = getopt(argc, argv, "vmpo:")) != EOF)
  		switch(opt) {
  
  		case 'v':
  			verbose++;
  			break;
--- 124,135 ----
  	int	opt;
  
  	set_argv0(argv[0]);
! 	while((opt = getopt(argc, argv, "uvmpo:")) != EOF)
  		switch(opt) {
  
+ 		case 'u':
+ 			no_ul++;
+ 			break;
  		case 'v':
  			verbose++;
  			break;
***************
*** 275,284 ****
  tab_out_i386as()
  {
  	printf("\t.file\t\"%s\"\n", ifile);
! 	printf("\t.globl\t_instab\n");
  	printf(".text\n");
  	printf("\t.align\t2\n");
! 	printf("_instab:\n");
  	for(code = 0; code < 0x10000; code++) {
  		printf("\t.long\t");
  		for(ccc = 0; ccc < 4; ccc++)
--- 279,288 ----
  tab_out_i386as()
  {
  	printf("\t.file\t\"%s\"\n", ifile);
! 	printf("\t.globl\t%s\n", no_ul ? "instab" : "_instab");
  	printf(".text\n");
  	printf("\t.align\t2\n");
! 	printf("%s:\n", no_ul ? "instab" : "_instab");
  	for(code = 0; code < 0x10000; code++) {
  		printf("\t.long\t");
  		for(ccc = 0; ccc < 4; ccc++)
***************
*** 632,637 ****
--- 636,646 ----
  	switch(coo) {
  
  	case COO_i386as:
+ 		if (no_ul)
+ 			{
+ 			ul = "";
+ 			break;
+ 			}
  	case COO_sun_as:
  	case COO_i386_aout:
  		ul = "_";
*** ./IOProgs/epp_bpf.c.old	Sat Oct 11 14:02:28 1997
--- ./IOProgs/epp_bpf.c	Wed Jun 17 22:16:50 1998
***************
*** 341,347 ****
  			panic("read(bpf): %s", strerror(errno));
  		bpf_ptr = bpf_buf;
  		bpf_end = bpf_buf + ret;
! 		INFO("read_input: bpf_read = %d.\n", ret);
  	}
  
  	/*
--- 341,347 ----
  			panic("read(bpf): %s", strerror(errno));
  		bpf_ptr = bpf_buf;
  		bpf_end = bpf_buf + ret;
! 		info("read_input: bpf_read = %d.\n", ret);
  	}
  
  	/*
***************
*** 351,357 ****
  	bpf_ptr = bpf_ptr + BPF_WORDALIGN(h->bh_hdrlen + h->bh_caplen);
  
  	if(h->bh_caplen < h->bh_datalen) {
! 		INFO("caplen(%lu) < datalen(%lu) ??? - packet dropped.\n", h->bh_caplen, h->bh_datalen);
  		ret = 0;
  	} else {
  		*pbuf = (u_char *)h + h->bh_hdrlen;
--- 351,357 ----
  	bpf_ptr = bpf_ptr + BPF_WORDALIGN(h->bh_hdrlen + h->bh_caplen);
  
  	if(h->bh_caplen < h->bh_datalen) {
! 		info("caplen(%lu) < datalen(%lu) ??? - packet dropped.\n", h->bh_caplen, h->bh_datalen);
  		ret = 0;
  	} else {
  		*pbuf = (u_char *)h + h->bh_hdrlen;
***************
*** 360,366 ****
  
  	*more = bpf_ptr < bpf_end;
  
! 	INFO("read_input: %d. (more=%d)\n", ret, *more);
  
  	return ret;
  }
--- 360,366 ----
  
  	*more = bpf_ptr < bpf_end;
  
! 	info("read_input: %d. (more=%d)\n", ret, *more);
  
  	return ret;
  }
*** ./IOProgs/epp_tun.c.old	Sat Jan 31 02:52:26 1998
--- ./IOProgs/epp_tun.c	Tue Aug 17 19:47:37 1999
***************
*** 13,19 ****
--- 13,21 ----
  # include <sys/ioctl.h>
  # include <sys/select.h>
  # include <net/if.h>
+ #ifndef	__bsdi__
  # include <net/if_var.h>
+ #endif
  # include <net/if_tun.h>
  # include "epp.h"
  # include "../libutil/util.h"
***************
*** 44,50 ****
  	argv += optind;
  
  	if(argc != 3)
! 		panic("need one arg");
  
  	parse_ether(my_ether, argv[1]);
  	parse_ether(other_ether, argv[2]);
--- 46,52 ----
  	argv += optind;
  
  	if(argc != 3)
! 		panic("need two args");
  
  	parse_ether(my_ether, argv[1]);
  	parse_ether(other_ether, argv[2]);
*** ./Config/M-i386-bsdi.old	Sun Oct 12 07:10:03 1997
--- ./Config/M-i386-bsdi	Wed Jun 17 20:50:19 1998
***************
*** 27,33 ****
   * define the cookie for the geni program (look into Utils/geni.c) 
   * If you want geni output an object file (see later) this cookie
   * is used only for the profiler output */
! /* # define MAKE_GENIS */
  # define MAKE_GENIE_COOKIE "i386-as"
  
  /* define command to set data limit to K kilobytes, if you need it */
--- 27,33 ----
   * define the cookie for the geni program (look into Utils/geni.c) 
   * If you want geni output an object file (see later) this cookie
   * is used only for the profiler output */
! # define MAKE_GENIS
  # define MAKE_GENIE_COOKIE "i386-as"
  
  /* define command to set data limit to K kilobytes, if you need it */
***************
*** 43,49 ****
  
  /* if you have the gnu libbfd and liberty you can geni have to output
   * object code instead of C or assembler. You must define the following: */
! # define MAKE_HAVE_LIBBFD
  
  /* if you have it, you may have to set up the right paths. */
  # define MAKE_CC_BFD_INCL 	-I/usr/gnu/include
--- 43,49 ----
  
  /* if you have the gnu libbfd and liberty you can geni have to output
   * object code instead of C or assembler. You must define the following: */
! /* # define MAKE_HAVE_LIBBFD */
  
  /* if you have it, you may have to set up the right paths. */
  # define MAKE_CC_BFD_INCL 	-I/usr/gnu/include
*** ./device.c.old	Sat Oct 11 14:17:24 1997
--- ./device.c	Thu Aug 19 23:05:53 1999
***************
*** 7,14 ****
   * generic device support
   */
  
! # define TINTERVAL	20	/* msecs between clock ticks */
! 
  
  typedef struct Async	Async;
  typedef struct Timer	Timer;
--- 7,14 ----
   * generic device support
   */
  
! # define TINTERVAL	16	/* msecs between clock ticks */
! 				/* Should be 16.666666 for US 60hz */
  
  typedef struct Async	Async;
  typedef struct Timer	Timer;

Received: (from major at localhost)
	by minnie.cs.adfa.edu.au (8.9.3/8.9.3) id IAA33844
	for pups-liszt; Thu, 26 Aug 1999 08:18:19 +1000 (EST)


More information about the TUHS mailing list