Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: src/trusted/cpu_features/arch/x86/cpu_xgetbv.S

Issue 11864002: Move CPU features into its own static library. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Another go at Windows x64, with help from Noel. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/trusted/cpu_features/arch/x86/cpu_x86_test.c ('k') | src/trusted/cpu_features/build.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * This exists only because Windows 64 doesn't support trivial inline assembly. 8 * This exists only because Windows 64 doesn't support trivial inline assembly.
9 * Visual Studio 2010 SP1 has an intrinsic _xgetbv() for this. 9 * Visual Studio 2010 SP1 has an intrinsic _xgetbv() for this.
10 * But earlier versions do not. 10 * But earlier versions do not.
11 */ 11 */
12 12
13 #include "native_client/src/trusted/service_runtime/nacl_config.h" 13 #include "native_client/src/trusted/service_runtime/nacl_config.h"
14 14
15 .text 15 .text
16 16
17 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClXGETBV): 17 DEFINE_GLOBAL_HIDDEN_IDENTIFIER(NaClXGETBV):
18 #if NACL_ARCH(NACL_BUILD_ARCH) == NACL_x86
18 #if NACL_BUILD_SUBARCH == 32 19 #if NACL_BUILD_SUBARCH == 32
19 movl 4(%esp), %ecx 20 movl 4(%esp), %ecx
20 #elif !NACL_WINDOWS 21 #elif !NACL_WINDOWS
21 movl %edi, %ecx 22 movl %edi, %ecx
22 #endif 23 #endif
23 /* 24 /*
24 * This is "xgetbv" (no operands). Some assemblers don't know it yet. 25 * This is "xgetbv" (no operands). Some assemblers don't know it yet.
25 */ 26 */
26 .byte 0x0f, 0x01, 0xd0 27 .byte 0x0f, 0x01, 0xd0
27 #if NACL_BUILD_SUBARCH == 64 28 #if NACL_BUILD_SUBARCH == 64
28 shlq $32, %rdx 29 shlq $32, %rdx
29 orq %rdx, %rax 30 orq %rdx, %rax
30 #endif 31 #endif
31 ret 32 ret
33 #endif
bsy 2013/01/11 21:11:30 isn't this a tad dangerous -- if this is not NACL_
Roland McGrath 2013/01/11 21:15:00 In other cases we just put #error in an #else clau
bsy 2013/01/11 21:19:53 the problem is that this is getting built for all
OLDNEW
« no previous file with comments | « src/trusted/cpu_features/arch/x86/cpu_x86_test.c ('k') | src/trusted/cpu_features/build.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698