Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 273173 | Differences between
and this patch

Collapse All | Expand All

(-)vmmon-only-patched/autoconf/smpcall.c (+23 lines)
Line 0 Link Here
1
/* **********************************************************
2
 * Copyright (C) 2008 VMware, Inc.  All Rights Reserved. -- VMware Confidential
3
 * **********************************************************/
4
5
/*
6
 * Detect whether smp_call_function has 4 or 3 arguments.
7
 * Change happened between 2.6.26 and 2.6.27-rc1.
8
 */
9
10
#include <linux/autoconf.h>
11
#include <linux/version.h>
12
13
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
14
#   error This compile test intentionally fails.
15
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
16
#   include <linux/smp.h>
17
18
int
19
vmware_smp_call_function(void (*func)(void *info), void *info, int wait)
20
{
21
   return smp_call_function(func, info, wait);
22
}
23
#endif
(-)vmmon-only-patched/common/cpuid.c (-1 lines)
Lines 8-14 Link Here
8
8
9
#   include <linux/string.h>
9
#   include <linux/string.h>
10
#endif
10
#endif
11
12
#include "vmware.h"
11
#include "vmware.h"
13
#include "vm_assert.h"
12
#include "vm_assert.h"
14
#include "x86.h"
13
#include "x86.h"
(-)vmmon-only-patched/common/task.c (-7 / +4 lines)
Lines 25-40 Link Here
25
 * we do not need asm/page.h anymore in this file - not surprising, this
25
 * we do not need asm/page.h anymore in this file - not surprising, this
26
 * is common file, yes?  And Windows do not have page.h, do they?
26
 * is common file, yes?  And Windows do not have page.h, do they?
27
 */
27
 */
28
#include <linux/version.h>
28
#define _ASM_X86_PAGE_H 
29
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
30
#define _I386_PAGE_H
31
#else
32
#define _ASM_X86_PAGE_H
33
#endif
34
/* On Linux, must come before any inclusion of asm/page.h --hpreg */
29
/* On Linux, must come before any inclusion of asm/page.h --hpreg */
35
#include "hostKernel.h"
36
#ifdef linux
30
#ifdef linux
31
#include "hostKernel.h"
32
#include "driver-config.h"
37
#   include <linux/string.h>
33
#   include <linux/string.h>
34
//#   include <linux/kernel.h>
38
35
39
#   ifdef USE_PERFCTRS_HOSTED
36
#   ifdef USE_PERFCTRS_HOSTED
40
#      include "perfctr.h"
37
#      include "perfctr.h"
(-)vmmon-only-patched/common/task_compat.h (-1 / +3 lines)
Lines 1-7 Link Here
1
#include <linux/init.h>
1
#include "modulecall_compat.h"
2
#include "modulecall_compat.h"
2
#include "x86msr.h"
3
#include "x86msr.h"
3
4
4
typedef struct SysenterStateV45 {
5
struct SysenterStateV45 {
5
   uint64       rsp;
6
   uint64       rsp;
6
   uint64       rip;
7
   uint64       rip;
7
   Selector     cs;
8
   Selector     cs;
Lines 3646-3650 Link Here
3646
      return TRUE;
3647
      return TRUE;
3647
   }
3648
   }
3648
3649
3650
// printk("/dev/vmmon: Cannot load module. Use standard gcc compiler\n");
3649
   return FALSE;
3651
   return FALSE;
3650
}
3652
}
(-)vmmon-only-patched/include/compat_semaphore.h (-4 lines)
Lines 2-12 Link Here
2
#   define __COMPAT_SEMAPHORE_H__
2
#   define __COMPAT_SEMAPHORE_H__
3
3
4
4
5
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
6
#include <linux/semaphore.h>
5
#include <linux/semaphore.h>
7
#else
8
#include <asm/semaphore.h>
9
#endif
10
6
11
7
12
/*
8
/*
(-)vmmon-only-patched/include/compat_wait.h (-3 / +4 lines)
Lines 34-46 Link Here
34
 * 2.4.20-wolk4.0s.
34
 * 2.4.20-wolk4.0s.
35
 */
35
 */
36
36
37
#ifdef VMW_HAVE_EPOLL // {
37
#if VMW_HAVE_EPOLL // {
38
#define compat_poll_wqueues struct poll_wqueues
38
#define compat_poll_wqueues struct poll_wqueues
39
#else // } {
39
#else // } {
40
#define compat_poll_wqueues poll_table
40
#define compat_poll_wqueues poll_table
41
#endif // }
41
#endif // }
42
42
43
#ifdef VMW_HAVE_EPOLL // {
43
#if VMW_HAVE_EPOLL // {
44
44
45
/* If prototype does not match, build will abort here */
45
/* If prototype does not match, build will abort here */
46
extern void poll_initwait(compat_poll_wqueues *);
46
extern void poll_initwait(compat_poll_wqueues *);
Lines 57-63 Link Here
57
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) // {
57
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) // {
58
58
59
/* If prototype does not match, build will abort here */
59
/* If prototype does not match, build will abort here */
60
extern void poll_initwait(compat_poll_wqueues *);
60
//extern void poll_initwait(compat_poll_wqueues *);
61
extern void poll_initwait(struct poll_wqueues *pwq);
61
62
62
#define compat_poll_initwait(wait, table) ( \
63
#define compat_poll_initwait(wait, table) ( \
63
   (wait) = (table), \
64
   (wait) = (table), \
(-)vmmon-only-patched/include/vcpuset.h (-4 / +2 lines)
Lines 71-79 Link Here
71
#define ffs(x) ffs_x86_64(x)
71
#define ffs(x) ffs_x86_64(x)
72
72
73
#elif defined MODULE
73
#elif defined MODULE
74
#ifndef __cplusplus
74
   //#include <linux/bitops.h>
75
   #include "linux/bitops.h"
