summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-08-11 11:26:16 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-08-11 11:26:16 +0000
commit6cf46b2989d19f4276d4e941f35d7daff371ad9b (patch)
tree01332e1d9a905b8dbbdcee8c0736f48f18a0e3b1 /usr/src/lib
parent11f7a743c7e9060689d86f78f89fe0e9efe92932 (diff)
parentf7eeebb7a51b880fb7920f443b9774532d3efea6 (diff)
downloadillumos-joyent-6cf46b2989d19f4276d4e941f35d7daff371ad9b.tar.gz
[illumos-gate merge]
commit f7eeebb7a51b880fb7920f443b9774532d3efea6 13019 loader.efi: cursor and pixel draw should use Blt() if possible commit c3d209cab1511045e9bb1a521f1bd85995d4fd7e 13008 bhyve devmem could match better 13009 mdb-bhyve mishandles memseg offsets 13010 bhyve should not exit when VM debugged commit 40ae3b8f7394f061252c31a21b854ae328f6f269 13024 Add omitted word in sed man page
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/libvmm/libvmm.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/usr/src/lib/libvmm/libvmm.c b/usr/src/lib/libvmm/libvmm.c
index dc552a8de0..df3d8ec99f 100644
--- a/usr/src/lib/libvmm/libvmm.c
+++ b/usr/src/lib/libvmm/libvmm.c
@@ -11,6 +11,7 @@
/*
* Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Oxide Computer Company
*/
/*
@@ -199,12 +200,31 @@ vmm_map(vmm_t *vmm, boolean_t writable)
for (ms = list_head(&vmm->vmm_memlist);
ms != NULL;
ms = list_next(&vmm->vmm_memlist, ms)) {
- off_t mapoff = ms->vms_gpa;
+ off_t mapoff;
+
+ if ((ms->vms_flags & VMM_MEMSEG_DEVMEM) == 0) {
+ /*
+ * sysmem segments will be located at an offset
+ * equivalent to their GPA.
+ */
+ mapoff = ms->vms_gpa;
+ } else {
+ /*
+ * devmem segments are located in a special region away
+ * from the normal GPA space.
+ */
+ if (vm_get_devmem_offset(vmm->vmm_ctx, ms->vms_segid,
+ &mapoff) != 0) {
+ goto fail;
+ }
+ }
- if ((ms->vms_flags & VMM_MEMSEG_DEVMEM) &&
- vm_get_devmem_offset(vmm->vmm_ctx, ms->vms_segid, &mapoff)
- != 0)
- goto fail;
+ /*
+ * While 'mapoff' points to the front of the segment, the actual
+ * mapping may be at some offset beyond that.
+ */
+ VERIFY(ms->vms_segoff >= 0);
+ mapoff += ms->vms_segoff;
vmm->vmm_memsize += ms->vms_maplen;