summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ramsay <lack@gentoo.org>2009-07-20 13:54:59 +0000
committerJim Ramsay <lack@gentoo.org>2009-07-20 13:54:59 +0000
commit506f535447a74e78a8a9cf92d33d6b29a02e75a3 (patch)
treece92cc4c409584fbaaeff9955e1e5688cae14578 /www-plugins/adobe-flash/files
parentVersion bump (diff)
downloadgentoo-2-506f535447a74e78a8a9cf92d33d6b29a02e75a3.tar.gz
gentoo-2-506f535447a74e78a8a9cf92d33d6b29a02e75a3.tar.bz2
gentoo-2-506f535447a74e78a8a9cf92d33d6b29a02e75a3.zip
Bug #268336 continued -> Use Maks Verver's clever sighandler solution to emulate the missing lahf instruction on affected platforms
(Portage version: 2.1.6.13/cvs/Linux x86_64)
Diffstat (limited to 'www-plugins/adobe-flash/files')
-rw-r--r--www-plugins/adobe-flash/files/flashplugin-lahf-fix.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/www-plugins/adobe-flash/files/flashplugin-lahf-fix.c b/www-plugins/adobe-flash/files/flashplugin-lahf-fix.c
new file mode 100644
index 000000000000..9338b7337317
--- /dev/null
+++ b/www-plugins/adobe-flash/files/flashplugin-lahf-fix.c
@@ -0,0 +1,29 @@
+/* Simple work-around for running the 64-bit Adobe Flash plug-in version 10
+ on Athlon64 processors without support for the lahf instruction.
+
+Compile with:
+cc -fPIC -shared -nostdlib -lc -oflashplugin-lahf-fix.so flashplugin-lahf-fix.c
+Then place the .so file in the plug-in directory (e.g. $HOME/.mozilla/plugins)
+or use LD_PRELOAD to force Firefox to load the library.
+
+ - Maks Verver <maksverver@geocities.com> July 2009 */
+
+#define _GNU_SOURCE
+#include <stdlib.h>
+#include <signal.h>
+#include <ucontext.h>
+
+static void sig_handler(int signal, siginfo_t *info, void *context) {
+ if (signal != SIGILL) return;
+ if (*(char*)info->si_addr != (char)0x9f) abort();
+ greg_t *regs = ((ucontext_t*)context)->uc_mcontext.gregs;
+ ((char*)&regs[REG_RAX])[1] = ((char*)&regs[REG_EFL])[0];
+ regs[REG_RIP]++;
+}
+
+static struct sigaction old_sa, new_sa = {
+ .sa_flags = SA_SIGINFO,
+ .sa_sigaction = &sig_handler };
+
+int _init() { sigaction(SIGILL, &new_sa, &old_sa); return 0; }
+int _fini() { sigaction(SIGILL, &old_sa, &new_sa); return 0; }