Subject: Re: Solaris emulation and Bentley MicroStation 95
To: Matthias Pfaller <leo@dachau.marco.de>
From: matthew green <mrg@eterna.com.au>
List: port-sparc
Date: 03/11/1997 03:25:50
   A CAD program. The last part of the ktrace log is appended. But can this
   really be an unimplemented system call? It's failing with SIGILL.

oops, sorry.  i mis-read SIGILL as SIGSYS earlier.  hmm.

hmm.  please add this patch to your sparc/sparc/trap.c so that we
can see *which* of the SIGILL's is really the problem.

(note, that this patch attempts to print addresses for failed
register window operations, but that code is non-functional, so,
ignore that info.  someday i'll fix this for myself   :-)


Index: trap.c
===================================================================
RCS file: /local/cvs/src/sys/arch/sparc/sparc/trap.c,v
retrieving revision 1.1.1.19
retrieving revision 1.5
diff -c -r1.1.1.19 -r1.5
*** trap.c	1996/12/20 12:53:07	1.1.1.19
--- trap.c	1996/12/20 22:29:01	1.5
***************
*** 270,275 ****
--- 270,276 ----
  	register int n;
  	char bits[64];
  	u_quad_t sticks;
+ 	int error = 0;
  
  	/* This steps the PC over the trap. */
  #define	ADVANCE (n = tf->tf_npc, tf->tf_pc = n, tf->tf_npc = n + 4)
***************
*** 355,364 ****
--- 356,367 ----
  		break;	/* the work is all in userret() */
  
  	case T_ILLINST:
+ printf("%s[%d]: real T_ILLINST\n", p->p_comm, p->p_pid);
  		trapsignal(p, SIGILL, 0);	/* XXX code?? */
  		break;
  
  	case T_PRIVINST:
+ printf("%s[%d]: real T_PRIVINST\n", p->p_comm, p->p_pid);
  		trapsignal(p, SIGILL, 0);	/* XXX code?? */
  		break;
  
***************
*** 403,413 ****
--- 406,419 ----
  
  	case T_WINOF:
  		if (rwindow_save(p))
+ { printf("%s[%d]: T_WINOF rwindow_save failed\n", p->p_comm, p->p_pid);
  			sigexit(p, SIGILL);
+ }
  		break;
  
  #define read_rw(src, dst) \
  	copyin((caddr_t)(src), (caddr_t)(dst), sizeof(struct rwindow))
+ #define kvtop(a) pmap_extract(&p->p_vmspace->vm_pmap, (vm_offset_t)(a))
  
  	case T_RWRET:
  		/*
***************
*** 425,432 ****
  			printf("%s[%d]: rwindow: pcb<-stack: %x\n",
  				p->p_comm, p->p_pid, tf->tf_out[6]);
  #endif
! 		if (read_rw(tf->tf_out[6], &pcb->pcb_rw[0]))
  			sigexit(p, SIGILL);
  		if (pcb->pcb_nsaved)
  			panic("trap T_RWRET 2");
  		pcb->pcb_nsaved = -1;		/* mark success */
--- 431,441 ----
  			printf("%s[%d]: rwindow: pcb<-stack: %x\n",
  				p->p_comm, p->p_pid, tf->tf_out[6]);
  #endif
! 		if ((error = read_rw(tf->tf_out[6], &pcb->pcb_rw[0])))
! { printf("%s[%d]: T_RWRET read_rw failed: %d (copyin(%lx, %lx))\n",
!   p->p_comm, p->p_pid, error, kvtop(tf->tf_out[6]), kvtop(&pcb->pcb_rw[0]));
  			sigexit(p, SIGILL);
+ }
  		if (pcb->pcb_nsaved)
  			panic("trap T_RWRET 2");
  		pcb->pcb_nsaved = -1;		/* mark success */
***************
*** 448,462 ****
  				p->p_comm, p->p_pid, tf->tf_out[6]);
  #endif
  		write_user_windows();
! 		if (rwindow_save(p) || read_rw(tf->tf_out[6], &pcb->pcb_rw[0]))
  			sigexit(p, SIGILL);
  #ifdef DEBUG
  		if (rwindow_debug)
  			printf("%s[%d]: rwindow: T_WINUF 1: pcb<-stack: %x\n",
  				p->p_comm, p->p_pid, pcb->pcb_rw[0].rw_in[6]);
  #endif
! 		if (read_rw(pcb->pcb_rw[0].rw_in[6], &pcb->pcb_rw[1]))
  			sigexit(p, SIGILL);
  		if (pcb->pcb_nsaved)
  			panic("trap T_WINUF");
  		pcb->pcb_nsaved = -1;		/* mark success */
--- 457,477 ----
  				p->p_comm, p->p_pid, tf->tf_out[6]);
  #endif
  		write_user_windows();
! 		if (rwindow_save(p) || (error = read_rw(tf->tf_out[6], &pcb->pcb_rw[0])))
! { printf("%s[%d]: T_WINUF rwindow_save or read_rw failed: %d (copyin(%lx, %lx))\n",
! p->p_comm, p->p_pid, error, kvtop(tf->tf_out[6]), kvtop(&pcb->pcb_rw[0]));
  			sigexit(p, SIGILL);
+ }
  #ifdef DEBUG
  		if (rwindow_debug)
  			printf("%s[%d]: rwindow: T_WINUF 1: pcb<-stack: %x\n",
  				p->p_comm, p->p_pid, pcb->pcb_rw[0].rw_in[6]);
  #endif
! 		if ((error = read_rw(pcb->pcb_rw[0].rw_in[6], &pcb->pcb_rw[1])))
! { printf("%s[%d]: T_WINUF second read_rw failed: %d (copyin(%lx, %lx))\n",
! p->p_comm, p->p_pid, error, kvtop(pcb->pcb_rw[0].rw_in[6]), kvtop(&pcb->pcb_rw[1]));
  			sigexit(p, SIGILL);
+ }
  		if (pcb->pcb_nsaved)
  			panic("trap T_WINUF");
  		pcb->pcb_nsaved = -1;		/* mark success */
***************
*** 498,503 ****
--- 513,519 ----
  
  	case T_CPDISABLED:
  		uprintf("coprocessor instruction\n");	/* XXX */
+ printf("%s[%d]: T_CPDISABLED\n", p->p_comm, p->p_pid);
  		trapsignal(p, SIGILL, 0);	/* XXX code?? */
  		break;