blob: 95e56e63173b442d609937c8a6e507476432b9dc [file] [log] [blame]
Ozkan Sezerbe6e26f2009-07-28 08:13:46 +00001/**
2 * This file has no copyright assigned and is placed in the Public Domain.
Rafaël Carré8a67ab42012-06-28 15:40:59 +00003 * This file is part of the mingw-w64 runtime package.
Kai Tietzfa0cfe32010-01-15 20:02:21 +00004 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
Ozkan Sezerbe6e26f2009-07-28 08:13:46 +00005 */
6
Ozkan Sezer3d415922009-09-08 18:30:08 +00007#include <intrin.h>
Ozkan Sezerbe6e26f2009-07-28 08:13:46 +00008
9/* Register sizes are different between 32/64 bit mode.
10 * So we have to do this for _WIN64 and _WIN32 seperatly.
11 */
12
13#ifdef _WIN64
14 unsigned __int64 __readcr0(void)
15 {
16 unsigned __int64 value;
17 __asm__ __volatile__ (
18 "mov %%cr0, %[value]"
19 : [value] "=q" (value));
20 return value;
21 }
22#else
Ozkan Sezerbe6e26f2009-07-28 08:13:46 +000023 unsigned long __readcr0(void)
24 {
25 unsigned long value;
26 __asm__ __volatile__ (
27 "mov %%cr0, %[value]"
28 : [value] "=q" (value));
29 return value;
30 }
31#endif
32