diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-11-07 08:36:51 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-11-07 08:36:51 +0000 |
commit | d7d53098bf5e23746e02d321e4368d7da677bb4d (patch) | |
tree | 349d69e162954946b3151d9806a94d634d70cf27 /sys/dev/isa | |
parent | 418f6cc8ed9c3822bf64dbe6bb70e116590fdfee (diff) |
Handle odd-aligned mbufs in 16 bit mode so strict alignment is enforced
Diffstat (limited to 'sys/dev/isa')
-rw-r--r-- | sys/dev/isa/if_ed.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/isa/if_ed.c b/sys/dev/isa/if_ed.c index 318b7ca89bd..9824c30c6bb 100644 --- a/sys/dev/isa/if_ed.c +++ b/sys/dev/isa/if_ed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ed.c,v 1.21 1996/10/16 12:34:36 deraadt Exp $ */ +/* $OpenBSD: if_ed.c,v 1.22 1996/11/07 08:36:50 niklas Exp $ */ /* $NetBSD: if_ed.c,v 1.100 1996/05/12 23:52:19 mycroft Exp $ */ /* @@ -2771,6 +2771,19 @@ ed_shared_writemem(sc, from, card, len) * have to be careful. */ if (sc->isa16bit) { + /* + * If writing to an odd location, we need to align first. + * This requires a read-modify-write cycle as we should + * keep accesses 16-bit wide. + */ + if (len > 0 && (card & 1)) { + word = bus_mem_read_2(bc, memh, card & ~1); + word = word & 0xff | (*from << 8); + bus_mem_write_2(bc, memh, card & ~1, word); + from++; + card++; + len--; + } while (len > 1) { word = (u_int8_t)from[0] | (u_int8_t)from[1] << 8; bus_mem_write_2(bc, memh, card, word); |