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 "pushfq \n\t"
83 "pop %0 "
84 : "=r" (Eflags) // %0
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 "movd %%mm0, %0 \n\t"
155 : "=r" (Data) // %0
156 );
157
158 return Data;
159}
160
170UINT64
171EFIAPI
173 VOID
174 )
175{
176 UINT64 Data;
177
178 __asm__ __volatile__ (
179 "movd %%mm1, %0 \n\t"
180 : "=r" (Data) // %0
181 );
182
183 return Data;
184}
185
195UINT64
196EFIAPI
198 VOID
199 )
200{
201 UINT64 Data;
202
203 __asm__ __volatile__ (
204 "movd %%mm2, %0 \n\t"
205 : "=r" (Data) // %0
206 );
207
208 return Data;
209}
210
220UINT64
221EFIAPI
223 VOID
224 )
225{
226 UINT64 Data;
227
228 __asm__ __volatile__ (
229 "movd %%mm3, %0 \n\t"
230 : "=r" (Data) // %0
231 );
232
233 return Data;
234}
235
245UINT64
246EFIAPI
248 VOID
249 )
250{
251 UINT64 Data;
252
253 __asm__ __volatile__ (
254 "movd %%mm4, %0 \n\t"
255 : "=r" (Data) // %0
256 );
257
258 return Data;
259}
260
270UINT64
271EFIAPI
273 VOID
274 )
275{
276 UINT64 Data;
277
278 __asm__ __volatile__ (
279 "movd %%mm5, %0 \n\t"
280 : "=r" (Data) // %0
281 );
282
283 return Data;
284}
285
295UINT64
296EFIAPI
298 VOID
299 )
300{
301 UINT64 Data;
302
303 __asm__ __volatile__ (
304 "movd %%mm6, %0 \n\t"
305 : "=r" (Data) // %0
306 );
307
308 return Data;
309}
310
320UINT64
321EFIAPI
323 VOID
324 )
325{
326 UINT64 Data;
327
328 __asm__ __volatile__ (
329 "movd %%mm7, %0 \n\t"
330 : "=r" (Data) // %0
331 );
332
333 return Data;
334}
335
345VOID
346EFIAPI
348 IN UINT64 Value
349 )
350{
351 __asm__ __volatile__ (
352 "movd %0, %%mm0" // %0
353 :
354 : "m" (Value)
355 );
356}
357
367VOID
368EFIAPI
370 IN UINT64 Value
371 )
372{
373 __asm__ __volatile__ (
374 "movd %0, %%mm1" // %0
375 :
376 : "m" (Value)
377 );
378}
379
389VOID
390EFIAPI
392 IN UINT64 Value
393 )
394{
395 __asm__ __volatile__ (
396 "movd %0, %%mm2" // %0
397 :
398 : "m" (Value)
399 );
400}
401
411VOID
412EFIAPI
414 IN UINT64 Value
415 )
416{
417 __asm__ __volatile__ (
418 "movd %0, %%mm3" // %0
419 :
420 : "m" (Value)
421 );
422}
423
433VOID
434EFIAPI
436 IN UINT64 Value
437 )
438{
439 __asm__ __volatile__ (
440 "movd %0, %%mm4" // %0
441 :
442 : "m" (Value)
443 );
444}
445
455VOID
456EFIAPI
458 IN UINT64 Value
459 )
460{
461 __asm__ __volatile__ (
462 "movd %0, %%mm5" // %0
463 :
464 : "m" (Value)
465 );
466}
467
477VOID
478EFIAPI
480 IN UINT64 Value
481 )
482{
483 __asm__ __volatile__ (
484 "movd %0, %%mm6" // %0
485 :
486 : "m" (Value)
487 );
488}
489
499VOID
500EFIAPI
502 IN UINT64 Value
503 )
504{
505 __asm__ __volatile__ (
506 "movd %0, %%mm7" // %0
507 :
508 : "m" (Value)
509 );
510}
511
521UINT64
522EFIAPI
524 VOID
525 )
526{
527 UINT32 LowData;
528 UINT32 HiData;
529
530 __asm__ __volatile__ (
531 "rdtsc"
532 : "=a" (LowData),
533 "=d" (HiData)
534 );
535
536 return (((UINT64)HiData) << 32) | LowData;
537}
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