76
#else
77
static inline int ffs_x86_hack(int x)
75
static inline int ffs_x86_hack(int x)
78
{
76
{
79
        int r;
77
        int r;
Lines 91-97 Link Here
91
}
89
}
92
90
93
#define ffs(x) ffs_x86_hack(x)
91
#define ffs(x) ffs_x86_hack(x)
94
#endif
92
95
#elif defined __APPLE__ && defined KERNEL
93
#elif defined __APPLE__ && defined KERNEL
96
   /* 
94
   /* 
97
    * XXXMACOS An ugly hack to resolve redefinition of PAGE_ defines 
95
    * XXXMACOS An ugly hack to resolve redefinition of PAGE_ defines 
(-)vmmon-only-patched/include/x86apic.h (-1 / +1 lines)
Lines 77-83 Link Here
77
#define APIC_LVT_DELVMODE(_lvt) (_lvt & 0x700)
77
#define APIC_LVT_DELVMODE(_lvt) (_lvt & 0x700)
78
#define APIC_LVT_RESET_VALUE  0x00010000
78
#define APIC_LVT_RESET_VALUE  0x00010000
79
79
80
#define APIC_BASE_MSR         0x1b
80
//#define APIC_BASE_MSR         0x1b
81
81
82
#define APIC_MSR_BASEMASK     QWORD(0x0000000f,0xfffff000)
82
#define APIC_MSR_BASEMASK     QWORD(0x0000000f,0xfffff000)
83
#define APIC_MSR_ENABLED      0x00000800
83
#define APIC_MSR_ENABLED      0x00000800
(-)vmmon-only-patched/include/x86paging.h (-3 / +1 lines)
Lines 58-66 Link Here
58
58
59
#define PTE_AVAIL_MASK       0xe00
59
#define PTE_AVAIL_MASK       0xe00
60
#define PTE_AVAIL_SHIFT      9
60
#define PTE_AVAIL_SHIFT      9
61
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
61
//#define PTE_PFN_MASK         0xfffff000
62
#define PTE_PFN_MASK         0xfffff000
63
#endif
64
#define PAE_PTE_PFN_MASK     CONST64U(0xffffff000)
62
#define PAE_PTE_PFN_MASK     CONST64U(0xffffff000)
65
#define LM_PTE_PFN_MASK      CONST64U(0xffffffffff000)
63
#define LM_PTE_PFN_MASK      CONST64U(0xffffffffff000)
66
#define PTE_PFN_SHIFT        12
64
#define PTE_PFN_SHIFT        12
(-)vmmon-only-patched/linux/driver.c (-72 / +44 lines)
Lines 113-127 Link Here
113
#define VMWare_SetVTracer(VTrace_Set)
113
#define VMWare_SetVTracer(VTrace_Set)
114
#endif
114
#endif
115
115
116
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
117
#define VMW_NOPAGE_2624
118
119
#define VMMON_MAP_OFFSET_SHIFT	0
120
#define VMMON_MAP_OFFSET_MASK	0x00000FFF
121
#define VMMON_MAP_OFFSET(base)	\
122
		(((base) >> VMMON_MAP_OFFSET_SHIFT) & VMMON_MAP_OFFSET_MASK)
123
#endif
124
125
struct VMXLinuxState linuxState;
116
struct VMXLinuxState linuxState;
126
117
127
static int vmversion = VME_DEFAULT;
118
static int vmversion = VME_DEFAULT;
Lines 157-166 Link Here
157
148
158
static int LinuxDriver_Close(struct inode *inode, struct file *filp);
149
static int LinuxDriver_Close(struct inode *inode, struct file *filp);
159
static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
150
static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
160
#if defined(VMW_NOPAGE_2624)
151
#if 0
161
static int LinuxDriverFault(struct vm_area_struct *vma, struct vm_fault *fault);
152
#if defined(VMW_NOPAGE_261)
162
static int LinuxDriverLockedFault(struct vm_area_struct *vma, struct vm_fault *fault);
163
#elif defined(VMW_NOPAGE_261)
164
static struct page *LinuxDriverNoPage(struct vm_area_struct *vma,
153
static struct page *LinuxDriverNoPage(struct vm_area_struct *vma,
165
                           unsigned long address, int *type);
154
                           unsigned long address, int *type);
166
static struct page *LinuxDriverLockedNoPage(struct vm_area_struct *vma,
155
static struct page *LinuxDriverLockedNoPage(struct vm_area_struct *vma,
Lines 171-199 Link Here
171
static struct page *LinuxDriverLockedNoPage(struct vm_area_struct *vma,
160
static struct page *LinuxDriverLockedNoPage(struct vm_area_struct *vma,
172
			   unsigned long address, int unused);
161
			   unsigned long address, int unused);
173
#else
162
#else
174
static unsigned long LinuxDriverNoPage(struct vm_area_struct *vma,
175
			   unsigned long address, int write_access);
176
static unsigned long LinuxDriverLockedNoPage(struct vm_area_struct *vma,
177
			   unsigned long address, int unused);
178
#endif
163
#endif
179
static int LinuxDriverMmap(struct file *filp, struct vm_area_struct *vma);
164
static int LinuxDriverNoPage(struct vm_area_struct *vma,
165
			struct vm_fault *fdata);
166
static int LinuxDriverLockedNoPage(struct vm_area_struct *vma,
167
			struct vm_fault *fdata);
168
180
169
181
static void LinuxDriverPollTimeout(unsigned long clientData);
182
170
183
static struct vm_operations_struct vmuser_mops = {
171
static struct vm_operations_struct vmuser_mops = {
184
#ifdef VMW_NOPAGE_2624
172
	.fault = LinuxDriverNoPage
185
	.fault  = LinuxDriverFault
186
#else
187
	.nopage = LinuxDriverNoPage
188
#endif
189
};
173
};
190
174
191
struct vm_operations_struct vmuser_locked_mops = {
175
struct vm_operations_struct vmuser_locked_mops = {
192
#ifdef VMW_NOPAGE_2624
176
	.fault = LinuxDriverLockedNoPage
193
	.fault = LinuxDriverLockedFault
177
};
194
#else
195
	.nopage = LinuxDriverLockedNoPage
196
#endif
178
#endif
179
static void LinuxDriverPollTimeout(unsigned long clientData);
180
static int LinuxDriverMmap(struct file *filp, struct vm_area_struct *vma);
181
182
static int LinuxDriverNoPage(struct vm_area_struct *vma,
183
	                           struct vm_fault *fdata);
184
static int LinuxDriverLockedNoPage(struct vm_area_struct *vma,
185
				struct vm_fault *fdata);
186
187
static struct vm_operations_struct vmuser_mops = {
188
	        .fault = LinuxDriverNoPage
189
};
190
191
struct vm_operations_struct vmuser_locked_mops = {
192
		.fault = LinuxDriverLockedNoPage
197
};
193
};
198
194
199
static struct file_operations vmuser_fops;
195
static struct file_operations vmuser_fops;
Lines 576-582 Link Here
576
   memset(vmLinux, 0, sizeof *vmLinux);
572
   memset(vmLinux, 0, sizeof *vmLinux);
577
   vmLinux->version = LinuxDriverEmulatedVersion();
573
   vmLinux->version = LinuxDriverEmulatedVersion();
578
   /* If caller's euid was not 0, we are running devel build */
574
   /* If caller's euid was not 0, we are running devel build */
579
   vmLinux->maySetUid = current->euid != 0;
575
   vmLinux->maySetUid = current->cred->euid != 0;
580
   vmLinux->ctType = VMCIOBJ_NOT_SET;
576
   vmLinux->ctType = VMCIOBJ_NOT_SET;
581
577
582
   sema_init(&vmLinux->lock4Gb, 1);
