Subject: Re: OK, so netscape 2.0 beta 2 breaks SUNOS_COMPAT. What now?
To: None <port-sparc@NetBSD.ORG>
From: Greg Earle <earle@isolar.Tujunga.CA.US>
List: port-sparc
Date: 11/14/1995 11:56:42
David Miller gave me an excellent suggestion:
>    So Neil and Matthew confirmed that netscape 2.0beta2 breaks SUNOS_COMPAT
>    even on -current.  Sigh.
> 
>  [ ... ]
> 
>    I'm willing to put some sweat into it, if I only knew where to start.  All
>    "kdump" tells us is that it croaks, which I already knew.  :-)
> 
> One thing you could do is the following.  Take a look at where the
> signal posting happens in the kernel, specifically, look in
> sys/arch/sparc/sparc/trap.c for the illegal instruction trap
> processing.  In this code insert some printk()'s to show where the PC
> is when the SIGILL is detected, plus whatever else you think is useful.

(But what's a "printk()"???)

So I tried the following little change:

*** usr/src/sys/arch/sparc/sparc/trap.c-1.0	Sat May 21 01:23:04 1994
--- usr/src/sys/arch/sparc/sparc/trap.c	Tue Nov 14 01:01:36 1995
***************
*** 281,282 ****
--- 281,284 ----
  	case T_ILLINST:
+ 		uprintf("%s[pid %d]: Illegal instruction: pc=%x npc=%x psr=%b\n",
+ 		    p->p_comm, p->p_pid, pc, tf->tf_npc, psr, PSR_BITS);
  		trapsignal(p, SIGILL, 0);	/* XXX code?? */
***************
*** 285,286 ****
--- 287,290 ----
  	case T_PRIVINST:
+ 		uprintf("%s[pid %d]: Priviledged instruction: pc=%x npc=%x psr=%b\n",
+ 		    p->p_comm, p->p_pid, pc, tf->tf_npc, psr, PSR_BITS);
  		trapsignal(p, SIGILL, 0);	/* XXX code?? */

Built a new kernel, fired it up, ran Netscape 2.0 beta 2, and ...  nothing.
Got the "Illegal instruction" again, but no diagnostic message anywhere.
Not on the console, not in the window where I fired up Netscape, not in a
log file, etc.

Is there some other pathway it could have followed that wouldn't have gone
through one of these two cases in trap.c???  It seems like psignal() had to
have been called at *some* point; I don't know how it could have happened
without being vectored through the above code in trap().

Also, reading /usr/src/sys/kern/subr_prf.c, I'm confused by all the printf
variants.  Should one use printf(), or uprintf(), or tprintf(), or kprintf()?
I used "uprintf()" here, because the comment says

/*
 * Uprintf prints to the controlling terminal for the current process.

which seemed reasonable for what I was trying to do.

	- Greg