]> git.ipfire.org Git - thirdparty/gcc.git/blame - libitm/config/x86/target.h
target.h (gtm_jmpbuf): Move rip to the end of structure.
[thirdparty/gcc.git] / libitm / config / x86 / target.h
CommitLineData
0a35513e
AH
1/* Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
2 Contributed by Richard Henderson <rth@redhat.com>.
3
4 This file is part of the GNU Transactional Memory Library (libitm).
5
6 Libitm is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 Libitm is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 Under Section 7 of GPL version 3, you are granted additional
17 permissions described in the GCC Runtime Library Exception, version
18 3.1, as published by the Free Software Foundation.
19
20 You should have received a copy of the GNU General Public License and
21 a copy of the GCC Runtime Library Exception along with this program;
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 <http://www.gnu.org/licenses/>. */
24
25namespace GTM HIDDEN {
26
27#ifdef __x86_64__
28/* ??? This doesn't work for Win64. */
29typedef struct gtm_jmpbuf
30{
31 void *cfa;
0a35513e
AH
32 unsigned long rbx;
33 unsigned long rbp;
34 unsigned long r12;
35 unsigned long r13;
36 unsigned long r14;
37 unsigned long r15;
9848887a 38 unsigned long rip;
0a35513e
AH
39} gtm_jmpbuf;
40#else
41typedef struct gtm_jmpbuf
42{
43 void *cfa;
44 unsigned long ebx;
45 unsigned long esi;
46 unsigned long edi;
47 unsigned long ebp;
48 unsigned long eip;
49} gtm_jmpbuf;
50#endif
51
52/* x86 doesn't require strict alignment for the basic types. */
53#define STRICT_ALIGNMENT 0
54
55/* x86 uses a fixed page size of 4K. */
56#define PAGE_SIZE 4096
57#define FIXED_PAGE_SIZE 1
58
59/* The size of one line in hardware caches (in bytes). */
60#define HW_CACHELINE_SIZE 64
61
62
63static inline void
64cpu_relax (void)
65{
66 __asm volatile ("rep; nop" : : : "memory");
67}
68
0a35513e
AH
69} // namespace GTM
70
71// We'll be using some of the cpu builtins, and their associated types.
72#ifndef __cplusplus
73/* ??? It's broken for C++. */
74#include <x86intrin.h>
75#else
76# ifdef __SSE2__
77# include <emmintrin.h>
78# elif defined(__SSE__)
79# include <xmmintrin.h>
80# endif
81# ifdef __AVX__
82# include <immintrin.h>
83# endif
84#endif