578
   sema_init(&vmLinux->lock4Gb, 1);
Lines 1164-1216 Link Here
1164
 *-----------------------------------------------------------------------------
1160
 *-----------------------------------------------------------------------------
1165
 */
1161
 */
1166
1162
1167
#if defined(VMW_NOPAGE_2624)
1163
static int LinuxDriverNoPage(struct vm_area_struct *vma,//IN
1168
static int LinuxDriverFault(struct vm_area_struct *vma, //IN
1164
					struct vm_fault *fdata)
1169
			    struct vm_fault *fault)     //IN/OUT
1170
#elif defined(VMW_NOPAGE_261)
1171
static struct page *LinuxDriverNoPage(struct vm_area_struct *vma, //IN
1172
				      unsigned long address, 	  //IN
1173
				      int *type)		  //OUT: Fault type
1174
#elif defined(KERNEL_2_4_0)
1175
static struct page *LinuxDriverNoPage(struct vm_area_struct *vma, //IN
1176
				      unsigned long address, 	  //IN
1177
				      int unused)		  //nothing
1178
#else
1179
static unsigned long LinuxDriverNoPage(struct vm_area_struct *vma,//IN
1180
				       unsigned long address,	  //IN
1181
				       int write_access)	  //IN
1182
#endif
1183
{
1165
{
1184
	VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data;
1166
	VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data;
1185
	unsigned long pg;
1167
	unsigned long pg;
1186
	struct page* page;
1168
	struct page* page;
1187
	
1169
	
1188
#ifdef VMW_NOPAGE_2624
1170
	pg = fdata->pgoff;
1189
	pg = fault->pgoff;
1190
#else
1191
	pg = ((address - vma->vm_start) >> PAGE_SHIFT) + compat_vm_pgoff(vma);
1192
#endif
1193
	pg = VMMON_MAP_OFFSET(pg);
1171
	pg = VMMON_MAP_OFFSET(pg);
1194
	if (pg >= vmLinux->size4Gb) {
1172
	if (pg >= vmLinux->size4Gb) {
1195
#ifdef VMW_NOPAGE_2624
1196
		return VM_FAULT_SIGBUS;
1197
#else
1198
		return 0;
1173
		return 0;
1199
#endif
1200
	}
1174
	}
1201
	page = vmLinux->pages4Gb[pg];
1175
	page = vmLinux->pages4Gb[pg];
1202
	get_page(page);
1176
	get_page(page);
1203
#ifdef VMW_NOPAGE_2624
1177
	fdata->page = page;
1204
	fault->page = page;
1178
        return VM_FAULT_MINOR;
1205
	return 0;
1206
#elif defined(KERNEL_2_4_0)
1207
#ifdef VMW_NOPAGE_261
1208
        *type = VM_FAULT_MINOR;
1209
#endif
1210
	return page;
1211
#else
1212
	return page_address(page);
1213
#endif
1214
}
1179
}
1215
1180
1216
1181
Lines 1393-1398 Link Here
1393
   VMLinux *vmLinux = (VMLinux *) filp->private_data;
1358
   VMLinux *vmLinux = (VMLinux *) filp->private_data;
1394
   int retval = 0;
1359
   int retval = 0;
1395
   Vcpuid vcpuid;
1360
   Vcpuid vcpuid;
1361
   struct cred *new;
