1 /******************************************************************************
3 * Name: acgcc.h - GCC specific defines, etc.
6 *****************************************************************************/
9 * Copyright (C) 2000, 2001 R. Byron Moore
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 #define COMPILER_DEPENDENT_UINT64 unsigned long
35 #define ACPI_APPLICATION
37 #define ACPI_ASM_MACROS
38 #define causeinterrupt(level)
40 #define disable() __cli()
41 #define enable() __sti()
44 /*! [Begin] no source code translation */
48 #define halt() ia64_pal_halt_light() /* PAL_HALT[_LIGHT] */
49 #define safe_halt() ia64_pal_halt(1) /* PAL_HALT */
52 #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
54 __asm__ volatile ("1: ld4 r29=%1\n" \
66 "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
68 "cmp.eq p6,p7=r2,r30\n" \
69 "(p7) br.dpnt.few 1b\n" \
70 "cmp.gt p8,p9=3,r29\n" \
74 :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
77 #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
79 __asm__ volatile ("1: ld4 r29=%1\n" \
85 "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \
87 "cmp.eq p6,p7=r2,r30\n" \
88 "(p7) br.dpnt.few 1b\n" \
91 :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \
93 /*! [End] no source code translation !*/
95 #elif defined (_AMD64_)
97 #define COMPILER_DEPENDENT_UINT64 unsigned long long
98 #define ACPI_ASM_MACROS
99 #define causeinterrupt(level)
101 #define disable() __cli()
102 #define enable() __sti()
103 #define halt() __asm__ __volatile__ ("sti; hlt":::"memory")
106 /*! [Begin] no source code translation
108 * A brief explanation as GNU inline assembly is a bit hairy
109 * %0 is the output parameter in EAX ("=a")
110 * %1 and %2 are the input parameters in ECX ("c")
111 * and an immediate value ("i") respectively
112 * All actual register references are preceded with "%%" as in "%%edx"
113 * Immediate values in the assembly are preceded by "$" as in "$0x1"
114 * The final asm parameter are the operation altered non-output registers.
117 // FIXME: These are only sonly stubs to make it compile
119 #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
122 asm("1: movl (%1),%%eax;" \
123 "movl %%eax,%%edx;" \
124 :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
127 #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
130 asm("1: movl (%1),%%eax;" \
131 "movl %%eax,%%edx;" \
132 :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
135 /*! [End] no source code translation !*/
139 #define COMPILER_DEPENDENT_UINT64 unsigned long long
140 #define ACPI_ASM_MACROS
141 #define causeinterrupt(level)
143 #define disable() __cli()
144 #define enable() __sti()
145 #define halt() __asm__ __volatile__ ("sti; hlt":::"memory")
148 /*! [Begin] no source code translation
150 * A brief explanation as GNU inline assembly is a bit hairy
151 * %0 is the output parameter in EAX ("=a")
152 * %1 and %2 are the input parameters in ECX ("c")
153 * and an immediate value ("i") respectively
154 * All actual register references are preceded with "%%" as in "%%edx"
155 * Immediate values in the assembly are preceded by "$" as in "$0x1"
156 * The final asm parameter are the operation altered non-output registers.
158 #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
161 asm("1: movl (%1),%%eax;" \
162 "movl %%eax,%%edx;" \
166 "lock; cmpxchgl %%edx,(%1);" \
170 :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
173 #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
176 asm("1: movl (%1),%%eax;" \
177 "movl %%eax,%%edx;" \
179 "lock; cmpxchgl %%edx,(%1);" \
182 :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
185 /*! [End] no source code translation !*/
189 #endif /* __ACGCC_H__ */