diff options
author | 2016-10-06 17:00:25 +0000 | |
---|---|---|
committer | 2016-10-06 17:00:25 +0000 | |
commit | 4c16a85a086261679b76ea729f8e86d5a0b38c8f (patch) | |
tree | 4ede2a046d6e1aa86be31ed57929f965da0af8f7 /sys/dev/pv/xen.c | |
parent | The start control imsg has been switched to a new "struct (diff) | |
download | wireguard-openbsd-4c16a85a086261679b76ea729f8e86d5a0b38c8f.tar.xz wireguard-openbsd-4c16a85a086261679b76ea729f8e86d5a0b38c8f.zip |
Remove _ds_boundary abuse (again)
The logic behind this change is this: a single mbuf may reference
only a contiguous chunk of memory. When this chunk crosses a page
boundary only the first part of it has a non-zero offset while all
other chunks start at the beginning of the page.
We take advantage of this fact and calculate the offset of a first
chunk as a simple "mtod(m, vaddr_t) & PAGE_MASK".
Diffstat (limited to 'sys/dev/pv/xen.c')
-rw-r--r-- | sys/dev/pv/xen.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c index 27759ffa982..602984d5905 100644 --- a/sys/dev/pv/xen.c +++ b/sys/dev/pv/xen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xen.c,v 1.63 2016/09/12 17:22:45 mikeb Exp $ */ +/* $OpenBSD: xen.c,v 1.64 2016/10/06 17:00:25 mikeb Exp $ */ /* * Copyright (c) 2015 Mike Belopuhov @@ -1191,8 +1191,6 @@ xen_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf, xen_grant_table_enter(sc, gm[i].gm_ref, map->dm_segs[i].ds_addr, domain, flags & BUS_DMA_WRITE ? GTF_readonly : 0); gm[i].gm_paddr = map->dm_segs[i].ds_addr; - map->dm_segs[i].ds_offset = map->dm_segs[i].ds_addr & - PAGE_MASK; map->dm_segs[i].ds_addr = gm[i].gm_ref; } return (0); @@ -1214,8 +1212,6 @@ xen_bus_dmamap_load_mbuf(bus_dma_tag_t t, bus_dmamap_t map, struct mbuf *m0, for (i = 0; i < map->dm_nsegs; i++) { xen_grant_table_enter(sc, gm[i].gm_ref, map->dm_segs[i].ds_addr, domain, flags & BUS_DMA_WRITE ? GTF_readonly : 0); - map->dm_segs[i].ds_offset = map->dm_segs[i].ds_addr & - PAGE_MASK; gm[i].gm_paddr = map->dm_segs[i].ds_addr; map->dm_segs[i].ds_addr = gm[i].gm_ref; } |