mem.c (243640) | mem.c (243651) |
---|---|
1/*- 2 * Copyright (c) 2012 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2012 NetApp, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: projects/bhyve/usr.sbin/bhyve/mem.c 243640 2012-11-28 00:02:17Z neel $ | 26 * $FreeBSD: projects/bhyve/usr.sbin/bhyve/mem.c 243651 2012-11-28 13:34:44Z neel $ |
27 */ 28 29/* 30 * Memory ranges are represented with an RB tree. On insertion, the range 31 * is checked for overlaps. On lookup, the key has the same base and limit 32 * so it can be searched within the range. 33 * 34 * It is assumed that all setup of ranges takes place in single-threaded 35 * mode before vCPUs have been started. As such, no locks are used on the 36 * RB tree. If this is no longer the case, then a r/w lock could be used, 37 * with readers on the lookup and a writer if the tree needs to be changed 38 * (and per vCPU caches flushed) 39 */ 40 41#include <sys/cdefs.h> | 27 */ 28 29/* 30 * Memory ranges are represented with an RB tree. On insertion, the range 31 * is checked for overlaps. On lookup, the key has the same base and limit 32 * so it can be searched within the range. 33 * 34 * It is assumed that all setup of ranges takes place in single-threaded 35 * mode before vCPUs have been started. As such, no locks are used on the 36 * RB tree. If this is no longer the case, then a r/w lock could be used, 37 * with readers on the lookup and a writer if the tree needs to be changed 38 * (and per vCPU caches flushed) 39 */ 40 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: projects/bhyve/usr.sbin/bhyve/mem.c 243640 2012-11-28 00:02:17Z neel $"); | 42__FBSDID("$FreeBSD: projects/bhyve/usr.sbin/bhyve/mem.c 243651 2012-11-28 13:34:44Z neel $"); |
43 44#include <sys/types.h> 45#include <sys/tree.h> 46#include <sys/errno.h> 47#include <machine/vmm.h> 48 49#include <stdio.h> 50#include <stdlib.h> --- 100 unchanged lines hidden (view full) --- 151 struct mem_range *mr = arg; 152 153 error = (*mr->handler)(ctx, vcpu, MEM_F_WRITE, gpa, size, 154 &wval, mr->arg1, mr->arg2); 155 return (error); 156} 157 158int | 43 44#include <sys/types.h> 45#include <sys/tree.h> 46#include <sys/errno.h> 47#include <machine/vmm.h> 48 49#include <stdio.h> 50#include <stdlib.h> --- 100 unchanged lines hidden (view full) --- 151 struct mem_range *mr = arg; 152 153 error = (*mr->handler)(ctx, vcpu, MEM_F_WRITE, gpa, size, 154 &wval, mr->arg1, mr->arg2); 155 return (error); 156} 157 158int |
159emulate_mem(struct vmctx *ctx, int vcpu, uint64_t paddr, uint64_t rip, 160 uint64_t cr3, int mode, struct vie *vie) | 159emulate_mem(struct vmctx *ctx, int vcpu, uint64_t paddr, struct vie *vie) |
161{ 162 struct mmio_rb_range *entry; 163 int err; 164 165 /* 166 * First check the per-vCPU cache 167 */ 168 if (mmio_hint[vcpu] && --- 51 unchanged lines hidden --- | 160{ 161 struct mmio_rb_range *entry; 162 int err; 163 164 /* 165 * First check the per-vCPU cache 166 */ 167 if (mmio_hint[vcpu] && --- 51 unchanged lines hidden --- |