~mingw-w64/mingw-w64/experimental

« back to all changes in this revision

Viewing changes to ros-privexp/mingw-w64-crt/intrincs/readcr3.c

  • Committer: NightStrike
  • Date: 2010-08-11 22:20:57 UTC
  • Revision ID: svn-v4:4407c894-4637-0410-b4f5-ada5f102cad1:experimental:3266
Branch for adding option for supporting ros

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * This file has no copyright assigned and is placed in the Public Domain.
 
3
 * This file is part of the w64 mingw-runtime package.
 
4
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 
5
 */
 
6
 
 
7
#include <intrin.h>
 
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 __readcr3(void)
 
15
  {
 
16
      unsigned __int64 value;
 
17
      __asm__ __volatile__ (
 
18
          "mov %%cr3, %[value]" 
 
19
          : [value] "=q" (value));
 
20
      return value;
 
21
  }
 
22
#else
 
23
  unsigned long __readcr3(void)
 
24
  {
 
25
      unsigned long value;
 
26
      __asm__ __volatile__ (
 
27
          "mov %%cr3, %[value]" 
 
28
          : [value] "=q" (value));
 
29
      return value;
 
30
  }
 
31
#endif
 
32