VirtualBox

Ticket #13961: diff_smap_4

File diff_smap_4, 4.0 KB (added by Frank Mehnert, 11 years ago)
Line
1 diff -u '--exclude=.svn' '--exclude=CVS' '--exclude=.*.d' '--exclude=.depend' '--exclude=.hdepend' '--exclude=.*.flags' -r e/vboxdrv/linux/SUPDrv-linux.c f/vboxdrv/linux/SUPDrv-linux.c
2 --- e/vboxdrv/linux/SUPDrv-linux.c 2015年03月20日 15:24:13.000000000 +0100
3 +++ f/vboxdrv/linux/SUPDrv-linux.c 2015年03月20日 15:23:51.000000000 +0100
4 @@ -48,12 +48,6 @@
5 # include <iprt/power.h>
6 # define VBOX_WITH_SUSPEND_NOTIFICATION
7 #endif
8 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
9 -# include <asm/smap.h>
10 -#else
11 -static inline void clac(void) { }
12 -static inline void stac(void) { }
13 -#endif
14
15 #include <linux/sched.h>
16 #ifdef CONFIG_DEVFS_FS
17 diff -u '--exclude=.svn' '--exclude=CVS' '--exclude=.*.d' '--exclude=.depend' '--exclude=.hdepend' '--exclude=.*.flags' -r e/vboxdrv/r0drv/linux/the-linux-kernel.h f/vboxdrv/r0drv/linux/the-linux-kernel.h
18 --- e/vboxdrv/r0drv/linux/the-linux-kernel.h 2015年03月20日 15:24:13.000000000 +0100
19 +++ f/vboxdrv/r0drv/linux/the-linux-kernel.h 2015年03月20日 15:23:52.000000000 +0100
20 @@ -145,6 +145,13 @@
21 # include <asm/tlbflush.h>
22 #endif
23
24 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
25 +# include <asm/smap.h>
26 +#else
27 +static inline void clac(void) { }
28 +static inline void stac(void) { }
29 +#endif
30 +
31 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
32 # ifndef page_to_pfn
33 # define page_to_pfn(page) ((page) - mem_map)
34 diff -u '--exclude=.svn' '--exclude=CVS' '--exclude=.*.d' '--exclude=.depend' '--exclude=.hdepend' '--exclude=.*.flags' -r e/vboxdrv/r0drv/linux/threadctxhooks-r0drv-linux.c f/vboxdrv/r0drv/linux/threadctxhooks-r0drv-linux.c
35 --- e/vboxdrv/r0drv/linux/threadctxhooks-r0drv-linux.c 2015年03月20日 15:24:13.000000000 +0100
36 +++ f/vboxdrv/r0drv/linux/threadctxhooks-r0drv-linux.c 2015年03月20日 15:23:52.000000000 +0100
37 @@ -36,6 +36,9 @@
38 #include <iprt/thread.h>
39 #include <iprt/err.h>
40 #include <iprt/asm.h>
41 +#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
42 +# include <iprt/asm-amd64-x86.h>
43 +#endif
44 #include "internal/thread.h"
45
46 /*
47 @@ -68,6 +71,11 @@
48 struct preempt_ops hPreemptOps;
49 /** The reference count for this object. */
50 uint32_t volatile cRefs;
51 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 19) && defined(RT_ARCH_AMD64)
52 + /** Starting with 3.1.19, the linux kernel doesn't restore kernel RFLAGS during
53 + * task switch, so we have to do that ourselves. (x86 code is not affected.) */
54 + RTCCUINTREG fSavedRFlags;
55 +#endif
56 } RTTHREADCTXINT, *PRTTHREADCTXINT;
57
58
59 @@ -84,12 +92,24 @@
60 static void rtThreadCtxHooksLnxSchedOut(struct preempt_notifier *pPreemptNotifier, struct task_struct *pNext)
61 {
62 PRTTHREADCTXINT pThis = RT_FROM_MEMBER(pPreemptNotifier, RTTHREADCTXINT, hPreemptNotifier);
63 +#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
64 + RTCCUINTREG fSavedEFlags = ASMGetFlags();
65 + stac();
66 +#endif
67 +
68 AssertPtr(pThis);
69 AssertPtr(pThis->pfnThreadCtxHook);
70 Assert(pThis->fRegistered);
71 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
72
73 pThis->pfnThreadCtxHook(RTTHREADCTXEVENT_PREEMPTING, pThis->pvUser);
74 +
75 +#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
76 + ASMSetFlags(fSavedEFlags);
77 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 19) && defined(RT_ARCH_AMD64)
78 + pThis->fSavedRFlags = fSavedEFlags;
79 +# endif
80 +#endif
81 }
82
83
84 @@ -105,11 +125,24 @@
85 static void rtThreadCtxHooksLnxSchedIn(struct preempt_notifier *pPreemptNotifier, int iCpu)
86 {
87 PRTTHREADCTXINT pThis = RT_FROM_MEMBER(pPreemptNotifier, RTTHREADCTXINT, hPreemptNotifier);
88 +#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
89 + RTCCUINTREG fSavedEFlags = ASMGetFlags();
90 + stac();
91 +#endif
92 +
93 AssertPtr(pThis);
94 AssertPtr(pThis->pfnThreadCtxHook);
95 Assert(pThis->fRegistered);
96
97 pThis->pfnThreadCtxHook(RTTHREADCTXEVENT_RESUMED, pThis->pvUser);
98 +
99 +#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86)
100 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 19) && defined(RT_ARCH_AMD64)
101 + fSavedEFlags &= ~RT_BIT_64(18) /*X86_EFL_AC*/;
102 + fSavedEFlags |= pThis->fSavedRFlags & RT_BIT_64(18) /*X86_EFL_AC*/;
103 +# endif
104 + ASMSetFlags(fSavedEFlags);
105 +#endif
106 }
107
108

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette

AltStyle によって変換されたページ (->オリジナル) /