From bbdf2df9b0847fc674ee8105fdec7103dda14d02 Mon Sep 17 00:00:00 2001 From: cgd Date: Tue, 11 Jun 1996 21:20:08 +0000 Subject: [PATCH] since bus_mem_subregion() can return failure, don't even bother to try to handle the case where subregion offset isn't a multiple of 8. --- sys/arch/alpha/tc/tc_bus_mem.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/arch/alpha/tc/tc_bus_mem.c b/sys/arch/alpha/tc/tc_bus_mem.c index 5454b581f063..728cc7e1338c 100644 --- a/sys/arch/alpha/tc/tc_bus_mem.c +++ b/sys/arch/alpha/tc/tc_bus_mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: tc_bus_mem.c,v 1.4 1996/06/11 21:16:29 cgd Exp $ */ +/* $NetBSD: tc_bus_mem.c,v 1.5 1996/06/11 21:20:08 cgd Exp $ */ /* * Copyright (c) 1996 Carnegie-Mellon University. @@ -127,10 +127,15 @@ tc_mem_subregion(v, memh, offset, size, nmemh) bus_mem_size_t offset, size; { + /* Disallow subregioning that would make the handle unaligned. */ + if ((offset & 0x7) != 0) + return (1); + if ((memh & TC_SPACE_SPARSE) != 0) *nmemh = memh + (off << 1); else *nmemh = memh + off; + return (0); } @@ -215,7 +220,7 @@ tc_mem_write_1(v, memh, off, val) volatile u_int64_t *p, v; u_int64_t shift, msk; - shift = off & 0x3; /* XXX breaks if subregion */ + shift = off & 0x3; off &= 0x3; p = (u_int64_t *)(memh + (off << 1)); @@ -245,7 +250,7 @@ tc_mem_write_2(v, memh, off, val) volatile u_int64_t *p, v; u_int64_t shift, msk; - shift = off & 0x2; /* XXX breaks if subregion */ + shift = off & 0x2; off &= 0x3; p = (u_int64_t *)(memh + (off << 1));