aboutsummaryrefslogtreecommitdiffstats
path: root/testing/open-vm-tools/checkvm-pie-safety.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-07-08 09:45:25 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-07-08 09:45:25 +0000
commit836efa79e6397dda69543c7b553e33f5bcf2d615 (patch)
tree4b72cd280d512f4e3af8ffba58cadcd27566ff9d /testing/open-vm-tools/checkvm-pie-safety.patch
parent38c4ccd875603ddc883e6bdb30f8e062f3ac1734 (diff)
downloadaports-836efa79e6397dda69543c7b553e33f5bcf2d615.tar.bz2
aports-836efa79e6397dda69543c7b553e33f5bcf2d615.tar.xz
testing/open-vm-tools: new aport
The Open Virtual Machine Tools are the open source implementation of VMware Tools. http://open-vm-tools.sourceforge.net/
Diffstat (limited to 'testing/open-vm-tools/checkvm-pie-safety.patch')
-rw-r--r--testing/open-vm-tools/checkvm-pie-safety.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/testing/open-vm-tools/checkvm-pie-safety.patch b/testing/open-vm-tools/checkvm-pie-safety.patch
new file mode 100644
index 0000000000..5a879c94b7
--- /dev/null
+++ b/testing/open-vm-tools/checkvm-pie-safety.patch
@@ -0,0 +1,67 @@
+From: Gordon Malm <gengor@gentoo.org>
+
+Make inline asm PIC-safe (do not clobber ebx).
+
+Thanks and credit to Anthony Basile for all his help and testing.
+
+Reference: http://bugs.gentoo.org/200376
+
+--- a/checkvm/checkvm.c
++++ b/checkvm/checkvm.c
+@@ -79,8 +79,16 @@
+ {
+ uint32 eax, ebx, ecx, edx;
+
+- __asm__ volatile("inl (%%dx)" :
+- "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
++ __asm__ volatile(
++#if defined __PIC__ && !vm_x86_64 // %ebx is reserved by the compiler.
++ "movl %%ebx, %3 \n\t"
++ "inl (%%dx) \n\t"
++ "xchgl %%ebx, %3 \n\t" :
++ "=a"(eax), "=c"(ecx), "=d"(edx), "=r"(ebx) :
++#else
++ "inl (%%dx)" :
++ "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
++#endif
+ "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETVERSION),
+ "2"(BDOOR_PORT) : "memory");
+ version[0] = eax;
+@@ -96,8 +104,16 @@
+ {
+ uint32 eax, ebx, ecx, edx;
+
+- __asm__ volatile("inl (%%dx)" :
+- "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
++ __asm__ volatile(
++#if defined __PIC__ && !vm_x86_64 // %ebx is reserved by the compiler.
++ "movl %%ebx, %3 \n\t"
++ "inl (%%dx) \n\t"
++ "xchgl %%ebx, %3 \n\t" :
++ "=a"(eax), "=c"(ecx), "=d"(edx), "=r"(ebx) :
++#else
++ "inl (%%dx)" :
++ "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
++#endif
+ "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETHWVERSION),
+ "2"(BDOOR_PORT) : "memory");
+ *hwVersion = eax;
+@@ -112,8 +128,16 @@
+ {
+ uint32 eax, ebx, ecx, edx;
+
+- __asm__ volatile("inl (%%dx)" :
+- "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
++ __asm__ volatile(
++#if defined __PIC__ && !vm_x86_64 // %ebx is reserved by the compiler.
++ "movl %%ebx, %3 \n\t"
++ "inl (%%dx) \n\t"
++ "xchgl %%ebx, %3 \n\t" :
++ "=a"(eax), "=c"(ecx), "=d"(edx), "=r"(ebx) :
++#else
++ "inl (%%dx)" :
++ "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
++#endif
+ "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETSCREENSIZE),
+ "2"(BDOOR_PORT) : "memory");
+ *screensize = eax;