Ozkan Sezer | be6e26f | 2009-07-28 08:13:46 +0000 | [diff] [blame] | 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
Rafaël Carré | 8a67ab4 | 2012-06-28 15:40:59 +0000 | [diff] [blame] | 3 | * This file is part of the mingw-w64 runtime package. |
Kai Tietz | fa0cfe3 | 2010-01-15 20:02:21 +0000 | [diff] [blame] | 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
Ozkan Sezer | be6e26f | 2009-07-28 08:13:46 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
Ozkan Sezer | 3d41592 | 2009-09-08 18:30:08 +0000 | [diff] [blame] | 7 | #include <intrin.h> |
Ozkan Sezer | be6e26f | 2009-07-28 08:13:46 +0000 | [diff] [blame] | 8 | |
| 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 Sezer | be6e26f | 2009-07-28 08:13:46 +0000 | [diff] [blame] | 23 | 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 | |