From dburr@donaldburr.dyn.ml.org  Fri Aug 22 01:37:52 1997
Received: from DonaldBurr.DonaldBurr.dyn.ml.org (ppp10190.la.inreach.net [206.18.112.190])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id BAA25737
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 22 Aug 1997 01:37:49 -0700 (PDT)
Received: (from dburr@localhost)
	by DonaldBurr.DonaldBurr.dyn.ml.org (8.8.5/8.8.5) id BAA02962;
	Fri, 22 Aug 1997 01:38:17 -0700 (PDT)
Message-Id: <199708220838.BAA02962@DonaldBurr.DonaldBurr.dyn.ml.org>
Date: Fri, 22 Aug 1997 01:38:17 -0700 (PDT)
From: Donald Burr <dburr@donaldburr.dyn.ml.org>
Reply-To: dburr@POBoxes.com
To: FreeBSD-gnats-submit@freebsd.org
Cc: executor@ardi.com, questions@ardi.com, ctm@ardi.com
Subject: Executor does not work with sound configured into kernel, must use 'nosound' (other sound apps work)
X-Send-Pr-Version: 3.2

>Number:         4355
>Category:       kern
>Synopsis:       Executor does not work with sound configured into kernel, must use 'nosound' (other sound apps work)
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 22 01:40:02 PDT 1997
>Closed-Date:    Tue Oct 28 02:51:38 PST 1997
>Last-Modified:  Tue Oct 28 02:56:41 PST 1997
>Originator:     Donald Burr
>Release:        FreeBSD 2.2.2-RELEASE i386
>Organization:
Starfleet Command
>Environment:

dmesg output:
Copyright (c) 1992-1997 FreeBSD Inc.
Copyright (c) 1982, 1986, 1989, 1991, 1993
	The Regents of the University of California.  All rights reserved.

FreeBSD 2.2.2-RELEASE #0: Wed Aug 20 19:56:33 PDT 1997
    root@DonaldBurr.DonaldBurr.dyn.ml.org:/usr/src/sys/compile/DONALDBURR
CPU: AMD Am5x86 Write-Back (486-class CPU)
  Origin = "AuthenticAMD"  Id = 0x4f4  Stepping=4
  Features=0x1<FPU>
real memory  = 33554432 (32768K bytes)
avail memory = 30371840 (29660K bytes)
Probing for devices on PCI bus 0:
chip0 <SiS 85c496> rev 2 on pci0:5
vga0 <VGA-compatible display device> rev 71 on pci0:11
ahc0 <Adaptec 2940A Ultra SCSI host adapter> rev 1 int a irq 11 on pci0:13
ahc0: aic7860 Single Channel, SCSI Id=7, 3/8 SCBs
ahc0 waiting for scsi devices to settle
ahc0: target 0 Tagged Queuing Device
(ahc0:0:0): "iomega jaz 1GB H.72" type 0 removable SCSI 2
sd0(ahc0:0:0): Direct-Access 
sd0(ahc0:0:0): ILLEGAL REQUEST asc:24,0 Invalid field in CDB
sd0 could not mode sense (4). Using ficticious geometry
1021MB (2091050 512 byte sectors)
(ahc0:1:0): "NEC CD-ROM DRIVE:462 1.16" type 5 removable SCSI 2
cd0(ahc0:1:0): CD-ROM cd present [328355 x 2048 byte records]
ed1 <NE2000 PCI Ethernet (RealTek 8029)> rev 0 int a irq 9 on pci0:15
ed1: address 00:00:b4:5a:4e:71, type NE2000 (16 bit) 
Probing for devices on the ISA bus:
sc0 at 0x60-0x6f irq 1 on motherboard
sc0: VGA color <12 virtual consoles, flags=0x0>
ed0: disabled, not probed.
lpt0 at 0x378-0x37f irq 7 on isa
lpt0: Interrupt-driven port
lp0: TCP/IP capable interface
sio0 at 0x3f8-0x3ff irq 4 on isa
sio0: type 16550A
sio1 at 0x2f8-0x2ff irq 3 on isa
sio1: type 16550A
sio2 at 0x3e8-0x3ef irq 5 on isa
sio2: type 16550A
wdc0 at 0x1f0-0x1f7 irq 14 flags 0x80ff80ff on isa
wdc0: unit 0 (wd0): <ST51080A>, 32-bit, multi-block-32
wd0: 1033MB (2116800 sectors), 2100 cyls, 16 heads, 63 S/T, 512 B/S
wdc1 at 0x170-0x177 irq 15 flags 0x80ff80ff on isa
wdc1: unit 0 (wd2): <Maxtor 7245 AT>, 32-bit, multi-block-32
wd2: 234MB (479632 sectors), 967 cyls, 16 heads, 31 S/T, 512 B/S
fdc0 at 0x3f0-0x3f7 irq 6 drq 2 on isa
fdc0: NEC 72065B
fd0: 1.44MB 3.5in
npx0 on motherboard
npx0: INT 16 interface
sb0 at 0x220 irq 10 drq 1 on isa
sb0: <SoundBlaster Pro 3.2>
opl0 at 0x388 on isa
opl0: <Yamaha OPL-3 FM>

/dev/sndstat output:
VoxWare Sound Driver:3.0-beta-950506 (Sun Feb 5 14:38:12 EST 1995 freebsd-hackers@freefall.cdrom.com)
Config options: ffffffff

Installed drivers: 
Type 1: OPL-2/OPL-3 FM
Type 2: SoundBlaster


Card config: 
SoundBlaster at 0x220 irq 10 drq 1
OPL-2/OPL-3 FM at 0x388 irq 65535 drq 4294967295

Audio devices:
0: SoundBlaster Pro 3.2