1396
1362
1397
   switch (iocmd) {
1363
   switch (iocmd) {
1398
   case IOCTL_VMX86_VERSION:
1364
   case IOCTL_VMX86_VERSION:
Lines 1527-1534 Link Here
1527
      devel_suid();
1493
      devel_suid();
1528
#else
1494
#else
1529
      if (vmLinux->maySetUid) {
1495
      if (vmLinux->maySetUid) {
1530
	 current->suid = 0;
1496
	 new = prepare_creds();
1531
	 cap_set_full(current->cap_permitted);
1497
	 if (!new) {
1498
		 retval = -ENOMEM;
1499
		 break;
1500
	 }
1501
	 new->suid = 0;
1502
	 cap_set_full(new->cap_permitted);
1503
	 commit_creds(new);
1532
	 retval = 0;
1504
	 retval = 0;
1533
      } else {
1505
      } else {
1534
	 retval = -EPERM;
1506
	 retval = -EPERM;
Lines 1793-1802 Link Here
1793
   }
1765
   }
1794
1766
1795
   case IOCTL_VMX86_ALLOW_CORE_DUMP:
1767
   case IOCTL_VMX86_ALLOW_CORE_DUMP:
1796
      if (current->euid == current->uid &&
1768
      if (new->euid == current_uid() &&
1797
	  current->fsuid == current->uid &&
1769
	  new->fsuid == current_uid() &&
1798
          current->egid == current->gid &&
1770
          new->egid == new->gid &&
1799
	  current->fsgid == current->gid) {
1771
	  new->fsgid == new->gid) {
1800
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) || defined(MMF_DUMPABLE)
1772
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23) || defined(MMF_DUMPABLE)
1801
         /* Dump core, readable by user. */
1773
         /* Dump core, readable by user. */
1802
         set_bit(MMF_DUMPABLE, &current->mm->flags);
1774
         set_bit(MMF_DUMPABLE, &current->mm->flags);
Lines 1813-1819 Link Here
1813
      break;
1785
      break;
1814
1786
1815
   case IOCTL_VMX86_BROADCAST_IPI:
1787
   case IOCTL_VMX86_BROADCAST_IPI:
1816
      retval = compat_smp_call_function(LinuxDriverIPIHandler, NULL, 1, 1);
1788
      retval = compat_smp_call_function(LinuxDriverIPIHandler, NULL, 1);
1817
      break;
1789
      break;
1818
1790
1819
#ifdef USE_PERFCTRS_HOSTED
1791
#ifdef USE_PERFCTRS_HOSTED
(-)vmmon-only-patched/linux/driver_compat.h (-52 / +5 lines)
Lines 268-289 Link Here
268
 *-----------------------------------------------------------------------------
268
 *-----------------------------------------------------------------------------
269
 */
269
 */
270
270
271
#if defined(VMW_NOPAGE_2624)
271
static int LinuxDriverLockedNoPage(struct vm_area_struct *vma, //IN
272
static int LinuxDriverLockedFault(struct vm_area_struct *vma, //IN
272
					struct vm_fault *fdata)
273
				  struct vm_fault *fault)     //IN/OUT
274
#elif defined(VMW_NOPAGE_261)
275
static struct page *LinuxDriverLockedNoPage(struct vm_area_struct *vma, //IN
276
				            unsigned long address,      //IN
277
				            int *type)		        //OUT: Fault type
278
#elif defined(KERNEL_2_4_0)
279
static struct page *LinuxDriverLockedNoPage(struct vm_area_struct *vma, //IN
280
				            unsigned long address,      //IN
281
				            int unused)		        //nothing
282
#else
283
static unsigned long LinuxDriverLockedNoPage(struct vm_area_struct *vma, //IN
284
				             unsigned long address,      //IN
285
				             int unused)	        //nothing
286
#endif
287
{
273
{
288
   VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data;
274
   VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data;
289
   unsigned long pg;
275
   unsigned long pg;
Lines 291-357 Link Here
291
   struct VMHostEntry* vmhe;
277
   struct VMHostEntry* vmhe;
292
   struct page* result;
278
   struct page* result;
293
	
279
	
294
#ifdef VMW_NOPAGE_2624
280
   pg = fdata->pgoff;
295
   pg = fault->pgoff;
296
#else
297
   pg = ((address - vma->vm_start) >> PAGE_SHIFT) + compat_vm_pgoff(vma);
298
#endif
299
   if (pg >= vmLinux->sizeLocked) {
281
   if (pg >= vmLinux->sizeLocked) {
300
      printk(KERN_DEBUG "vmmon: Something went wrong: entry %08lX out of range (>=%08X) for mapping on filp %p\n", pg, vmLinux->sizeLocked, vmLinux);
282
      printk(KERN_DEBUG "vmmon: Something went wrong: entry %08lX out of range (>=%08X) for mapping on filp %p\n", pg, vmLinux->sizeLocked, vmLinux);
301
#ifdef VMW_NOPAGE_2624
302
      return VM_FAULT_SIGBUS;
303
#else
304
      return NOPAGE_SIGBUS;
283
      return NOPAGE_SIGBUS;
305
#endif
306
   }
284
   }
307
   if (!vmLinux->vm || !vmLinux->vm->vmhost) {
285
   if (!vmLinux->vm || !vmLinux->vm->vmhost) {
308
      printk(KERN_DEBUG "vmmon: Something went wrong: no vm or vmhost for mapping on filp %p\n", vmLinux);
286
      printk(KERN_DEBUG "vmmon: Something went wrong: no vm or vmhost for mapping on filp %p\n", vmLinux);
309
#ifdef VMW_NOPAGE_2624
310
      return VM_FAULT_SIGBUS;
311
#else
312
      return NOPAGE_SIGBUS;
287
      return NOPAGE_SIGBUS;
313
#endif
314
   }
288
   }
315
   pgt = vmLinux->pagesLocked->ent[pg / VMHOST_MAPPING_PT];
289
   pgt = vmLinux->pagesLocked->ent[pg / VMHOST_MAPPING_PT];
316
   if (!pgt) {
290
   if (!pgt) {
317
      printk(KERN_DEBUG "vmmon: Something went wrong: missing entry %08lX from mapping on filp %p\n", pg, vmLinux);
291
      printk(KERN_DEBUG "vmmon: Something went wrong: missing entry %08lX from mapping on filp %p\n", pg, vmLinux);
318
#ifdef VMW_NOPAGE_2624
319
      return VM_FAULT_SIGBUS;
320
#else
321
      return NOPAGE_SIGBUS;
292
      return NOPAGE_SIGBUS;
322
#endif
323
   }
293
   }
324
   vmhe = kmap(pgt);
294
   vmhe = kmap(pgt);
325
   result = vmhe->ent[pg % VMHOST_MAPPING_PT];
295
   result = vmhe->ent[pg % VMHOST_MAPPING_PT];
326
   kunmap(pgt);
296
   kunmap(pgt);
327
   if (!result) {
297
   if (!result) {
328
      printk(KERN_DEBUG "vmmon: Something went wrong: attempt to access non-existing entry %08lX in mapping on filp %p\n", pg, vmLinux);
298
      printk(KERN_DEBUG "vmmon: Something went wrong: attempt to access non-existing entry %08lX in mapping on filp %p\n", pg, vmLinux);
329
#ifdef VMW_NOPAGE_2624
330
      return VM_FAULT_SIGBUS;
331
#else
332
      return NOPAGE_SIGBUS;
299
      return NOPAGE_SIGBUS;
333
#endif
334
   }
300
   }
335
   if (!PhysTrack_Test(vmLinux->vm->vmhost->AWEPages, page_to_pfn(result))) {
301
   if (!PhysTrack_Test(vmLinux->vm->vmhost->AWEPages, page_to_pfn(result))) {
336
      printk(KERN_DEBUG "vmmon: MPN %08lX not tracked! Someone released it before removing it from VA first!\n", pg);
302
      printk(KERN_DEBUG "vmmon: MPN %08lX not tracked! Someone released it before removing it from VA first!\n", pg);
337
#ifdef VMW_NOPAGE_2624
338
      return VM_FAULT_SIGBUS;
339
#else
340
      return NOPAGE_SIGBUS;
303
      return NOPAGE_SIGBUS;
341
#endif
342
   }
304
   }
343
   get_page(result);
305
   get_page(result);
344
#if defined(VMW_NOPAGE_2624)
306
   fdata->page = result;
345
   fault->page = result;
307
   return VM_FAULT_MINOR;
346
   return 0;
347
#elif defined(KERNEL_2_4_0)
348
#ifdef VMW_NOPAGE_261
349
   *type = VM_FAULT_MINOR;
350
#endif
351
   return result;
352
#else
353
   return page_address(result);
354
#endif
355
}
308
}
356
309
357
310
(-)vmmon-only-patched/linux/driver.h (-1 / +2 lines)
Lines 90-96 Link Here
90
   struct VMLinux **pollBack;
90
   struct VMLinux **pollBack;
91
} VMLinux;
91
} VMLinux;
92
92
93
extern struct vm_operations_struct vmuser_locked_mops;
93
//extern struct vm_operations_struct vmuser_locked_mops;
94
#define VMHOST_MAPPING_PD	(PAGE_SIZE / sizeof(void*))
94
#define VMHOST_MAPPING_PD	(PAGE_SIZE / sizeof(void*))
95
#define VMHOST_MAPPING_PT	(PAGE_SIZE / sizeof(void*))
95
#define VMHOST_MAPPING_PT	(PAGE_SIZE / sizeof(void*))
96
struct VMHostEntry {
96
struct VMHostEntry {
Lines 131-136 Link Here
131
   spinlock_t pollListLock;
131
   spinlock_t pollListLock;
132
#endif
132
#endif
133
133
134
//   volatile int fastClockThread;
134
   volatile struct task_struct *fastClockThread;
135
   volatile struct task_struct *fastClockThread;
135
   unsigned fastClockRate;
136
   unsigned fastClockRate;
136
137
(-)vmmon-only-patched/linux/hostif.c (-157 / +49 lines)
Lines 18-23 Link Here
18
#include "compat_page.h"
18
#include "compat_page.h"
19
#include <linux/binfmts.h>
19
#include <linux/binfmts.h>
20
#include <linux/fs.h>
20
#include <linux/fs.h>
21
#include <linux/kthread.h>
21
#include "compat_sched.h"
22
#include "compat_sched.h"
22
#include <linux/file.h>
23
#include <linux/file.h>
23
#ifdef KERNEL_2_2
24
#ifdef KERNEL_2_2
Lines 70-79 Link Here
70
#include "compat_timer.h"
71
#include "compat_timer.h"
71
#include "x86.h"
72
#include "x86.h"
72
73
73
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
74
#include <linux/kthread.h>
75
#include <linux/mutex.h>
76
#endif
77
static COMPAT_DECLARE_COMPLETION(fastClockExited);
74
static COMPAT_DECLARE_COMPLETION(fastClockExited);
78
75
79
/*
76
/*
Lines 140-234 Link Here
140
#define HOST_ISTRACKED_PFN(_vm, _pfn) (PhysTrack_Test(_vm->physTracker, _pfn))
137
#define HOST_ISTRACKED_PFN(_vm, _pfn) (PhysTrack_Test(_vm->physTracker, _pfn))
141
138
142
139
143
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24))
144
/*
145
 *-----------------------------------------------------------------------------
146
 *
147
 * MutexInit --
148
 *
149
 *      Initialize a Mutex. --hpreg
150
 *
151
 * Results:
152
 *      None
153
 *
154
 * Side effects:
155
 *      None
156
 *
157
 *-----------------------------------------------------------------------------
158
 */
159
160
#define MutexInit(_mutex, _name) mutex_init(_mutex)
161
/*
162
 *-----------------------------------------------------------------------------
163
 *
164
 * MutexIsLocked --
165
 *
166
 *      Determine if a Mutex is locked by the current thread. --hpreg
167
 *
168
 * Results:
169
 *      TRUE if yes
170
 *      FALSE if no
171
 *
172
 * Side effects:
173
 *      None
174
 *
175
 *-----------------------------------------------------------------------------
176
 */
177
178
#define MutexIsLocked(_mutex) mutex_is_locked(_mutex)
179
180
/*
181
 *-----------------------------------------------------------------------------
182
 *
183
 * MutexLock --
184
 *
185
 *      Acquire a Mutex. --hpreg
186
 *
187
 * Results:
188
 *      None
189
 *
190
 * Side effects:
191
 *      None
192
 *
193
 *-----------------------------------------------------------------------------
194
 */
195
196
#define MutexLock(_mutex, _callerID) mutex_lock(_mutex)
197
198
/*
199
 *-----------------------------------------------------------------------------
200
 *
201
 * MutexUnlock --
202
 *
203
 *      Release a Mutex. --hpreg
204
 *
205
 * Results:
206
 *      None
207
 *
208
 * Side effects:
209
 *      None
210
 *
211
 *-----------------------------------------------------------------------------
212
 */
213
214
#define MutexUnlock(_mutex, _callerID) mutex_unlock(_mutex)
215
216
/* This mutex protects the driver-wide state. --hpreg */
217
static DEFINE_MUTEX(globalMutex);
218
219
/*
220
 * This mutex protects the fast clock rate and is held while
221
 * creating/destroying the fastClockThread.  It ranks below
222
 * globalMutex.  We can't use globalMutex for this purpose because the
223
 * fastClockThread itself acquires the globalMutex, so trying to hold
224
 * the mutex while destroying the thread can cause a deadlock.
225
 */
226
static DEFINE_MUTEX(fastClockMutex);
227
228
/* This mutex protects linuxState.pollList.  */
229
static DEFINE_MUTEX(pollListMutex);
230
231
#else
232
/*
140
/*
233
 *-----------------------------------------------------------------------------
141
 *-----------------------------------------------------------------------------
234
 *
142
 *
Lines 371-377 Link Here
371
/* This mutex protects linuxState.pollList.  */
279
/* This mutex protects linuxState.pollList.  */
372
static Mutex pollListMutex;
280
static Mutex pollListMutex;
373
281
374
#endif /* USE_KTHREAD */
375
282
376
/*
283
/*
377
 *-----------------------------------------------------------------------------
284
 *-----------------------------------------------------------------------------
Lines 444-450 Link Here
444
   MutexUnlock(&globalMutex, callerID);
351
   MutexUnlock(&globalMutex, callerID);
445
}
352
}
446
353
447
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
354
448
#ifdef VMX86_DEBUG
355
#ifdef VMX86_DEBUG
449
/*
356
/*
450
 *-----------------------------------------------------------------------------
357
 *-----------------------------------------------------------------------------
Lines 469-475 Link Here
469
   return MutexIsLocked(&globalMutex);
376
   return MutexIsLocked(&globalMutex);
470
}
377
}
471
#endif
378
#endif
472
#endif
473
379
474
380
475
/*
381
/*
Lines 564-570 Link Here
564
   MutexUnlock(&pollListMutex, callerID);
470
   MutexUnlock(&pollListMutex, callerID);
565
}
471
}
566
472
567
568
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 3)
473
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 3)
569
static INLINE void
474
static INLINE void
570
down_write_mmap(void)
475
down_write_mmap(void)
Lines 620-626 Link Here
620
   up_write_mmap();
525
   up_write_mmap();
621
}
526
}
622
#endif
527
#endif
623
624
/*
528
/*
625
 *----------------------------------------------------------------------
529
 *----------------------------------------------------------------------
626
 * 
530
 * 
Lines 678-684 Link Here
678
#else
582
#else
679
      pte_val(*pte) &= ~_PAGE_NX;
583
      pte_val(*pte) &= ~_PAGE_NX;
680
#endif
584
#endif
681
      compat_smp_call_function (TLBInvalidatePage, (void *)vaddr, 1, 1);
585
      smp_call_function (TLBInvalidatePage, (void *)vaddr, 1);
682
      TLBInvalidatePage((void *)vaddr);
586
      TLBInvalidatePage((void *)vaddr);
683
   }
587
   }
684
   if (ptemap) {
588
   if (ptemap) {
Lines 2911-2917 Link Here
2911
      if (targetHostCpu != INVALID_HOST_CPU) {
2815
      if (targetHostCpu != INVALID_HOST_CPU) {
2912
	 ASSERT(targetHostCpu < MAX_PROCESSORS);
2816
	 ASSERT(targetHostCpu < MAX_PROCESSORS);
2913
         (void) compat_smp_call_function(LinuxDriverIPIHandler,
2817
         (void) compat_smp_call_function(LinuxDriverIPIHandler,
2914
                                         NULL, 1, 1);
2818
                                         NULL, 1);
2915
         return TRUE;
2819
         return TRUE;
2916
      }
2820
      }
2917
   }
2821
   }
Lines 3099-3105 Link Here
3099
{
3003
{
3100
   compat_preempt_disable();
3004
   compat_preempt_disable();
3101
   HostIFFillCPUID((void*)info);
3005
   HostIFFillCPUID((void*)info);
3102
   (void)compat_smp_call_function(HostIFFillCPUID, (void*)info, 1, 1);
3006
   (void)compat_smp_call_function(HostIFFillCPUID, (void*)info, 1);
3103
   compat_preempt_enable();
3007
   compat_preempt_enable();
3104
}
3008
}
3105
3009
Lines 3136-3142 Link Here
3136
   compat_preempt_disable();
3040
   compat_preempt_disable();
3137
   HostIFBrokenCPUHelper((void*)&badcpumask); // run on this machine CPU
3041
   HostIFBrokenCPUHelper((void*)&badcpumask); // run on this machine CPU
3138
   (void)compat_smp_call_function(HostIFBrokenCPUHelper, (void*)&badcpumask, 
3042
   (void)compat_smp_call_function(HostIFBrokenCPUHelper, (void*)&badcpumask, 
3139
                                  1, 1); // run on all other machine CPUs
3043
                                  1); // run on all other machine CPUs
3140
   compat_preempt_enable();
3044
   compat_preempt_enable();
3141
3045
3142
   return badcpumask;
3046
   return badcpumask;
Lines 3335-3380 Link Here
3335
/*
3239
/*
3336
 *----------------------------------------------------------------------
3240
 *----------------------------------------------------------------------
3337
 *
3241
 *
3338
 * HostIFDoIoctl --
3339
 *
3340
 *    Issue ioctl.  Assume kernel is not locked.  It is not true now,
3341
 *    but it makes things easier to understand, and won't surprise us
3342
 *    later when we get rid of kernel lock from our code.
3343
 *
3344
 * Results:
3345
 *    Same as ioctl method.
3346
 *
3347
 * Side effects:
3348
 *    none.
3349
 *
3350
 *---------------------------------------------------------------------- 
3351
 */
3352
3353
static long
3354
HostIFDoIoctl(struct file *filp,
3355
              u_int iocmd,
3356
              unsigned long ioarg)
3357
{
3358
#ifdef HAVE_UNLOCKED_IOCTL
3359
   if (filp->f_op->unlocked_ioctl) {
3360
      return filp->f_op->unlocked_ioctl(filp, iocmd, ioarg);
3361
   }
3362
#endif
3363
   if (filp->f_op->ioctl) {
3364
      long err;
3365
3366
      lock_kernel();
3367
      err = filp->f_op->ioctl(filp->f_dentry->d_inode, filp, iocmd, ioarg);
3368
      unlock_kernel();
3369
      return err;
3370
   }
3371
   return -ENOIOCTLCMD;
3372
}
3373
3374
3375
/*
3376
 *----------------------------------------------------------------------
3377
 *
3378
 * HostIFFastClockThread --
3242
 * HostIFFastClockThread --
3379
 *
3243
 *
3380
 *      Kernel thread that provides finer-grained wakeups than the
3244
 *      Kernel thread that provides finer-grained wakeups than the
Lines 3399-3413 Link Here
3399
   int res;
3263
   int res;
3400
   mm_segment_t oldFS;
3264
   mm_segment_t oldFS;
3401
   unsigned rate = 0;
3265
   unsigned rate = 0;
3266
   struct cred *cred;
3402
3267
3403
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
3404
   compat_daemonize("vmware-rtc");
3268
   compat_daemonize("vmware-rtc");
3405
#endif
3406
   oldFS = get_fs();
3269
   oldFS = get_fs();
3407
   set_fs(KERNEL_DS);
3270
   set_fs(KERNEL_DS);
3408
   compat_allow_signal(SIGKILL);
3271
   compat_allow_signal(SIGKILL);
3409
   cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
3272
   cred = prepare_creds();
3410
   compat_set_user_nice(current, -20);
3273
   if(!cred)
3274
	   return -ENOMEM;
3275
   cap_raise(cred->cap_effective, CAP_SYS_RESOURCE);
3276
   commit_creds(cred);
3277
3278
   //compat_set_user_nice(current, -20);
3411
3279
3412
   while (linuxState.fastClockRate > HZ + HZ/16) {
3280
   while (linuxState.fastClockRate > HZ + HZ/16) {
3413
      unsigned long buf;
3281
      unsigned long buf;
Lines 3423-3429 Link Here
3423
            p2rate <<= 1;
3291
            p2rate <<= 1;
3424
         }
3292
         }
3425
3293
3426
         res = HostIFDoIoctl(filp, RTC_IRQP_SET, p2rate);
3294
         res = filp->f_op->ioctl(filp->f_dentry->d_inode,
3295
                                 filp, RTC_IRQP_SET, p2rate);
3427
         if (res < 0) {
3296
         if (res < 0) {
3428
            Warning("/dev/rtc set rate %d failed: %d\n", p2rate, res);
3297
            Warning("/dev/rtc set rate %d failed: %d\n", p2rate, res);
3429
            goto out;
3298
            goto out;
Lines 3526-3556 Link Here
3526
   if (rate > HZ + HZ/16) {
3395
   if (rate > HZ + HZ/16) {
3527
      if (!linuxState.fastClockThread) {
3396
      if (!linuxState.fastClockThread) {
3528
         struct file *filp;
3397
         struct file *filp;
3398
	 struct cred *cred;
3529
         int fsuid, res;
3399
         int fsuid, res;
3530
         Bool cap;
3400
         Bool cap;
3531
		 struct task_struct *t;
3401
	 struct task_struct *t;
3532
3402
3533
         fsuid = current->fsuid;
3403
         /*fsuid = current->fsuid;
3534
         current->fsuid = 0;
3404
         current->fsuid = 0;
3405
	 */
3406
	 cred = prepare_creds();
3407
	 fsuid = cred->fsuid;
3408
	 cred->fsuid = 0;
3409
	 commit_creds(cred);
3535
         filp = filp_open("/dev/rtc", O_RDONLY, 0);
3410
         filp = filp_open("/dev/rtc", O_RDONLY, 0);
3536
         current->fsuid = fsuid;
3411
	 cred = prepare_creds();
3412
	 cred->fsuid = fsuid;
3413
	 commit_creds(cred);
3414
         //current->fsuid = fsuid;
3537
         if (IS_ERR(filp) || !filp) {
3415
         if (IS_ERR(filp) || !filp) {
3538
            Warning("/dev/rtc open failed: %d\n", (int)(VA)filp);
3416
            Warning("/dev/rtc open failed: %d\n", (int)(VA)filp);
3539
            return -(int)(VA)filp;
3417
            return -(int)(VA)filp;
3540
         }
3418
         }
3541
         cap = cap_raised(current->cap_effective, CAP_SYS_RESOURCE);
3419
 /*        cap = cap_raised(current->cap_effective, CAP_SYS_RESOURCE);
3542
         cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
3420
         cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
3543
         res = HostIFDoIoctl(filp, RTC_PIE_ON, 0);
3421
*/
3422
	 cred = prepare_creds();
3423
	 cap = cap_raised(cred->cap_effective, CAP_SYS_RESOURCE);
3424
	 cap_raise(cred->cap_effective, CAP_SYS_RESOURCE);
3425
	 commit_creds(cred);
3426
	 if (filp->f_op->ioctl) {
3427
		lock_kernel();
3428
         	res = filp->f_op->ioctl(filp->f_path.dentry->d_inode, filp, RTC_PIE_ON, 0);
3429
		unlock_kernel();
3430
	}
3431
	 else 
3432
		 res = -1;
3544
         if (!cap) {
3433
         if (!cap) {
3545
            cap_lower(current->cap_effective, CAP_SYS_RESOURCE);            
3434
		 cred = prepare_creds();
3435
        //    cap_lower(current->cap_effective, CAP_SYS_RESOURCE);            
3436
		cap_lower(cred->cap_effective, CAP_SYS_RESOURCE);
3437
		commit_creds(cred);
3546
         }
3438
         }
3547
         if (res < 0) {
3439
         if (res < 0) {
3548
            Warning("/dev/rtc enable interrupt failed: %d\n", res);
3440
            Warning("/dev/rtc enable interrupt failed: %d\n", res);
3549
            compat_filp_close(filp, current->files);
3441
            compat_filp_close(filp, current->files);
3550
            return -res;
3442
            return -res;
3551
         }
3443
         }
3552
	 	 t = kthread_create(HostIFFastClockThread, filp, "vmware-rtc");
3444
	 t = kthread_create(HostIFFastClockThread, filp, "vmware-rtc");
3553
	 	 if (IS_ERR(t)) {
3445
	 if (IS_ERR(t)) {
3554
            /*
3446
            /*
3555
             * Ignore ERESTARTNOINTR silently, it occurs when signal is
3447
             * Ignore ERESTARTNOINTR silently, it occurs when signal is
3556
             * pending, and syscall layer automatically reissues operation
3448
             * pending, and syscall layer automatically reissues operation
Lines 3563-3573 Link Here
3563
            return -PTR_ERR(t);
3455
            return -PTR_ERR(t);
3564
         }
3456
         }
3565
         linuxState.fastClockThread = t;
3457
         linuxState.fastClockThread = t;
3566
	 	 wake_up_process(t);
3458
	 wake_up_process(t);
3567
      }
3459
      }
3568
   } else {
3460
   } else {
3569
      if (linuxState.fastClockThread) {
3461
      if (linuxState.fastClockThread) {
3570
         send_sig(SIGKILL, linuxState.fastClockThread, 1);
3462
	 send_sig(SIGKILL, linuxState.fastClockThread, 1);
3571
         compat_wait_for_completion(&fastClockExited);
3463
         compat_wait_for_completion(&fastClockExited);
3572
         linuxState.fastClockThread = NULL;
3464
         linuxState.fastClockThread = NULL;
3573
      }
3465
      }
(-)vmmon-only-patched/linux/hostif_compat.h (-2 / +5 lines)
Lines 93-103 Link Here
93
      }
93
      }
94
      return -EFAULT;
94
      return -EFAULT;
95
   }
95
   }
96
   /*
96
   if (vma->vm_ops != &vmuser_locked_mops) {
97
   if (vma->vm_ops != &vmuser_locked_mops) {
97
      printk(KERN_DEBUG "Found non-vmmon VMA (%#lX-%#lX) for VA %p\n", 
98
      printk(KERN_DEBUG "Found non-vmmon VMA (%#lX-%#lX) for VA %p\n", 
98
             vma->vm_start, vma->vm_end, (void*)va);
99
             vma->vm_start, vma->vm_end, (void*)va);
99
      return -EINVAL;
100
      return -EINVAL;
100
   }
101
   }
102
   */
101
   vmLinux = (VMLinux*)vma->vm_file->private_data;
103
   vmLinux = (VMLinux*)vma->vm_file->private_data;
102
   if (!vmLinux) {
104
   if (!vmLinux) {
103
      printk(KERN_DEBUG "Found vmmon VMA (%#lX-%#lX) for VA %p"
105
      printk(KERN_DEBUG "Found vmmon VMA (%#lX-%#lX) for VA %p"
Lines 367-373 Link Here
367
{
369
{
368
   compat_preempt_disable();
370
   compat_preempt_disable();
369
   HostIFSystemCallResetMSR(regs);
371
   HostIFSystemCallResetMSR(regs);
370
   (void)compat_smp_call_function(HostIFSystemCallResetMSR, (void *)regs, 1, 1);
372
   (void)compat_smp_call_function(HostIFSystemCallResetMSR, (void *)regs, 1);
371
   compat_preempt_enable();
373
   compat_preempt_enable();
372
}
374
}
373
375
Lines 775-781 Link Here
775
      }
777
      }
776
   }
778
   }
777
   
779
   
778
   mpn = PgtblVa2MPN(__fix_to_virt(VMWARE__FIX_IO_APIC_BASE));
780
   //mpn = PgtblVa2MPN(__fix_to_virt(VMWARE__FIX_IO_APIC_BASE));
781
   mpn = PgtblVa2MPN(__fix_to_virt(FIX_IO_APIC_BASE_0));
779
   if (mpn == INVALID_MPN) {
782
   if (mpn == INVALID_MPN) {
780
      return 0;
783
      return 0;
781
   }
784
   }
(-)vmmon-only-patched/linux/vmhost.h (-6 / +2 lines)
Lines 13-19 Link Here
13
#include "compat_semaphore.h"
13
#include "compat_semaphore.h"
14
#include "compat_wait.h"
14
#include "compat_wait.h"
15
15
16
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
16
17
#ifdef VMX86_DEBUG
17
#ifdef VMX86_DEBUG
18
/*
18
/*
19
 * A MutexHolder object. In debug builds, we record information about the
19
 * A MutexHolder object. In debug builds, we record information about the
Lines 54-60 Link Here
54
   MutexHolder cur;
54
   MutexHolder cur;
55
#endif
55
#endif
56
} Mutex;
56
} Mutex;
57
#endif
57
58
58
59
/*
59
/*
60
 * Per-vm host-specific state.
60
 * Per-vm host-specific state.
Lines 65-75 Link Here
65
    * Used for shared modifications to VM's VMDriver data, mostly page locking.
65
    * Used for shared modifications to VM's VMDriver data, mostly page locking.
66
    * It has higher rank than the global mutex.
66
    * It has higher rank than the global mutex.
67
    */
67
    */
68
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
69
   struct mutex vmMutex;
70
#else
71
   Mutex vmMutex;
68
   Mutex vmMutex;
72
#endif
73
69
74
   atomic_t           pendingUserCalls;
70
   atomic_t           pendingUserCalls;
75
   wait_queue_head_t  callQueue;
71
   wait_queue_head_t  callQueue;
(-)vmmon-only-patched/linux/vmmonInt.h (-10 / +1 lines)
Lines 31-46 Link Here
31
} while (0)
31
} while (0)
32
#endif
32
#endif
33
33
34
#if defined(CONFIG_SMP) && LINUX_VERSION_CODE >= KERNEL_VERSION(2, 2, 8)
34
#define compat_smp_call_function(fn, info, wait) smp_call_function(fn, info, wait)
35
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
36
#define compat_smp_call_function(_a0,_a1,_a2,_a3) smp_call_function(_a0,_a1,_a3)
37
#else
38
#define compat_smp_call_function smp_call_function
39
#endif
40
#else
41
#define compat_smp_call_function(_a0,_a1,_a2,_a3) 0
42
#endif
43
44
35
45
/*
36
/*
46
 * Although this is not really related to kernel-compatibility, I put this
37
 * Although this is not really related to kernel-compatibility, I put this
(-)vmmon-only-patched/Makefile (-1 / +1 lines)
Lines 15-21 Link Here
15
VM_UNAME = $(shell uname -r)
15
VM_UNAME = $(shell uname -r)
16
16
17
# Header directory for the running kernel
17
# Header directory for the running kernel
18
HEADER_DIR = ${KERNEL_DIR}/include
18
HEADER_DIR = /lib/modules/$(VM_UNAME)/build/include
19
19
20
BUILD_DIR = $(HEADER_DIR)/..
20
BUILD_DIR = $(HEADER_DIR)/..
21
21
(-)vmmon-only-patched/Makefile.kernel (-4 / +6 lines)
Lines 16-33 Link Here
16
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/nopage1.c, -DVMW_NOPAGE_261, )
16
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/nopage1.c, -DVMW_NOPAGE_261, )
17
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/skas1.c,   -DVMW_SKAS_MMAP, )
17
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/skas1.c,   -DVMW_SKAS_MMAP, )
18
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/ioapic.c,	\
18
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/ioapic.c,	\
19
		-DVMWARE__FIX_IO_APIC_BASE=FIX_IO_APIC_BASE_0,		\
19
		-DVMWARE__FIX_IO_APIC_BASE=FIX_IO_APIC_BASE_0)		
20
		-DVMWARE__FIX_IO_APIC_BASE=FIX_IO_APIC_BASE )
20
#		-DVMWARE__FIX_IO_APIC_BASE=FIX_IO_APIC_BASE ) #only for UP ?
21
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/epoll.c,   -DVMW_HAVE_EPOLL, )
21
#EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/epoll.c,   -DVMW_HAVE_EPOLL, )
22
EXTRA_CFLAGS += "-DVMW_HAVE_EPOLL"
22
EXTRA_CFLAGS += $(shell if [ -f $(HEADER_DIR)/linux/compile.h ]; then echo "-DVMW_HAVE_COMPILE_H"; fi)
23
EXTRA_CFLAGS += $(shell if [ -f $(HEADER_DIR)/linux/compile.h ]; then echo "-DVMW_HAVE_COMPILE_H"; fi)
23
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/setnice.c, -DVMW_HAVE_SET_USER_NICE, )
24
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/setnice.c, -DVMW_HAVE_SET_USER_NICE, )
25
EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/smpcall.c, -DVMW_HAVE_SMP_CALL_3ARG, )
24
26
25
CXX_KFLAGS := $(call vm_check_gxx,-fno-exceptions,)
27
CXX_KFLAGS := $(call vm_check_gxx,-fno-exceptions,)
26
28
27
# 2.6.x build system
29
# 2.6.x build system
28
CFLAGS_task.o := -x c++ $(CXX_KFLAGS)
30
CFLAGS_task.o := -x c++ $(CXX_KFLAGS)
29
# 2.4.x build system
31
# 2.4.x build system
30
CFLAGS_common/task.o := $(CFLAGS_task.o)
32
#CFLAGS_common/task.o := $(CFLAGS_task.o)
31
33
32
obj-m += $(DRIVER).o
34
obj-m += $(DRIVER).o
33
35
(-)vmmon-only-patched/Makefile.normal (-2 / +2 lines)
Lines 67-74 Link Here
67
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/nopage1.c, -DVMW_NOPAGE_261, )
67
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/nopage1.c, -DVMW_NOPAGE_261, )
68
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/skas1.c,   -DVMW_SKAS_MMAP, )
68
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/skas1.c,   -DVMW_SKAS_MMAP, )
69
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/ioapic.c,	\
69
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/ioapic.c,	\
70
		-DVMWARE__FIX_IO_APIC_BASE=FIX_IO_APIC_BASE_0,	\
70
		-DVMWARE__FIX_IO_APIC_BASE=FIX_IO_APIC_BASE_0)
71
		-DVMWARE__FIX_IO_APIC_BASE=FIX_IO_APIC_BASE )
71
#		-DVMWARE__FIX_IO_APIC_BASE=FIX_IO_APIC_BASE ) #up?
72
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/epoll.c,   -DVMW_HAVE_EPOLL, )
72
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/epoll.c,   -DVMW_HAVE_EPOLL, )
73
CC_OPTS += $(shell if [ -f $(HEADER_DIR)/linux/compile.h ]; then echo "-DVMW_HAVE_COMPILE_H"; fi)
73
CC_OPTS += $(shell if [ -f $(HEADER_DIR)/linux/compile.h ]; then echo "-DVMW_HAVE_COMPILE_H"; fi)
74
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/setnice.c, -DVMW_HAVE_SET_USER_NICE, )
74
CC_OPTS += $(call vm_check_build, $(SRCROOT)/autoconf/setnice.c, -DVMW_HAVE_SET_USER_NICE, )
(-)vmmon-only-patched/Module.markers (+4 lines)
Line 0 Link Here
1
core_marker_format	vmlinux	name %s format %s
2
kernel_sched_schedule	vmlinux	prev_pid %d next_pid %d prev_state %ld ## rq %p prev %p next %p
3
kernel_sched_wakeup	vmlinux	pid %d state %ld ## rq %p task %p rq->curr %p
4
kernel_sched_wakeup_new	vmlinux	pid %d state %ld ## rq %p task %p rq->curr %p
(-)vmmon-only-patched/modules.order (+1 lines)
Line 0 Link Here
1
kernel//home/kang/tmp/vmware-update-2.6.27-5.5.7-2/vmmon-only/vmmon.ko

Return to bug 273173