X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBaseLib%2FIa32%2FGccInlinePriv.c;fp=MdePkg%2FLibrary%2FBaseLib%2FIa32%2FGccInlinePriv.c;h=df22a217ec976f7cfcee96a852957d348ee9acb6;hp=b8b5b85e7321524f65c013548125f2f2ab1e5032;hb=2f88bd3a1296c522317f1c21377876de63de5be7;hpb=1436aea4d5707e672672a11bda72be2c63c936c3 diff --git a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c index b8b5b85e73..df22a217ec 100644 --- a/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c +++ b/MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c @@ -8,7 +8,6 @@ **/ - #include "BaseLibInternals.h" #include @@ -27,7 +26,6 @@ EnableInterrupts ( __asm__ __volatile__ ("sti"::: "memory"); } - /** Disables CPU interrupts. @@ -60,11 +58,11 @@ DisableInterrupts ( UINT64 EFIAPI AsmReadMsr64 ( - IN UINT32 Index + IN UINT32 Index ) { - UINT64 Data; - BOOLEAN Flag; + UINT64 Data; + BOOLEAN Flag; Flag = FilterBeforeMsrRead (Index, &Data); if (Flag) { @@ -72,8 +70,9 @@ AsmReadMsr64 ( "rdmsr" : "=A" (Data) // %0 : "c" (Index) // %1 - ); + ); } + FilterAfterMsrRead (Index, &Data); return Data; @@ -99,8 +98,8 @@ AsmReadMsr64 ( UINT64 EFIAPI AsmWriteMsr64 ( - IN UINT32 Index, - IN UINT64 Value + IN UINT32 Index, + IN UINT64 Value ) { BOOLEAN Flag; @@ -112,8 +111,9 @@ AsmWriteMsr64 ( : : "c" (Index), "A" (Value) - ); + ); } + FilterAfterMsrWrite (Index, &Value); return Value; @@ -135,17 +135,16 @@ AsmReadCr0 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%cr0,%0" : "=a" (Data) - ); + ); return Data; } - /** Reads the current value of the Control Register 2 (CR2). @@ -162,12 +161,12 @@ AsmReadCr2 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%cr2, %0" : "=r" (Data) - ); + ); return Data; } @@ -188,17 +187,16 @@ AsmReadCr3 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%cr3, %0" : "=r" (Data) - ); + ); return Data; } - /** Reads the current value of the Control Register 4 (CR4). @@ -215,17 +213,16 @@ AsmReadCr4 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%cr4, %0" : "=a" (Data) - ); + ); return Data; } - /** Writes a value to Control Register 0 (CR0). @@ -247,11 +244,10 @@ AsmWriteCr0 ( "movl %0, %%cr0" : : "r" (Cr0) - ); + ); return Cr0; } - /** Writes a value to Control Register 2 (CR2). @@ -273,11 +269,10 @@ AsmWriteCr2 ( "movl %0, %%cr2" : : "r" (Cr2) - ); + ); return Cr2; } - /** Writes a value to Control Register 3 (CR3). @@ -299,11 +294,10 @@ AsmWriteCr3 ( "movl %0, %%cr3" : : "r" (Cr3) - ); + ); return Cr3; } - /** Writes a value to Control Register 4 (CR4). @@ -325,11 +319,10 @@ AsmWriteCr4 ( "movl %0, %%cr4" : : "r" (Cr4) - ); + ); return Cr4; } - /** Reads the current value of Debug Register 0 (DR0). @@ -346,17 +339,16 @@ AsmReadDr0 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%dr0, %0" : "=r" (Data) - ); + ); return Data; } - /** Reads the current value of Debug Register 1 (DR1). @@ -373,17 +365,16 @@ AsmReadDr1 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%dr1, %0" : "=r" (Data) - ); + ); return Data; } - /** Reads the current value of Debug Register 2 (DR2). @@ -400,17 +391,16 @@ AsmReadDr2 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%dr2, %0" : "=r" (Data) - ); + ); return Data; } - /** Reads the current value of Debug Register 3 (DR3). @@ -427,17 +417,16 @@ AsmReadDr3 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%dr3, %0" : "=r" (Data) - ); + ); return Data; } - /** Reads the current value of Debug Register 4 (DR4). @@ -454,17 +443,16 @@ AsmReadDr4 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%dr4, %0" : "=r" (Data) - ); + ); return Data; } - /** Reads the current value of Debug Register 5 (DR5). @@ -481,17 +469,16 @@ AsmReadDr5 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%dr5, %0" : "=r" (Data) - ); + ); return Data; } - /** Reads the current value of Debug Register 6 (DR6). @@ -508,17 +495,16 @@ AsmReadDr6 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%dr6, %0" : "=r" (Data) - ); + ); return Data; } - /** Reads the current value of Debug Register 7 (DR7). @@ -535,17 +521,16 @@ AsmReadDr7 ( VOID ) { - UINTN Data; + UINTN Data; __asm__ __volatile__ ( "movl %%dr7, %0" : "=r" (Data) - ); + ); return Data; } - /** Writes a value to Debug Register 0 (DR0). @@ -567,11 +552,10 @@ AsmWriteDr0 ( "movl %0, %%dr0" : : "r" (Dr0) - ); + ); return Dr0; } - /** Writes a value to Debug Register 1 (DR1). @@ -593,11 +577,10 @@ AsmWriteDr1 ( "movl %0, %%dr1" : : "r" (Dr1) - ); + ); return Dr1; } - /** Writes a value to Debug Register 2 (DR2). @@ -619,11 +602,10 @@ AsmWriteDr2 ( "movl %0, %%dr2" : : "r" (Dr2) - ); + ); return Dr2; } - /** Writes a value to Debug Register 3 (DR3). @@ -645,11 +627,10 @@ AsmWriteDr3 ( "movl %0, %%dr3" : : "r" (Dr3) - ); + ); return Dr3; } - /** Writes a value to Debug Register 4 (DR4). @@ -671,11 +652,10 @@ AsmWriteDr4 ( "movl %0, %%dr4" : : "r" (Dr4) - ); + ); return Dr4; } - /** Writes a value to Debug Register 5 (DR5). @@ -697,11 +677,10 @@ AsmWriteDr5 ( "movl %0, %%dr5" : : "r" (Dr5) - ); + ); return Dr5; } - /** Writes a value to Debug Register 6 (DR6). @@ -723,11 +702,10 @@ AsmWriteDr6 ( "movl %0, %%dr6" : : "r" (Dr6) - ); + ); return Dr6; } - /** Writes a value to Debug Register 7 (DR7). @@ -749,11 +727,10 @@ AsmWriteDr7 ( "movl %0, %%dr7" : : "r" (Dr7) - ); + ); return Dr7; } - /** Reads the current value of Code Segment Register (CS). @@ -774,12 +751,11 @@ AsmReadCs ( __asm__ __volatile__ ( "mov %%cs, %0" :"=a" (Data) - ); + ); return Data; } - /** Reads the current value of Data Segment Register (DS). @@ -800,12 +776,11 @@ AsmReadDs ( __asm__ __volatile__ ( "mov %%ds, %0" :"=a" (Data) - ); + ); return Data; } - /** Reads the current value of Extra Segment Register (ES). @@ -826,12 +801,11 @@ AsmReadEs ( __asm__ __volatile__ ( "mov %%es, %0" :"=a" (Data) - ); + ); return Data; } - /** Reads the current value of FS Data Segment Register (FS). @@ -852,12 +826,11 @@ AsmReadFs ( __asm__ __volatile__ ( "mov %%fs, %0" :"=a" (Data) - ); + ); return Data; } - /** Reads the current value of GS Data Segment Register (GS). @@ -878,12 +851,11 @@ AsmReadGs ( __asm__ __volatile__ ( "mov %%gs, %0" :"=a" (Data) - ); + ); return Data; } - /** Reads the current value of Stack Segment Register (SS). @@ -904,12 +876,11 @@ AsmReadSs ( __asm__ __volatile__ ( "mov %%ss, %0" :"=a" (Data) - ); + ); return Data; } - /** Reads the current value of Task Register (TR). @@ -930,12 +901,11 @@ AsmReadTr ( __asm__ __volatile__ ( "str %0" : "=a" (Data) - ); + ); return Data; } - /** Reads the current Global Descriptor Table Register(GDTR) descriptor. @@ -948,16 +918,15 @@ AsmReadTr ( VOID EFIAPI InternalX86ReadGdtr ( - OUT IA32_DESCRIPTOR *Gdtr + OUT IA32_DESCRIPTOR *Gdtr ) { __asm__ __volatile__ ( "sgdt %0" : "=m" (*Gdtr) - ); + ); } - /** Writes the current Global Descriptor Table Register (GDTR) descriptor. @@ -970,18 +939,16 @@ InternalX86ReadGdtr ( VOID EFIAPI InternalX86WriteGdtr ( - IN CONST IA32_DESCRIPTOR *Gdtr + IN CONST IA32_DESCRIPTOR *Gdtr ) { __asm__ __volatile__ ( "lgdt %0" : : "m" (*Gdtr) - ); - + ); } - /** Reads the current Interrupt Descriptor Table Register(GDTR) descriptor. @@ -994,16 +961,15 @@ InternalX86WriteGdtr ( VOID EFIAPI InternalX86ReadIdtr ( - OUT IA32_DESCRIPTOR *Idtr + OUT IA32_DESCRIPTOR *Idtr ) { __asm__ __volatile__ ( "sidt %0" : "=m" (*Idtr) - ); + ); } - /** Writes the current Interrupt Descriptor Table Register(GDTR) descriptor. @@ -1016,17 +982,16 @@ InternalX86ReadIdtr ( VOID EFIAPI InternalX86WriteIdtr ( - IN CONST IA32_DESCRIPTOR *Idtr + IN CONST IA32_DESCRIPTOR *Idtr ) { __asm__ __volatile__ ( "lidt %0" : : "m" (*Idtr) - ); + ); } - /** Reads the current Local Descriptor Table Register(LDTR) selector. @@ -1047,12 +1012,11 @@ AsmReadLdtr ( __asm__ __volatile__ ( "sldt %0" : "=g" (Data) // %0 - ); + ); return Data; } - /** Writes the current Local Descriptor Table Register (GDTR) selector. @@ -1065,14 +1029,14 @@ AsmReadLdtr ( VOID EFIAPI AsmWriteLdtr ( - IN UINT16 Ldtr + IN UINT16 Ldtr ) { __asm__ __volatile__ ( "lldtw %0" : : "g" (Ldtr) // %0 - ); + ); } /** @@ -1089,7 +1053,7 @@ AsmWriteLdtr ( UINT64 EFIAPI AsmReadPmc ( - IN UINT32 Index + IN UINT32 Index ) { UINT64 Data; @@ -1098,7 +1062,7 @@ AsmReadPmc ( "rdpmc" : "=A" (Data) : "c" (Index) - ); + ); return Data; } @@ -1133,10 +1097,8 @@ AsmInvd ( ) { __asm__ __volatile__ ("invd":::"memory"); - } - /** Flushes a cache line from all the instruction and data caches within the coherency domain of the CPU. @@ -1155,7 +1117,7 @@ AsmInvd ( VOID * EFIAPI AsmFlushCacheLine ( - IN VOID *LinearAddress + IN VOID *LinearAddress ) { UINT32 RegEdx; @@ -1170,13 +1132,12 @@ AsmFlushCacheLine ( return LinearAddress; } - __asm__ __volatile__ ( "clflush (%0)" : "+a" (LinearAddress) : : "memory" - ); + ); return LinearAddress; }