Synth devices:
0: Yamaha OPL-3

Midi devices:
0: SoundBlaster

Timers:
0: System Timer

Mixers:
0: SoundBlaster


kernel config: (only appropriate entries included)
controller	snd0
device sb0      at isa? port 0x220 irq 10 drq 1 vector sbintr
device opl0 at isa? port 0x388
options		COMPAT_LINUX

Executor version: (executor -info output)
This is Executor 2.0m, compiled Sun Jul 13 23:38:32 MDT 1997.
CPU type is 80486 or better.
Choosing 2.00 MB for applzone, 0.50 MB for syszone, 0.25 MB for stack

>Description:

Executor crashes and burns when FreeBSD sound support is compiled in, unless you use the
-nosound flag.  Other Linux binaries that use sound (e.g. MAME arcade machine emulator, etc.)
work fine.

Errors that appear on the terminal:
linux-sound.c:339; fatal error in `sound_linux_init': Couldn't get semaphore
Segmentation fault

Errors in syslog:
Aug 22 01:16:08 DonaldBurr /kernel: pid 2244 (executor), uid 0: exited on signal 11

>How-To-Repeat:

Grab Executor (a free demo is available at http://www.ardi.com/) and run it WITHOUT
using -nosound, on a FreeBSD kernel that has sound support compiled in.

>Fix:
	
Use -nosound, or do not configure a kernel with sound support.
>Release-Note:
>Audit-Trail:

From: KATO Takenori <kato@migmatite.eps.nagoya-u.ac.jp>
To: freebsd-gnats-submit@freebsd.org, dburr@donaldburr.dyn.ml.org
Cc:  Subject: Re: kern/4355: Executor does not work with sound configured into kernel,
	 must use 'nosound' (other sound apps work) 
Date: Sat, 25 Oct 1997 23:19:26 +0900

 > Executor crashes and burns when FreeBSD sound support is compiled in,
 > unless you use the -nosound flag.  Other Linux binaries that use sound
 > (e.g. MAME arcade machine emulator, etc.) work fine.
 > 
 > Errors that appear on the terminal:
 > linux-sound.c:339; fatal error in `sound_linux_init': Couldn't get semaphore
 > Segmentation fault
 
 Executor cannot get SysV semaphore because linux_semget is not
 implemented.  Patch included adds SysV semaphore support in linux
 emulator, and executor works without -nosound option.  But, sound
 stuff of executor doesn't work because `clone' systemcall is not
 implemented.
 
 ---------- BEGIN ----------
 *** linux_ipc.c.ORIG	Sat Oct 25 23:18:43 1997
 --- linux_ipc.c	Sat Oct 25 22:20:00 1997
 ***************
 *** 130,148 ****
   static int
   linux_semop(struct proc *p, struct linux_ipc_args *args, int *retval)
   {
 !     return ENOSYS;
   }
   
   static int
   linux_semget(struct proc *p, struct linux_ipc_args *args, int *retval)
   {
 !     return ENOSYS;
   }
   
   static int
   linux_semctl(struct proc *p, struct linux_ipc_args *args, int *retval)
   {
 !     return ENOSYS;
   }
   
   static int
 --- 130,180 ----
   static int
   linux_semop(struct proc *p, struct linux_ipc_args *args, int *retval)
   {
 ! 	struct semop_args /* {
 ! 	int	semid;
 ! 	struct	sembuf *sops;
 ! 	int		nsops;
 ! 	} */ bsd_args;
 ! 
 ! 	bsd_args.semid = args->arg1;
 ! 	bsd_args.sops = (struct sembuf *)args->ptr;
 ! 	bsd_args.nsops = args->arg2;
 ! 	return semop(p, &bsd_args, retval);
   }
   
   static int
   linux_semget(struct proc *p, struct linux_ipc_args *args, int *retval)
   {
 ! 	struct semget_args /* {
 ! 	key_t	key;
 ! 	int		nsems;
 ! 	int		semflg;
 ! 	} */ bsd_args;
 ! 
 ! 	bsd_args.key = args->arg1;
 ! 	bsd_args.nsems = args->arg2;
 ! 	bsd_args.semflg = args->arg3;
 ! 	return semget(p, &bsd_args, retval);
   }
   
   static int
   linux_semctl(struct proc *p, struct linux_ipc_args *args, int *retval)
   {
 ! 	struct __semctl_args /* {
 ! 	int		semid;
 ! 	int		semnum;
 ! 	int		cmd;
 ! 	union	semun *arg;
 ! 	} */ bsd_args;
 ! 	int	error;
 ! 
 ! 	bsd_args.semid = args->arg1;
 ! 	bsd_args.semnum = args->arg2;
 ! 	bsd_args.cmd = args->arg3;
 ! 	error = copyin(args->ptr, (caddr_t)bsd_args.arg, sizeof(bsd_args.arg));
 ! 	if (error)
 ! 		return error;
 ! 	return __semctl(p, &bsd_args, retval);
   }
   
   static int
 ---------- END ----------
 
 
 ----
 KATO Takenori <kato@ganko.eps.nagoya-u.ac.jp>
 Dept. Earth Planet. Sci., Nagoya Univ.,  Nagoya, 464-01, Japan
 PGP public key: finger kato@eclogite.eps.nagoya-u.ac.jp
 ------------------- Powered by FreeBSD(98) -------------------
State-Changed-From-To: open->closed 
State-Changed-By: kato 
State-Changed-When: Tue Oct 28 02:51:38 PST 1997 
State-Changed-Why:  

linux_semop, linux_semget and linux_semctl are implemented in linux_ipc.c 
revision 1.11.  Executor now runs without `nosound' option.  But, sound 
does not work until `linux_clone' systemcall is implemented. 
>Unformatted:
