Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150638301
D24929.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D24929.diff
View Options
Index: head/sys/amd64/include/vmm_dev.h
===================================================================
--- head/sys/amd64/include/vmm_dev.h
+++ head/sys/amd64/include/vmm_dev.h
@@ -56,6 +56,13 @@
char name[VM_MAX_SUFFIXLEN + 1];
};
+struct vm_memseg_fbsd12 {
+ int segid;
+ size_t len;
+ char name[64];
+};
+_Static_assert(sizeof(struct vm_memseg_fbsd12) == 80, "COMPAT_FREEBSD12 ABI");
+
struct vm_register {
int cpuid;
int regnum; /* enum vm_reg_name */
@@ -338,8 +345,12 @@
_IOW('v', IOCNUM_SUSPEND, struct vm_suspend)
#define VM_REINIT \
_IO('v', IOCNUM_REINIT)
+#define VM_ALLOC_MEMSEG_FBSD12 \
+ _IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg_fbsd12)
#define VM_ALLOC_MEMSEG \
_IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg)
+#define VM_GET_MEMSEG_FBSD12 \
+ _IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg_fbsd12)
#define VM_GET_MEMSEG \
_IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg)
#define VM_MMAP_MEMSEG \
Index: head/sys/amd64/vmm/vmm_dev.c
===================================================================
--- head/sys/amd64/vmm/vmm_dev.c
+++ head/sys/amd64/vmm/vmm_dev.c
@@ -252,7 +252,7 @@
CTASSERT(sizeof(((struct vm_memseg *)0)->name) >= VM_MAX_SUFFIXLEN + 1);
static int
-get_memseg(struct vmmdev_softc *sc, struct vm_memseg *mseg)
+get_memseg(struct vmmdev_softc *sc, struct vm_memseg *mseg, size_t len)
{
struct devmem_softc *dsc;
int error;
@@ -269,17 +269,16 @@
}
KASSERT(dsc != NULL, ("%s: devmem segment %d not found",
__func__, mseg->segid));
- error = copystr(dsc->name, mseg->name, sizeof(mseg->name),
- NULL);
+ error = copystr(dsc->name, mseg->name, len, NULL);
} else {
- bzero(mseg->name, sizeof(mseg->name));
+ bzero(mseg->name, len);
}
return (error);
}
static int
-alloc_memseg(struct vmmdev_softc *sc, struct vm_memseg *mseg)
+alloc_memseg(struct vmmdev_softc *sc, struct vm_memseg *mseg, size_t len)
{
char *name;
int error;
@@ -295,8 +294,8 @@
*/
if (VM_MEMSEG_NAME(mseg)) {
sysmem = false;
- name = malloc(sizeof(mseg->name), M_VMMDEV, M_WAITOK);
- error = copystr(mseg->name, name, sizeof(mseg->name), NULL);
+ name = malloc(len, M_VMMDEV, M_WAITOK);
+ error = copystr(mseg->name, name, len, NULL);
if (error)
goto done;
}
@@ -438,6 +437,9 @@
case VM_MAP_PPTDEV_MMIO:
case VM_BIND_PPTDEV:
case VM_UNBIND_PPTDEV:
+#ifdef COMPAT_FREEBSD12
+ case VM_ALLOC_MEMSEG_FBSD12:
+#endif
case VM_ALLOC_MEMSEG:
case VM_MMAP_MEMSEG:
case VM_REINIT:
@@ -451,6 +453,9 @@
state_changed = 2;
break;
+#ifdef COMPAT_FREEBSD12
+ case VM_GET_MEMSEG_FBSD12:
+#endif
case VM_GET_MEMSEG:
case VM_MMAP_GETNEXT:
/*
@@ -633,11 +638,25 @@
error = vm_mmap_memseg(sc->vm, mm->gpa, mm->segid, mm->segoff,
mm->len, mm->prot, mm->flags);
break;
+#ifdef COMPAT_FREEBSD12
+ case VM_ALLOC_MEMSEG_FBSD12:
+ error = alloc_memseg(sc, (struct vm_memseg *)data,
+ sizeof(((struct vm_memseg_fbsd12 *)0)->name));
+ break;
+#endif
case VM_ALLOC_MEMSEG:
- error = alloc_memseg(sc, (struct vm_memseg *)data);
+ error = alloc_memseg(sc, (struct vm_memseg *)data,
+ sizeof(((struct vm_memseg *)0)->name));
break;
+#ifdef COMPAT_FREEBSD12
+ case VM_GET_MEMSEG_FBSD12:
+ error = get_memseg(sc, (struct vm_memseg *)data,
+ sizeof(((struct vm_memseg_fbsd12 *)0)->name));
+ break;
+#endif
case VM_GET_MEMSEG:
- error = get_memseg(sc, (struct vm_memseg *)data);
+ error = get_memseg(sc, (struct vm_memseg *)data,
+ sizeof(((struct vm_memseg *)0)->name));
break;
case VM_GET_REGISTER:
vmreg = (struct vm_register *)data;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 12:28 AM (27 m, 55 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30787725
Default Alt Text
D24929.diff (3 KB)
Attached To
Mode
D24929: vmm(4): Add 12 user ABI compat after r349948
Attached
Detach File
Event Timeline
Log In to Comment