Bug 1105729 - Pre VS2010 SP1 define our own verion of _xgetbv. r=tabraldes, a=sledru
authorBob Owen <bobowencode@gmail.com>
Fri, 28 Nov 2014 18:58:33 +0000
changeset 242344 b716e52f2027970a283b1c648d7674ef7aa455f5
parent 242343 61638e53ef7b85a7afd6dd3666befbd655fb5328
child 242345 e153c2778a8b9a506f007b40657e26a50600ceb5
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstabraldes, sledru
Bug 1105729 - Pre VS2010 SP1 define our own verion of _xgetbv. r=tabraldes, a=sledru
--- a/security/sandbox/chromium/base/cpu.cc
+++ b/security/sandbox/chromium/base/cpu.cc
@@ -46,16 +46,26 @@ CPU::CPU()
     cpu_vendor_("unknown") {
 namespace {
 #if defined(ARCH_CPU_X86_FAMILY)
+#if defined(_MSC_VER) && (_MSC_FULL_VER < 160040219)
+// Prior to VS2010 SP1, _xgetbv is not defined in immintrin.h, so we need to
+// define our own version using the assembly operation.
+// By using __fastcall we ensure that xcr is already in register ecx for xgetbv
+// and xgetbv populates the correct registers (eax edx) for our return value.
+uint64_t __fastcall _xgetbv(uint32_t xcr) {
+  __asm xgetbv;
 #ifndef _MSC_VER
 #if defined(__pic__) && defined(__i386__)
 void __cpuid(int cpu_info[4], int info_type) {
   __asm__ volatile (
     "mov %%ebx, %%edi\n"
--- a/security/sandbox/modifications-to-chromium-to-reapply-after-upstream-merge.txt
+++ b/security/sandbox/modifications-to-chromium-to-reapply-after-upstream-merge.txt
@@ -1,5 +1,5 @@
 Please add a link to the bugzilla bug and patch name that should be re-applied.
 Also, please update any existing links to their actual mozilla-central changeset.
-https://bugzilla.mozilla.org/show_bug.cgi?id=1041775 bug1041775part2.patch
-https://bugzilla.mozilla.org/show_bug.cgi?id=1041775 bug1041775part3.patch
+https://bugzilla.mozilla.org/show_bug.cgi?id=1105729 bug1105729.patch