VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.10.0/prim_x86_gcc.h

Last change on this file was 36308, checked in by vboxsync, 14 years ago

fix OSE

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/****************************************************************************
2*
3* Inline helpers for x86emu
4*
5* Copyright (C) 2008 Bart Trojanowski, Symbio Technologies, LLC
6*
7* ========================================================================
8*
9* Permission to use, copy, modify, distribute, and sell this software and
10* its documentation for any purpose is hereby granted without fee,
11* provided that the above copyright notice appear in all copies and that
12* both that copyright notice and this permission notice appear in
13* supporting documentation, and that the name of the authors not be used
14* in advertising or publicity pertaining to distribution of the software
15* without specific, written prior permission. The authors makes no
16* representations about the suitability of this software for any purpose.
17* It is provided "as is" without express or implied warranty.
18*
19* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
21* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
23* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25* PERFORMANCE OF THIS SOFTWARE.
26*
27* ========================================================================
28*
29* Language: GNU C
30* Environment: GCC on i386 or x86-64
31* Developer: Bart Trojanowski
32*
33* Description: This file defines a few x86 macros that can be used by the
34* emulator to execute native instructions.
35*
36* For PIC vs non-PIC code refer to:
37* http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
38*
39****************************************************************************/
40#ifndef __X86EMU_PRIM_X86_GCC_H
41#define __X86EMU_PRIM_X86_GCC_H
42
43#include "x86emu/types.h"
44
45#if !defined(__GNUC__) || !(defined (__i386__) || defined(__i386) || defined(__AMD64__) || defined(__amd64__))
46#error This file is intended to be used by gcc on i386 or x86-64 system
47#endif
48
49#if defined(__PIC__) && defined(__i386__)
50
51#define X86EMU_HAS_HW_CPUID 1
52static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
53{
54 __asm__ __volatile__ ("pushl %%ebx \n\t"
55 "cpuid \n\t"
56 "movl %%ebx, %1 \n\t"
57 "popl %%ebx \n\t"
58 : "=a" (*a), "=r" (*b),
59 "=c" (*c), "=d" (*d)
60 : "a" (*a), "c" (*c)
61 : "cc");
62}
63
64#else /* ! (__PIC__ && __i386__) */
65
66#define x86EMU_HAS_HW_CPUID 1
67static inline void hw_cpuid (u32 *a, u32 *b, u32 *c, u32 *d)
68{
69 __asm__ __volatile__ ("cpuid"
70 : "=a" (*a), "=b" (*b),
71 "=c" (*c), "=d" (*d)
72 : "a" (*a), "c" (*c)
73 : "cc");
74}
75
76#endif /* __PIC__ && __i386__ */
77
78
79#endif /* __X86EMU_PRIM_X86_GCC_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette