TianoCore EDK2 master
Loading...
Searching...
No Matches
GccInline.c
Go to the documentation of this file.
1
10#include "BaseLibInternals.h"
11
19VOID
20EFIAPI
22 VOID
23 )
24{
25 // This is a little bit of overkill and it is more about the compiler that it is
26 // actually processor synchronization. This is like the _ReadWriteBarrier
27 // Microsoft specific intrinsic
28 __asm__ __volatile__ ("":::"memory");
29}
30
38VOID
39EFIAPI
41 VOID
42 )
43{
44 __asm__ __volatile__ ("pause");
45}
46
54VOID
55EFIAPI
57 VOID
58 )
59{
60 __asm__ __volatile__ ("int $3");
61}
62
74EFIAPI
76 VOID
77 )
78{
79 UINTN Eflags;
80
81 __asm__ __volatile__ (
82 "pushfl \n\t"
83 "popl %0 "
84 : "=r" (Eflags)
85 );
86
87 return Eflags;
88}
89
100VOID
101EFIAPI
103 OUT IA32_FX_BUFFER *Buffer
104 )
105{
106 __asm__ __volatile__ (
107 "fxsave %0"
108 :
109 : "m" (*Buffer) // %0
110 );
111}
112
123VOID
124EFIAPI
126 IN CONST IA32_FX_BUFFER *Buffer
127 )
128{
129 __asm__ __volatile__ (
130 "fxrstor %0"
131 :
132 : "m" (*Buffer) // %0
133 );
134}
135
145UINT64
146EFIAPI
148 VOID
149 )
150{
151 UINT64 Data;
152
153 __asm__ __volatile__ (
154 "push %%eax \n\t"
155 "push %%eax \n\t"
156 "movq %%mm0, (%%esp)\n\t"
157 "pop %%eax \n\t"
158 "pop %%edx \n\t"
159 : "=A" (Data) // %0
160 );
161
162 return Data;
163}
164
174UINT64
175EFIAPI
177 VOID
178 )
179{
180 UINT64 Data;
181
182 __asm__ __volatile__ (
183 "push %%eax \n\t"
184 "push %%eax \n\t"
185 "movq %%mm1, (%%esp)\n\t"
186 "pop %%eax \n\t"
187 "pop %%edx \n\t"
188 : "=A" (Data) // %0
189 );
190
191 return Data;
192}
193
203UINT64
204EFIAPI
206 VOID
207 )
208{
209 UINT64 Data;
210
211 __asm__ __volatile__ (
212 "push %%eax \n\t"
213 "push %%eax \n\t"
214 "movq %%mm2, (%%esp)\n\t"
215 "pop %%eax \n\t"
216 "pop %%edx \n\t"
217 : "=A" (Data) // %0
218 );
219
220 return Data;
221}
222
232UINT64
233EFIAPI
235 VOID
236 )
237{
238 UINT64 Data;
239
240 __asm__ __volatile__ (
241 "push %%eax \n\t"
242 "push %%eax \n\t"
243 "movq %%mm3, (%%esp)\n\t"
244 "pop %%eax \n\t"
245 "pop %%edx \n\t"
246 : "=A" (Data) // %0
247 );
248
249 return Data;
250}
251
261UINT64
262EFIAPI
264 VOID
265 )
266{
267 UINT64 Data;
268
269 __asm__ __volatile__ (
270 "push %%eax \n\t"
271 "push %%eax \n\t"
272 "movq %%mm4, (%%esp)\n\t"
273 "pop %%eax \n\t"
274 "pop %%edx \n\t"
275 : "=A" (Data) // %0
276 );
277
278 return Data;
279}
280
290UINT64
291EFIAPI
293 VOID
294 )
295{
296 UINT64 Data;
297
298 __asm__ __volatile__ (
299 "push %%eax \n\t"
300 "push %%eax \n\t"
301 "movq %%mm5, (%%esp)\n\t"
302 "pop %%eax \n\t"
303 "pop %%edx \n\t"
304 : "=A" (Data) // %0
305 );
306
307 return Data;
308}
309
319UINT64
320EFIAPI
322 VOID
323 )
324{
325 UINT64 Data;
326
327 __asm__ __volatile__ (
328 "push %%eax \n\t"
329 "push %%eax \n\t"
330 "movq %%mm6, (%%esp)\n\t"
331 "pop %%eax \n\t"
332 "pop %%edx \n\t"
333 : "=A" (Data) // %0
334 );
335
336 return Data;
337}
338
348UINT64
349EFIAPI
351 VOID
352 )
353{
354 UINT64 Data;
355
356 __asm__ __volatile__ (
357 "push %%eax \n\t"
358 "push %%eax \n\t"
359 "movq %%mm7, (%%esp)\n\t"
360 "pop %%eax \n\t"
361 "pop %%edx \n\t"
362 : "=A" (Data) // %0
363 );
364
365 return Data;
366}
367
377VOID
378EFIAPI
380 IN UINT64 Value
381 )
382{
383 __asm__ __volatile__ (
384 "movq %0, %%mm0" // %0
385 :
386 : "m" (Value)
387 );
388}
389
399VOID
400EFIAPI
402 IN UINT64 Value
403 )
404{
405 __asm__ __volatile__ (
406 "movq %0, %%mm1" // %0
407 :
408 : "m" (Value)
409 );
410}
411
421VOID
422EFIAPI
424 IN UINT64 Value
425 )
426{
427 __asm__ __volatile__ (
428 "movq %0, %%mm2" // %0
429 :
430 : "m" (Value)
431 );
432}
433
443VOID
444EFIAPI
446 IN UINT64 Value
447 )
448{
449 __asm__ __volatile__ (
450 "movq %0, %%mm3" // %0
451 :
452 : "m" (Value)
453 );
454}
455
465VOID
466EFIAPI
468 IN UINT64 Value
469 )
470{
471 __asm__ __volatile__ (
472 "movq %0, %%mm4" // %0
473 :
474 : "m" (Value)
475 );
476}
477
487VOID
488EFIAPI
490 IN UINT64 Value
491 )
492{
493 __asm__ __volatile__ (
494 "movq %0, %%mm5" // %0
495 :
496 : "m" (Value)
497 );
498}
499
509VOID
510EFIAPI
512 IN UINT64 Value
513 )
514{
515 __asm__ __volatile__ (
516 "movq %0, %%mm6" // %0
517 :
518 : "m" (Value)
519 );
520}
521
531VOID
532EFIAPI
534 IN UINT64 Value
535 )
536{
537 __asm__ __volatile__ (
538 "movq %0, %%mm7" // %0
539 :
540 : "m" (Value)
541 );
542}
543
553UINT64
554EFIAPI
556 VOID
557 )
558{
559 UINT64 Data;
560
561 __asm__ __volatile__ (
562 "rdtsc"
563 : "=A" (Data)
564 );
565
566 return Data;
567}
UINT64 UINTN
VOID EFIAPI AsmWriteMm3(IN UINT64 Value)
Definition: GccInline.c:445
UINT64 EFIAPI AsmReadMm7(VOID)
Definition: GccInline.c:350
UINTN EFIAPI AsmReadEflags(VOID)
Definition: GccInline.c:75
UINT64 EFIAPI AsmReadTsc(VOID)
Definition: GccInline.c:555
VOID EFIAPI AsmWriteMm7(IN UINT64 Value)
Definition: GccInline.c:533
UINT64 EFIAPI AsmReadMm2(VOID)
Definition: GccInline.c:205
UINT64 EFIAPI AsmReadMm5(VOID)
Definition: GccInline.c:292
VOID EFIAPI MemoryFence(VOID)
Definition: GccInline.c:21
VOID EFIAPI AsmWriteMm5(IN UINT64 Value)
Definition: GccInline.c:489
VOID EFIAPI CpuPause(VOID)
Definition: GccInline.c:40
UINT64 EFIAPI AsmReadMm1(VOID)
Definition: GccInline.c:176
VOID EFIAPI AsmWriteMm6(IN UINT64 Value)
Definition: GccInline.c:511
VOID EFIAPI AsmWriteMm0(IN UINT64 Value)
Definition: GccInline.c:379
UINT64 EFIAPI AsmReadMm3(VOID)
Definition: GccInline.c:234
VOID EFIAPI AsmWriteMm2(IN UINT64 Value)
Definition: GccInline.c:423
VOID EFIAPI InternalX86FxSave(OUT IA32_FX_BUFFER *Buffer)
Definition: GccInline.c:102
UINT64 EFIAPI AsmReadMm6(VOID)
Definition: GccInline.c:321
VOID EFIAPI AsmWriteMm4(IN UINT64 Value)
Definition: GccInline.c:467
VOID EFIAPI CpuBreakpoint(VOID)
Definition: GccInline.c:56
UINT64 EFIAPI AsmReadMm0(VOID)
Definition: GccInline.c:147
VOID EFIAPI InternalX86FxRestore(IN CONST IA32_FX_BUFFER *Buffer)
Definition: GccInline.c:125
UINT64 EFIAPI AsmReadMm4(VOID)
Definition: GccInline.c:263
VOID EFIAPI AsmWriteMm1(IN UINT64 Value)
Definition: GccInline.c:401
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284