Code cleanup. Moved the interrupt redirection instrumentation
into the host-specific files and wrapped access to them with atomic operations since that's a structure global to all the VMs. I think all the other globals are SMP clean since they are only written once during module init time, and read thereafter my all VMs. Renamed all host OS specific functions to hostOS*(). All host independent functions to host*(). I'd like to rename all monitor space functions to mon*() next.
This commit is contained in:
parent
6d58bed135
commit
87d648682e
@ -33,6 +33,7 @@
|
||||
#include <linux/wrapper.h>
|
||||
#include <linux/version.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
|
||||
#ifndef VERSION_CODE
|
||||
@ -77,6 +78,16 @@
|
||||
#define NEED_RESCHED current->need_resched
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Instrumentation of how many hardware interrupts were redirected
|
||||
* to the host, while the VM monitor/guest was running. This can be
|
||||
* written to by multiple contexts, so it needs SMP protection.
|
||||
*/
|
||||
static atomic_t interruptRedirCount[256];
|
||||
|
||||
|
||||
|
||||
#if LINUX_VERSION_CODE < VERSION_CODE(2,1,0)
|
||||
static inline unsigned long
|
||||
copy_from_user(void *to, const void *from, unsigned long n)
|
||||
@ -157,7 +168,7 @@ MODULE_LICENSE("GPL"); /* Close enough. Keeps kernel from complaining. */
|
||||
/* Structures / Variables */
|
||||
/************************************************************************/
|
||||
|
||||
static int retrieve_monitor_pages(void);
|
||||
static int retrieveKernelModulePages(void);
|
||||
static unsigned retrievePhyPages(Bit32u *page, int max_pages, void *addr,
|
||||
unsigned size);
|
||||
|
||||
@ -211,8 +222,11 @@ init_module(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* Clear uninitialised structures. */
|
||||
memset(&monitor_pages, 0, sizeof(monitor_pages));
|
||||
/* Initialize structures which are not specific to each VM. These
|
||||
* are things which are set only once upon kernel module initialization.
|
||||
*/
|
||||
memset(&kernelModulePages, 0, sizeof(kernelModulePages));
|
||||
memset(&interruptRedirCount, 0, sizeof(interruptRedirCount));
|
||||
|
||||
/* Register the device with the kernel. */
|
||||
err = register_chrdev(plex_major, "plex86", &plex86_fops);
|
||||
@ -248,14 +262,14 @@ init_module(void)
|
||||
#endif
|
||||
|
||||
/* Retrieve the monitor physical pages. */
|
||||
if ( !retrieve_monitor_pages() ) {
|
||||
printk(KERN_ERR "plex86: retrieve_monitor_pages returned error\n");
|
||||
if ( !retrieveKernelModulePages() ) {
|
||||
printk(KERN_ERR "plex86: retrieveKernelModulePages returned error\n");
|
||||
err = -EINVAL;
|
||||
goto fail_retrieve_pages;
|
||||
}
|
||||
|
||||
/* Kernel independent code to be run when kernel module is loaded. */
|
||||
if ( !genericModuleInit() ) {
|
||||
if ( !hostModuleInit() ) {
|
||||
printk(KERN_ERR "plex86: genericModuleInit returned error\n");
|
||||
err = -EINVAL;
|
||||
goto fail_cpu_capabilities;
|
||||
@ -316,12 +330,12 @@ plex86_open(struct inode *inode, struct file *filp)
|
||||
#endif
|
||||
|
||||
/* Allocate a VM structure. */
|
||||
if ( (vm = hostAllocZeroedMem(sizeof(vm_t))) == NULL )
|
||||
if ( (vm = hostOSAllocZeroedMem(sizeof(vm_t))) == NULL )
|
||||
return -ENOMEM;
|
||||
filp->private_data = vm;
|
||||
|
||||
/* Kernel independent device open code. */
|
||||
genericDeviceOpen(vm);
|
||||
hostDeviceOpen(vm);
|
||||
|
||||
return(0);
|
||||
}
|
||||
@ -338,7 +352,7 @@ plex86_release(struct inode *inode, struct file *filp)
|
||||
filp->private_data = NULL;
|
||||
|
||||
/* Free the virtual memory. */
|
||||
unallocVmPages( vm );
|
||||
hostUnallocVmPages( vm );
|
||||
|
||||
/* Free the VM structure. */
|
||||
memset( vm, 0, sizeof(*vm) );
|
||||
@ -364,13 +378,13 @@ plex86_ioctl(struct inode *inode, struct file *filp,
|
||||
/* Call non host-specific ioctl() code which calls back to this
|
||||
* module only when it needs host-specific features.
|
||||
*/
|
||||
ret = ioctlGeneric(vm, inode, filp, cmd, arg);
|
||||
ret = hostIoctlGeneric(vm, inode, filp, cmd, arg);
|
||||
|
||||
/* Convert from plex86 errno codes to host-specific errno codes. Not
|
||||
* very exciting.
|
||||
*/
|
||||
if ( ret < 0 )
|
||||
ret = - hostConvertPlex86Errno(- ret);
|
||||
ret = - hostOSConvertPlex86Errno(- ret);
|
||||
return( ret );
|
||||
}
|
||||
|
||||
@ -405,15 +419,17 @@ plex86_read_procmem(char *buf, char **start, off_t offset,
|
||||
len = 0;
|
||||
len += sprintf(buf, "monitor-->host interrupt reflection counts\n");
|
||||
for (i=0; i<256; i++) {
|
||||
if (intRedirCount[i])
|
||||
len += sprintf(buf+len, " 0x%2x:%10u\n", i, intRedirCount[i]);
|
||||
int count;
|
||||
count = atomic_read( &interruptRedirCount[i] );
|
||||
if (count)
|
||||
len += sprintf(buf+len, " 0x%2x:%10u\n", i, count);
|
||||
}
|
||||
return(len);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
retrieve_monitor_pages(void)
|
||||
retrieveKernelModulePages(void)
|
||||
{
|
||||
/*
|
||||
* Retrieve start address and size of this module.
|
||||
@ -442,17 +458,17 @@ retrieve_monitor_pages(void)
|
||||
size += (driverStartAddr & 0xfff);
|
||||
}
|
||||
|
||||
nPages = retrievePhyPages(monitor_pages.page, PLEX86_MAX_MONITOR_PAGES,
|
||||
nPages = retrievePhyPages(kernelModulePages.ppi, Plex86MaxKernelModulePages,
|
||||
(void *) driverStartAddrPageAligned, size);
|
||||
if (nPages == 0) {
|
||||
printk(KERN_ERR "plex86: retrieve_monitor_pages: retrieve returned error.\n");
|
||||
printk(KERN_ERR "plex86: retrieveKernelModulePages: retrieve returned error.\n");
|
||||
return( 0 ); /* Error. */
|
||||
}
|
||||
printk(KERN_WARNING "plex86: %u monitor pages located\n", nPages);
|
||||
|
||||
monitor_pages.startOffset = driverStartAddr;
|
||||
monitor_pages.startOffsetPageAligned = driverStartAddrPageAligned;
|
||||
monitor_pages.n_pages = nPages;
|
||||
kernelModulePages.startOffset = driverStartAddr;
|
||||
kernelModulePages.startOffsetPageAligned = driverStartAddrPageAligned;
|
||||
kernelModulePages.nPages = nPages;
|
||||
return( 1 ); /* OK. */
|
||||
}
|
||||
|
||||
@ -571,7 +587,7 @@ retrievePhyPages(Bit32u *page, int max_pages, void *addr_v, unsigned size)
|
||||
|
||||
|
||||
unsigned
|
||||
hostIdle(void)
|
||||
hostOSIdle(void)
|
||||
{
|
||||
if (NEED_RESCHED)
|
||||
schedule();
|
||||
@ -581,7 +597,7 @@ hostIdle(void)
|
||||
}
|
||||
|
||||
void *
|
||||
hostAllocZeroedMem(unsigned long size)
|
||||
hostOSAllocZeroedMem(unsigned long size)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
@ -598,32 +614,32 @@ hostAllocZeroedMem(unsigned long size)
|
||||
}
|
||||
|
||||
void
|
||||
hostFreeMem(void *ptr)
|
||||
hostOSFreeMem(void *ptr)
|
||||
{
|
||||
vfree(ptr);
|
||||
}
|
||||
|
||||
void *
|
||||
hostAllocZeroedPage(void)
|
||||
hostOSAllocZeroedPage(void)
|
||||
{
|
||||
return( (void *) get_zeroed_page(GFP_KERNEL) );
|
||||
}
|
||||
|
||||
void
|
||||
hostFreePage(void *ptr)
|
||||
hostOSFreePage(void *ptr)
|
||||
{
|
||||
free_page( (Bit32u)ptr );
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
hostGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr, unsigned size)
|
||||
hostOSGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr, unsigned size)
|
||||
{
|
||||
return( retrievePhyPages(page, max_pages, ptr, size) );
|
||||
}
|
||||
|
||||
Bit32u
|
||||
hostGetAllocedPagePhyPage(void *ptr)
|
||||
hostOSGetAllocedPagePhyPage(void *ptr)
|
||||
{
|
||||
if (!ptr) return 0;
|
||||
/* return MAP_NR(ptr); */
|
||||
@ -631,7 +647,7 @@ hostGetAllocedPagePhyPage(void *ptr)
|
||||
}
|
||||
|
||||
void
|
||||
hostPrint(char *fmt, ...)
|
||||
hostOSPrint(char *fmt, ...)
|
||||
{
|
||||
#warning "Fix hostPrint"
|
||||
#if 0
|
||||
@ -652,7 +668,7 @@ hostPrint(char *fmt, ...)
|
||||
|
||||
|
||||
int
|
||||
hostConvertPlex86Errno(unsigned ret)
|
||||
hostOSConvertPlex86Errno(unsigned ret)
|
||||
{
|
||||
switch (ret) {
|
||||
case 0: return(0);
|
||||
@ -670,32 +686,13 @@ hostConvertPlex86Errno(unsigned ret)
|
||||
|
||||
|
||||
Bit32u
|
||||
hostKernelOffset(void)
|
||||
hostOSKernelOffset(void)
|
||||
{
|
||||
return( KERNEL_OFFSET );
|
||||
}
|
||||
|
||||
unsigned
|
||||
hostMMapCheck(void *i, void *f)
|
||||
{
|
||||
struct inode *inode;
|
||||
struct file *filp;
|
||||
|
||||
inode = (struct inode *) i;
|
||||
filp = (struct file *) f;
|
||||
|
||||
#if LINUX_VERSION_CODE >= VERSION_CODE(2,3,99)
|
||||
/* Not sure when this changed. If you know, email us. */
|
||||
if (inode->i_data.i_mmap != NULL)
|
||||
#else
|
||||
if (inode->i_mmap != NULL)
|
||||
#endif
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
hostModuleCountReset(vm_t *vm, void *inode, void *filp)
|
||||
hostOSModuleCountReset(vm_t *vm, void *inode, void *filp)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < VERSION_CODE(2,4,0)
|
||||
while (MOD_IN_USE) {
|
||||
@ -707,19 +704,19 @@ hostModuleCountReset(vm_t *vm, void *inode, void *filp)
|
||||
}
|
||||
|
||||
unsigned long
|
||||
hostCopyFromUser(void *to, void *from, unsigned long len)
|
||||
hostOSCopyFromUser(void *to, void *from, unsigned long len)
|
||||
{
|
||||
return( copy_from_user(to, from, len) );
|
||||
}
|
||||
|
||||
unsigned long
|
||||
hostCopyToUser(void *to, void *from, unsigned long len)
|
||||
hostOSCopyToUser(void *to, void *from, unsigned long len)
|
||||
{
|
||||
return( copy_to_user(to, from, len) );
|
||||
}
|
||||
|
||||
Bit32u
|
||||
hostGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr,
|
||||
hostOSGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr,
|
||||
Bit32u *ppi, Bit32u *kernelAddr)
|
||||
{
|
||||
int ret;
|
||||
@ -761,7 +758,7 @@ hostGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr,
|
||||
}
|
||||
|
||||
void
|
||||
hostUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr,
|
||||
hostOSUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr,
|
||||
Bit32u ppi, Bit32u *kernelAddr, unsigned dirty)
|
||||
{
|
||||
#if 0
|
||||
@ -795,3 +792,9 @@ hostUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr,
|
||||
/* Release/unpin the page. */
|
||||
put_page(page);
|
||||
}
|
||||
|
||||
void
|
||||
hostOSInstrumentIntRedirCount(unsigned interruptVector)
|
||||
{
|
||||
atomic_inc( &interruptRedirCount[interruptVector] );
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
|
||||
|
||||
monitor_pages_t monitor_pages;
|
||||
kernelModulePages_t kernelModulePages;
|
||||
|
||||
#define NULL 0
|
||||
|
||||
@ -47,118 +47,115 @@ main(int argc, char *argv[])
|
||||
{
|
||||
vm_t *vm = NULL;
|
||||
|
||||
genericModuleInit();
|
||||
genericDeviceOpen(vm);
|
||||
initMonitor(vm);
|
||||
initGuestPhyMem(vm);
|
||||
ioctlGeneric(vm, NULL, NULL, 0, 0);
|
||||
hostModuleInit();
|
||||
hostDeviceOpen(vm);
|
||||
hostIoctlGeneric(vm, NULL, NULL, 0, 0);
|
||||
return(0);
|
||||
}
|
||||
|
||||
void
|
||||
hostReservePhyPages(vm_t *vm, Bit32u *hostPhyPages, unsigned nPages)
|
||||
hostOSReservePhyPages(vm_t *vm, Bit32u *hostPhyPages, unsigned nPages)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
hostUnreservePhyPages(vm_t *vm, Bit32u *hostPhyPages, unsigned nPages)
|
||||
hostOSUnreservePhyPages(vm_t *vm, Bit32u *hostPhyPages, unsigned nPages)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
unsigned
|
||||
hostIdle(void)
|
||||
hostOSIdle(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
hostAllocZeroedMem(unsigned long size)
|
||||
hostOSAllocZeroedMem(unsigned long size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
hostFreeMem(void *ptr)
|
||||
hostOSFreeMem(void *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
void *
|
||||
hostAllocZeroedPage(void)
|
||||
hostOSAllocZeroedPage(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
hostFreePage(void *ptr)
|
||||
hostOSFreePage(void *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
hostGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr, unsigned size)
|
||||
hostOSGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr, unsigned size)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bit32u
|
||||
hostGetAllocedPagePhyPage(void *ptr)
|
||||
hostOSGetAllocedPagePhyPage(void *ptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
hostPrint(char *fmt, ...)
|
||||
hostOSPrint(char *fmt, ...)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
hostConvertPlex86Errno(unsigned ret)
|
||||
hostOSConvertPlex86Errno(unsigned ret)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Bit32u
|
||||
hostKernelOffset(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned
|
||||
hostMMapCheck(void *i, void *f)
|
||||
hostOSKernelOffset(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
hostModuleCountReset(vm_t *vm, void *inode, void *filp)
|
||||
hostOSModuleCountReset(vm_t *vm, void *inode, void *filp)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned long
|
||||
hostCopyFromUser(void *to, void *from, unsigned long len)
|
||||
hostOSCopyFromUser(void *to, void *from, unsigned long len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
hostCopyToUser(void *to, void *from, unsigned long len)
|
||||
hostOSCopyToUser(void *to, void *from, unsigned long len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Bit32u
|
||||
hostGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr,
|
||||
hostOSGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr,
|
||||
Bit32u *ppi, Bit32u *kernelAddr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
hostUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr,
|
||||
hostOSUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr,
|
||||
Bit32u ppi, Bit32u *kernelAddr, unsigned dirty)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
hostOSInstrumentIntRedirCount(unsigned interruptVector)
|
||||
{
|
||||
}
|
||||
|
@ -492,22 +492,22 @@ extern char __ret_to_guest;
|
||||
* of the monitor itself (inside the kernel module)
|
||||
*/
|
||||
|
||||
#define PLEX86_MAX_MONITOR_PAGES 128
|
||||
#define Plex86MaxKernelModulePages 128
|
||||
|
||||
typedef struct {
|
||||
/* virtual address space occupied by the module */
|
||||
/* Virtual address space occupied by the kernel module. */
|
||||
Bit32u startOffset;
|
||||
Bit32u startOffsetPageAligned;
|
||||
/* number of pages */
|
||||
unsigned n_pages;
|
||||
unsigned nPages; /* Number of pages. */
|
||||
|
||||
/* the pages themselves */
|
||||
Bit32u page[PLEX86_MAX_MONITOR_PAGES];
|
||||
} monitor_pages_t;
|
||||
/* A list of the Physical Page Indeces of the pages comprising the
|
||||
* kernel module. A PPI is just the physical page address >> 12.
|
||||
*/
|
||||
Bit32u ppi[Plex86MaxKernelModulePages];
|
||||
} kernelModulePages_t;
|
||||
|
||||
extern monitor_pages_t monitor_pages;
|
||||
extern cpuid_info_t cpuid_info;
|
||||
extern unsigned intRedirCount[];
|
||||
extern kernelModulePages_t kernelModulePages;
|
||||
extern cpuid_info_t hostCpuIDInfo;
|
||||
|
||||
|
||||
|
||||
@ -531,7 +531,7 @@ void *mon_memset(void *s, unsigned c, unsigned n);
|
||||
* space ...
|
||||
*/
|
||||
#define MON_BASE_FROM_LADDR(laddr) \
|
||||
((laddr) - monitor_pages.startOffsetPageAligned)
|
||||
((laddr) - kernelModulePages.startOffsetPageAligned)
|
||||
|
||||
|
||||
/* ============================================================
|
||||
@ -603,47 +603,45 @@ vm_rdtsc(void) {
|
||||
asm volatile("pushl %0 ; popfl": :"g" (x): "memory", "cc")
|
||||
|
||||
|
||||
int initMonitor(vm_t *);
|
||||
unsigned mapMonitor(vm_t *);
|
||||
unsigned initGuestPhyMem(vm_t *);
|
||||
void unallocVmPages(vm_t *);
|
||||
int allocVmPages(vm_t *, plex86IoctlRegisterMem_t *registerMsg);
|
||||
void initShadowPaging(vm_t *vm);
|
||||
void genericDeviceOpen(vm_t *);
|
||||
unsigned genericModuleInit(void);
|
||||
unsigned getCpuCapabilities(void);
|
||||
int ioctlGeneric(vm_t *vm, void *inode, void *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
int ioctlExecute(vm_t *vm, plex86IoctlExecute_t *executeMsg);
|
||||
int ioctlRegisterMem(vm_t *vm, plex86IoctlRegisterMem_t *registerMsg);
|
||||
void copyGuestStateToUserSpace(vm_t *vm);
|
||||
void releasePinnedUserPages(vm_t *vm);
|
||||
unsigned handlePagePinRequest(vm_t *vm, Bit32u reqPPI);
|
||||
int hostInitMonitor(vm_t *);
|
||||
unsigned hostMapMonitor(vm_t *);
|
||||
unsigned hostInitGuestPhyMem(vm_t *);
|
||||
void hostUnallocVmPages(vm_t *);
|
||||
int hostAllocVmPages(vm_t *, plex86IoctlRegisterMem_t *registerMsg);
|
||||
void hostInitShadowPaging(vm_t *vm);
|
||||
void hostDeviceOpen(vm_t *);
|
||||
unsigned hostModuleInit(void);
|
||||
unsigned hostGetCpuCapabilities(void);
|
||||
int hostIoctlGeneric(vm_t *vm, void *inode, void *filp,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
int hostIoctlExecute(vm_t *vm, plex86IoctlExecute_t *executeMsg);
|
||||
int hostIoctlRegisterMem(vm_t *vm, plex86IoctlRegisterMem_t *registerMsg);
|
||||
void hostCopyGuestStateToUserSpace(vm_t *vm);
|
||||
void hostReleasePinnedUserPages(vm_t *vm);
|
||||
unsigned hostHandlePagePinRequest(vm_t *vm, Bit32u reqPPI);
|
||||
|
||||
/* These are the functions that the host-OS-specific file of the
|
||||
* plex86 device driver must define.
|
||||
*/
|
||||
unsigned hostIdle(void);
|
||||
void *hostAllocZeroedMem(unsigned long size);
|
||||
void hostFreeMem(void *ptr);
|
||||
void *hostAllocZeroedPage(void);
|
||||
void hostFreePage(void *ptr);
|
||||
unsigned hostGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr,
|
||||
unsigned hostOSIdle(void);
|
||||
void *hostOSAllocZeroedMem(unsigned long size);
|
||||
void hostOSFreeMem(void *ptr);
|
||||
void *hostOSAllocZeroedPage(void);
|
||||
void hostOSFreePage(void *ptr);
|
||||
unsigned hostOSGetAllocedMemPhyPages(Bit32u *page, int max_pages, void *ptr,
|
||||
unsigned size);
|
||||
|
||||
Bit32u hostGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr,
|
||||
Bit32u hostOSGetAndPinUserPage(vm_t *vm, Bit32u userAddr, void **osSpecificPtr,
|
||||
Bit32u *ppi, Bit32u *kernelAddr);
|
||||
void hostUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr,
|
||||
void hostOSUnpinUserPage(vm_t *vm, Bit32u userAddr, void *osSpecificPtr,
|
||||
Bit32u ppi, Bit32u *kernelAddr, unsigned dirty);
|
||||
|
||||
Bit32u hostGetAllocedPagePhyPage(void *ptr);
|
||||
void hostPrint(char *fmt, ...);
|
||||
Bit32u hostKernelOffset(void);
|
||||
int hostConvertPlex86Errno(unsigned ret);
|
||||
unsigned hostMMapCheck(void *i, void *f);
|
||||
void hostModuleCountReset(vm_t *vm, void *inode, void *filp);
|
||||
unsigned long hostCopyFromUser(void *to, void *from, unsigned long len);
|
||||
unsigned long hostCopyToUser(void *to, void *from, unsigned long len);
|
||||
Bit32u hostOSGetAllocedPagePhyPage(void *ptr);
|
||||
void hostOSPrint(char *fmt, ...);
|
||||
Bit32u hostOSKernelOffset(void);
|
||||
int hostOSConvertPlex86Errno(unsigned ret);
|
||||
void hostOSModuleCountReset(vm_t *vm, void *inode, void *filp);
|
||||
void hostOSInstrumentIntRedirCount(unsigned interruptVector);
|
||||
unsigned long hostOSCopyFromUser(void *to, void *from, unsigned long len);
|
||||
unsigned long hostOSCopyToUser(void *to, void *from, unsigned long len);
|
||||
|
||||
#endif /* HOST Space */
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -274,7 +274,7 @@ open_guest_phy_page(vm_t *vm, Bit32u ppi, Bit8u *mon_offset)
|
||||
/* (separate PDE), find out what mon_offset is in terms of */
|
||||
/* an offset from the beginning of the PDE boundary. */
|
||||
mon_range_offset = ( ((Bit32u) mon_offset) -
|
||||
monitor_pages.startOffsetPageAligned );
|
||||
kernelModulePages.startOffsetPageAligned );
|
||||
pti = (mon_range_offset >> 12) & 0x3ff;
|
||||
pageTable = vm->guest.addr.nexus_page_tbl;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/************************************************************************
|
||||
* $Id: plex86.h,v 1.5 2003-01-09 04:02:30 kevinlawton Exp $
|
||||
* $Id: plex86.h,v 1.6 2003-01-10 04:27:51 kevinlawton Exp $
|
||||
************************************************************************
|
||||
*
|
||||
* plex86: run multiple x86 operating systems concurrently
|
||||
@ -199,21 +199,33 @@ typedef struct {
|
||||
#define MonReqPinUserPage 7
|
||||
#define MonReqPanic 8
|
||||
|
||||
#define VMStateFDOpened 0x001
|
||||
#define VMStateMemAllocated 0x002
|
||||
#define VMStateGuestCPUID 0x004
|
||||
#define VMStateMMapPhyMem 0x008
|
||||
#define VMStateMMapPrintBuffer 0x010
|
||||
#define VMStateMMapGuestCPU 0x020
|
||||
#define VMStateInitMonitor 0x040
|
||||
#define VMStateMapMonitor 0x080
|
||||
#define VMStatePanic 0x100
|
||||
#define VMStateFDOpened 0x001
|
||||
#define VMStateMemAllocated 0x002
|
||||
#define VMStateGuestCPUID 0x004
|
||||
#define VMStateRegisteredPhyMem 0x008
|
||||
#define VMStateRegisteredPrintBuffer 0x010
|
||||
#define VMStateRegisteredGuestCPU 0x020
|
||||
#define VMStateInitMonitor 0x040
|
||||
#define VMStateMapMonitor 0x080
|
||||
#define VMStatePanic 0x100
|
||||
|
||||
#define VMStateReady (VMStateFDOpened | VMStateMemAllocated | \
|
||||
VMStateGuestCPUID | VMStateMMapPhyMem | VMStateMMapPrintBuffer | \
|
||||
VMStateMMapGuestCPU | VMStateInitMonitor | VMStateMapMonitor )
|
||||
#define VMStateMMapAll \
|
||||
(VMStateMMapPhyMem | VMStateMMapPrintBuffer | VMStateMMapGuestCPU)
|
||||
/* State where the VM/monitor is ready to execute. */
|
||||
#define VMStateReady (VMStateFDOpened | \
|
||||
VMStateMemAllocated | \
|
||||
VMStateGuestCPUID | \
|
||||
VMStateRegisteredPhyMem | \
|
||||
VMStateRegisteredPrintBuffer | \
|
||||
VMStateRegisteredGuestCPU | \
|
||||
VMStateInitMonitor | \
|
||||
VMStateMapMonitor)
|
||||
|
||||
/* State where all user-space memory constructs are registered with
|
||||
* the plex86 kernel module.
|
||||
*/
|
||||
#define VMStateRegisteredAll \
|
||||
(VMStateRegisteredPhyMem | \
|
||||
VMStateRegisteredPrintBuffer | \
|
||||
VMStateRegisteredGuestCPU)
|
||||
|
||||
typedef struct {
|
||||
unsigned state;
|
||||
|
Loading…
Reference in New Issue
Block a user