Subject: port-amd64/28442: struct btinfo_bootwedge have alignment/padding problem
To: None <port-amd64-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <taya@ba2.so-net.ne.jp>
List: netbsd-bugs
Date: 11/28/2004 07:03:00
>Number:         28442
>Category:       port-amd64
>Synopsis:       struct btinfo_bootwedge have alignment/padding problem
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Nov 28 07:03:00 +0000 2004
>Originator:     Shin'ichiro TAYA
>Release:        NetBSD 2.99.10
>Organization:
	
>Environment:
	
	
System: NetBSD virgil.m2g.org 2.99.10 NetBSD 2.99.10 (VIRGIL) #10: Sun Nov 28 15:26:27 JST 2004 taya@mmgserv.m2g.org:/export/NetBSD/NetBSD-current/src/sys/arch/amd64/compile/VIRGIL amd64
Architecture: x86_64
Machine: amd64
>Description:
struct btinfo_bootwedge in bootloader is compiled with 32bit alignment
and passed to kernel.
But struct btinfo_bootwedge in kernel is compiled with 64bit alignment.
Some member doesn't read correctly.
e.g.
matchblk and matchnblks are filled with junk value.
So kernel claims like follows:

wd0 at atabus0 drive 0: <ST3120026AS>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 111 GB, 232581 cyl, 16 head, 63 sec, 512 bytes/sect x 234441648 sectors
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
wd0(pdcsata0:0:0): using PIO mode 4, Ultra-DMA mode 6 (Ultra/133) (using DMA)
wd1 at atabus1 drive 0: <ST3120026AS>
wd1: drive supports 16-sector PIO transfers, LBA48 addressing
wd1: 111 GB, 232581 cyl, 16 head, 63 sec, 512 bytes/sect x 234441648 sectors
wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
wd1(pdcsata0:1:0): using PIO mode 4, Ultra-DMA mode 6 (Ultra/133) (using DMA)
pdcsata0:0: unable to load xfer table DMA map for drive 0, error=22
wd0d: DMA error reading fsbn 4294967296 (wd0 bn 4294967296; cn 267349 tn 89 sn 4), retrying
pdcsata0:0: unable to load xfer table DMA map for drive 0, error=22
wd0d: DMA error reading fsbn 4294967296 (wd0 bn 4294967296; cn 267349 tn 89 sn 4), retrying
pdcsata0:0: unable to load xfer table DMA map for drive 0, error=22
wd0d: DMA error reading fsbn 4294967296 (wd0 bn 4294967296; cn 267349 tn 89 sn 4), retrying
pdcsata0:0: unable to load xfer table DMA map for drive 0, error=22
wd0d: DMA error reading fsbn 4294967296 (wd0 bn 4294967296; cn 267349 tn 89 sn 4), retrying
wd0d: error reading fsbn 4294967296 (wd0 bn 4294967296; cn 267349 tn 89 sn 4), retrying
wd0: (id not found)
wd0d: error reading fsbn 4294967296 (wd0 bn 4294967296; cn 267349 tn 89 sn 4)wd0: (id not found)

findroot: unable to read block 4294967296
pdcsata0:1: unable to load xfer table DMA map for drive 0, error=22
wd1d: DMA error reading fsbn 4294967296 (wd1 bn 4294967296; cn 267349 tn 89 sn 4), retrying
pdcsata0:1: unable to load xfer table DMA map for drive 0, error=22
wd1d: DMA error reading fsbn 4294967296 (wd1 bn 4294967296; cn 267349 tn 89 sn 4), retrying
pdcsata0:1: unable to load xfer table DMA map for drive 0, error=22
wd1d: DMA error reading fsbn 4294967296 (wd1 bn 4294967296; cn 267349 tn 89 sn 4), retrying
pdcsata0:1: unable to load xfer table DMA map for drive 0, error=22
wd1d: DMA error reading fsbn 4294967296 (wd1 bn 4294967296; cn 267349 tn 89 sn 4), retrying
wd1d: error reading fsbn 4294967296 (wd1 bn 4294967296; cn 267349 tn 89 sn 4), retrying
wd1: (id not found)
wd1d: error reading fsbn 4294967296 (wd1 bn 4294967296; cn 267349 tn 89 sn 4)wd1: (id not found)

findroot: unable to read block 4294967296


>How-To-Repeat:
install current bootloader and boot current kernel

>Fix:

add __attribute__((packed)).
but i don't know this is a right way.

>Unformatted: