Subject: Re: svr4 compat on 1.5X Aug 29
To: MOCHIDA Shuji <mochid@netside.co.jp>
From: Jaromír <jdolecek@netbsd.org>
List: port-i386
Date: 10/01/2001 20:55:43
--ELM710578780-1404-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII

Looking at the file, I've spotted something which could be the reason
why. Can you try if appended patch fixes this?

Jaromir

MOCHIDA Shuji wrote:
> 
> >> Netscape 4.75 for Solaris x86 (navigator-v475-us.x86-sun-solaris2.5.1.tar.gz)
> >> make kernel drop into debugger. The kernel compiled from "current" source 
> >> supped at yesterday. On 1.5.1 kernel, 1.5W supped at Jun 5 kernel both 
> >> netscape works without problem, no "unknown svr4 fast trap 2" line appears.
> 
> > Fast trap 2 is "set emulated floating point context" which we don't implement.
> > I wonder what broke and you are getting this.
> 
>  I compiled many kernels, and found that 'cvs update -D 2001-06-18' one
> works good, 'cvs update -D "2001-06-18 10:00"' one does not. I can't tell
> the cause exactly, but it seems that is related to the change:
> 
>     http://mail-index.netbsd.org/source-changes/2001/06/18/0000.html
> 
> 
> | Committed By:   sommerfeld
> | Date:           Sun Jun 17 21:01:39 UTC 2001
> | 
> | Modified Files:
> |         syssrc/sys/arch/i386/i386: compat_13_machdep.c db_interface.c
> |             db_trace.c genassym.cf ibcs2_machdep.c ibcs2_sigcode.s ipkdb_glue.c
> |             kgdb_machdep.c linux_sigcode.s locore.s machdep.c process_machdep.c
> |             svr4_machdep.c svr4_sigcode.s sys_machdep.c trap.c
> |         syssrc/sys/arch/i386/include: db_machdep.h frame.h pcb.h
> |         syssrc/sys/compat/linux/arch/i386: linux_machdep.c
> | 
> | Log Message:
> | Add %fs/%gs to trap frame and save/restore them on
> | trap/interrupt/syscall entry from userspace.
> | 
> | Remove special-case "by hand" validation of fs/gs register values as
> | well as special handling of them in various signal handling paths.
> | 
> | Now, like %ds and %es, they are validated by the hardware on return to
> | userland.
> | 
> | This paves the way for the use of %fs for per-cpu data on
> | multiprocessor systems, and fixes an otherwise difficult-to-fix
> | interaction between threads/clone(2) and USER_LDT.
> | 
> | Discussed in advance with Frank van der Linden.
> 
> 
> >> % netscape -display xxx:0
> >> unknown svr4 fast trap 2
> >> unknown svr4 fast trap 2
> >> uknknown svr4 faste trap 2
> >> rnel: type 1216652891 trap, code=0
> >> Stopped in pid 295 (netscape) at             0x296:     invalid address
> >> db> t
> >> param.c(867a118,867a018,0,0,ffffffff) at      0x296
> >> Bad user frame pointer: 0x867a090
> >> db> ps
> >>  PID             PPID       PGRP        UID S   FLAGS          COMMAND    WAIT
> >>  298              295        295       7011 3  0x4086         netscape  select
> >> >295              282        295       7011 7  0x4006         netscape
> >>  285                1        285          0 3  0x4086            getty   ttyin
> 
> 
> -mochid
> 


-- 
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!

--ELM710578780-1404-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-2
Content-Disposition: attachment; filename=svr4i386.diff

Index: svr4_machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/i386/svr4_machdep.c,v
retrieving revision 1.55
diff -u -p -r1.55 svr4_machdep.c
--- svr4_machdep.c	2001/08/03 00:41:46	1.55
+++ svr4_machdep.c	2001/10/01 18:54:41
@@ -232,7 +232,8 @@ svr4_setmcontext(p, mc, flags)
 		    !USERMODE(r[SVR4_X86_CS], r[SVR4_X86_EFL]))
 			return (EINVAL);
 
-		/* %fs and %gs were restored by the trampoline. */
+		tf->tf_gs = r[SVR4_X86_GS];
+		tf->tf_fs = r[SVR4_X86_FS];
 		tf->tf_es = r[SVR4_X86_ES];
 		tf->tf_ds = r[SVR4_X86_DS];
 #ifdef VM86

--ELM710578780-1404-0_--