NetBSD-Bugs archive

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

Re: kern/41038: Pentium 1 crashes during boot install kernel



The following reply was made to PR kern/41038; it has been noted by GNATS.

From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/41038: Pentium 1 crashes during boot install kernel
Date: Tue, 21 Apr 2009 17:47:50 +0200

 There is invalid code that very badly violates the bus_dmamap_t opaqueness
 (and this is what the #ifdef sparc* stuff works around):
 
     532 int                             
     533 pdq_os_memalloc_contig(  
     534     pdq_t *pdq)                 
     535 {   
     536     pdq_softc_t * const sc = pdq->pdq_os_ctx;
     537     bus_dma_segment_t db_segs[1], ui_segs[1], cb_segs[1];
     538     int db_nsegs = 0, ui_nsegs = 0;
     539     int steps = 0;                 
     540     int not_ok;
 
 
 now db_segs is properly created:
     542     not_ok = bus_dmamem_alloc(sc->sc_dmatag,
     543                          sizeof(*pdq->pdq_dbp), sizeof(*pdq->pdq_dbp),
     544                          sizeof(*pdq->pdq_dbp), db_segs, 1, &db_nsegs,
 
 but then cb_segs is just copied:
     593     if (!not_ok) {              
     594         steps = 8;
     595         pdq->pdq_unsolicited_info.ui_pa_bufstart = 
sc->sc_uimap->dm_segs[0].ds_addr;
     596         cb_segs[0] = db_segs[0];
     597         cb_segs[0].ds_addr += offsetof(pdq_descriptor_block_t, 
pdqdb_consumer);
     598         cb_segs[0].ds_len = sizeof(pdq_consumer_block_t);
 
 I'd call this working by sheer luck with certain bus_dmamem_* implementations.
 
 I'm not sure if this should be rewritten properly or just the sparc hacks
 be used everywhere and the other variant removed ;-)
 
 Thanks to Jochen Kunz for insights into the sparc* hacks. I'm not sure this
 is why it's broken on i386 right now either.
 
 Martin
 


Home | Main Index | Thread Index | Old Index