NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-vax/51761: SCSI gets stuck on VAXstation 4000

The following reply was made to PR port-vax/51761; it has been noted by GNATS.

From: Felix Deichmann <>
Subject: Re: port-vax/51761: SCSI gets stuck on VAXstation 4000
Date: Fri, 6 Jan 2017 08:58:50 +0100

 The SCSI issues are an effect of a gcc bug in its built-in ffs function
 for vax.
 scsipi_get_tag() in src/sys/dev/scsipi/scsipi_base.c uses ffs to obtain
 a free tag from the pool. It will erroneously return tag id 0x38 (word
 1, bit 24) after 0x1f has been reached (word 0, bit 31), instead of the
 expected 0x20 (word 1, bit 0).
 This is because the statement
 		bit = ffs(periph->periph_freetags[word]);
 is compiled as
     15b0:	ea 00 20 48 	ffs $0x0,$0x20,0x50(r10)[r8],r9
     15b4:	aa 50 59
 r8 is obviously a byte index, while it should be a longword index like
 variable "word" is a longword index into u_int32_t periph_freetags[].
 A tested workaround is to use a generic function like inlined ffs32 from
 <sys/bitops.h> instead of the gcc built-in ffs function.

Home | Main Index | Thread Index | Old Index