[FAST486]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 12 Oct 2014 00:10:44 +0000 (00:10 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 12 Oct 2014 00:10:44 +0000 (00:10 +0000)
- fastcall'ize some functions,
- code formatting.

svn path=/trunk/; revision=64687

reactos/lib/fast486/common.c
reactos/lib/fast486/common.h
reactos/lib/fast486/common.inl
reactos/lib/fast486/extraops.c
reactos/lib/fast486/extraops.h
reactos/lib/fast486/fast486.c
reactos/lib/fast486/fpu.c
reactos/lib/fast486/opcodes.c
reactos/lib/fast486/opcodes.h
reactos/lib/fast486/opgroups.c
reactos/lib/fast486/opgroups.h

index 09a9c72..46556e2 100644 (file)
@@ -160,9 +160,8 @@ Fast486WriteMemory(PFAST486_STATE State,
     return Fast486WriteLinearMemory(State, LinearAddress, Buffer, Size);
 }
 
-static
-inline
-BOOLEAN
+static inline BOOLEAN
+FASTCALL
 Fast486GetIntVector(PFAST486_STATE State,
                     UCHAR Number,
                     PFAST486_IDT_ENTRY IdtEntry)
@@ -208,14 +207,15 @@ Fast486GetIntVector(PFAST486_STATE State,
     return TRUE;
 }
 
-static
-inline
-BOOLEAN
+static inline BOOLEAN
+FASTCALL
 Fast486InterruptInternal(PFAST486_STATE State,
-                         USHORT SegmentSelector,
-                         ULONG Offset,
-                         ULONG GateType)
+                         PFAST486_IDT_ENTRY IdtEntry)
 {
+    USHORT SegmentSelector = IdtEntry->Selector;
+    ULONG  Offset          = MAKELONG(IdtEntry->Offset, IdtEntry->OffsetHigh);
+    ULONG  GateType        = IdtEntry->Type;
+
     BOOLEAN GateSize = (GateType == FAST486_IDT_INT_GATE_32)
                        || (GateType == FAST486_IDT_TRAP_GATE_32);
     BOOLEAN Success = FALSE;
@@ -355,6 +355,7 @@ Cleanup:
 }
 
 BOOLEAN
+FASTCALL
 Fast486PerformInterrupt(PFAST486_STATE State,
                         UCHAR Number)
 {
@@ -368,10 +369,7 @@ Fast486PerformInterrupt(PFAST486_STATE State,
     }
 
     /* Perform the interrupt */
-    if (!Fast486InterruptInternal(State,
-                                  IdtEntry.Selector,
-                                  MAKELONG(IdtEntry.Offset, IdtEntry.OffsetHigh),
-                                  IdtEntry.Type))
+    if (!Fast486InterruptInternal(State, &IdtEntry))
     {
         /* Exception occurred */
         return FALSE;
index 917db66..a560ac8 100644 (file)
@@ -154,6 +154,7 @@ Fast486WriteMemory
 );
 
 BOOLEAN
+FASTCALL
 Fast486PerformInterrupt
 (
     PFAST486_STATE State,
index f564768..57bf933 100644 (file)
@@ -53,6 +53,7 @@
 
 FORCEINLINE
 INT
+FASTCALL
 Fast486GetCurrentPrivLevel(PFAST486_STATE State)
 {
     /* Return the CPL, or 3 if we're in virtual 8086 mode */
@@ -61,6 +62,7 @@ Fast486GetCurrentPrivLevel(PFAST486_STATE State)
 
 FORCEINLINE
 ULONG
+FASTCALL
 Fast486GetPageTableEntry(PFAST486_STATE State,
                          ULONG VirtualAddress,
                          BOOLEAN MarkAsDirty)
@@ -145,6 +147,7 @@ Fast486GetPageTableEntry(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486ReadLinearMemory(PFAST486_STATE State,
                         ULONG LinearAddress,
                         PVOID Buffer,
@@ -211,6 +214,7 @@ Fast486ReadLinearMemory(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486WriteLinearMemory(PFAST486_STATE State,
                          ULONG LinearAddress,
                          PVOID Buffer,
@@ -279,6 +283,7 @@ Fast486WriteLinearMemory(PFAST486_STATE State,
 
 FORCEINLINE
 VOID
+FASTCALL
 Fast486Exception(PFAST486_STATE State,
                  FAST486_EXCEPTIONS ExceptionCode)
 {
@@ -288,6 +293,7 @@ Fast486Exception(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486StackPush(PFAST486_STATE State,
                  ULONG Value)
 {
@@ -344,6 +350,7 @@ Fast486StackPush(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486StackPop(PFAST486_STATE State,
                 PULONG Value)
 {
@@ -418,6 +425,7 @@ Fast486StackPop(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486LoadSegment(PFAST486_STATE State,
                    FAST486_SEG_REGS Segment,
                    USHORT Selector)
@@ -628,6 +636,7 @@ Fast486LoadSegment(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486FetchByte(PFAST486_STATE State,
                  PUCHAR Data)
 {
@@ -658,6 +667,7 @@ Fast486FetchByte(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486FetchWord(PFAST486_STATE State,
                  PUSHORT Data)
 {
@@ -689,6 +699,7 @@ Fast486FetchWord(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486FetchDword(PFAST486_STATE State,
                   PULONG Data)
 {
@@ -720,6 +731,7 @@ Fast486FetchDword(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486CalculateParity(UCHAR Number)
 {
     // See http://graphics.stanford.edu/~seander/bithacks.html#ParityLookupTable too...
@@ -728,6 +740,7 @@ Fast486CalculateParity(UCHAR Number)
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486ParseModRegRm(PFAST486_STATE State,
                      BOOLEAN AddressSize,
                      PFAST486_MOD_REG_RM ModRegRm)
@@ -995,6 +1008,7 @@ Fast486ParseModRegRm(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486ReadModrmByteOperands(PFAST486_STATE State,
                              PFAST486_MOD_REG_RM ModRegRm,
                              PUCHAR RegValue,
@@ -1061,6 +1075,7 @@ Fast486ReadModrmByteOperands(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486ReadModrmWordOperands(PFAST486_STATE State,
                              PFAST486_MOD_REG_RM ModRegRm,
                              PUSHORT RegValue,
@@ -1109,6 +1124,7 @@ Fast486ReadModrmWordOperands(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486ReadModrmDwordOperands(PFAST486_STATE State,
                               PFAST486_MOD_REG_RM ModRegRm,
                               PULONG RegValue,
@@ -1157,6 +1173,7 @@ Fast486ReadModrmDwordOperands(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486WriteModrmByteOperands(PFAST486_STATE State,
                               PFAST486_MOD_REG_RM ModRegRm,
                               BOOLEAN WriteRegister,
@@ -1221,6 +1238,7 @@ Fast486WriteModrmByteOperands(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486WriteModrmWordOperands(PFAST486_STATE State,
                               PFAST486_MOD_REG_RM ModRegRm,
                               BOOLEAN WriteRegister,
@@ -1267,6 +1285,7 @@ Fast486WriteModrmWordOperands(PFAST486_STATE State,
 
 FORCEINLINE
 BOOLEAN
+FASTCALL
 Fast486WriteModrmDwordOperands(PFAST486_STATE State,
                                PFAST486_MOD_REG_RM ModRegRm,
                                BOOLEAN WriteRegister,
@@ -1315,7 +1334,9 @@ Fast486WriteModrmDwordOperands(PFAST486_STATE State,
 
 FORCEINLINE
 VOID
-Fast486FpuNormalize(PFAST486_STATE State, PFAST486_FPU_DATA_REG Data)
+FASTCALL
+Fast486FpuNormalize(PFAST486_STATE State,
+                    PFAST486_FPU_DATA_REG Data)
 {
     UINT LeadingZeros;
 
@@ -1346,6 +1367,7 @@ Fast486FpuNormalize(PFAST486_STATE State, PFAST486_FPU_DATA_REG Data)
 
 FORCEINLINE
 USHORT
+FASTCALL
 Fast486GetValueTag(PFAST486_FPU_DATA_REG Data)
 {
     if (FPU_IS_ZERO(Data)) return FPU_TAG_ZERO;
@@ -1355,6 +1377,7 @@ Fast486GetValueTag(PFAST486_FPU_DATA_REG Data)
 
 FORCEINLINE
 VOID
+FASTCALL
 Fast486FpuPush(PFAST486_STATE State,
                PFAST486_FPU_DATA_REG Data)
 {
@@ -1370,6 +1393,7 @@ Fast486FpuPush(PFAST486_STATE State,
 
 FORCEINLINE
 VOID
+FASTCALL
 Fast486FpuPop(PFAST486_STATE State)
 {
     if (FPU_GET_TAG(0) != FPU_TAG_EMPTY)
index 7adac3b..be20fd4 100644 (file)
@@ -2385,3 +2385,4 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeExtended)
     }
 }
 
+/* EOF */
index cc10e1d..164219b 100644 (file)
@@ -64,4 +64,3 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeExtended);
 #endif // _EXTRAOPS_H_
 
 /* EOF */
-
index 2af9049..195881d 100644 (file)
@@ -43,9 +43,7 @@ typedef enum
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
-static
-inline
-VOID
+static inline VOID
 NTAPI
 Fast486ExecutionControl(PFAST486_STATE State, FAST486_EXEC_CMD Command)
 {
index e0c42ea..73484ee 100644 (file)
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
-static ULONGLONG UnsignedMult128(ULONGLONG Multiplicand,
-                                 ULONGLONG Multiplier,
-                                 ULONGLONG *HighProduct)
+static ULONGLONG
+UnsignedMult128(ULONGLONG Multiplicand,
+                ULONGLONG Multiplier,
+                ULONGLONG *HighProduct)
 {
     ULONG MultiplicandLow, MultiplicandHigh, MultiplierLow, MultiplierHigh;
     ULONG IntermediateLow, IntermediateHigh;
@@ -63,9 +64,10 @@ static ULONGLONG UnsignedMult128(ULONGLONG Multiplicand,
     return LowProduct;
 }
 
-static VOID Fast486FpuGetSingleReal(PFAST486_STATE State,
-                                    ULONG Value,
-                                    PFAST486_FPU_DATA_REG Result)
+static VOID
+Fast486FpuGetSingleReal(PFAST486_STATE State,
+                        ULONG Value,
+                        PFAST486_FPU_DATA_REG Result)
 {
     /* Extract the sign, exponent and mantissa */
     Result->Sign = (UCHAR)(Value >> 31);
@@ -83,9 +85,10 @@ static VOID Fast486FpuGetSingleReal(PFAST486_STATE State,
     }
 }
 
-static VOID Fast486FpuGetDoubleReal(PFAST486_STATE State,
-                                    ULONGLONG Value,
-                                    PFAST486_FPU_DATA_REG Result)
+static VOID
+Fast486FpuGetDoubleReal(PFAST486_STATE State,
+                        ULONGLONG Value,
+                        PFAST486_FPU_DATA_REG Result)
 {
     /* Extract the sign, exponent and mantissa */
     Result->Sign = (UCHAR)(Value >> 63);
@@ -103,10 +106,11 @@ static VOID Fast486FpuGetDoubleReal(PFAST486_STATE State,
     }
 }
 
-static VOID Fast486FpuAdd(PFAST486_STATE State,
-                          PFAST486_FPU_DATA_REG FirstOperand,
-                          PFAST486_FPU_DATA_REG SecondOperand,
-                          PFAST486_FPU_DATA_REG Result)
+static VOID
+Fast486FpuAdd(PFAST486_STATE State,
+              PFAST486_FPU_DATA_REG FirstOperand,
+              PFAST486_FPU_DATA_REG SecondOperand,
+              PFAST486_FPU_DATA_REG Result)
 {
     FAST486_FPU_DATA_REG FirstAdjusted = *FirstOperand;
     FAST486_FPU_DATA_REG SecondAdjusted = *SecondOperand;
@@ -182,10 +186,11 @@ static VOID Fast486FpuAdd(PFAST486_STATE State,
     *Result = TempResult;
 }
 
-static VOID Fast486FpuSubtract(PFAST486_STATE State,
-                               PFAST486_FPU_DATA_REG FirstOperand,
-                               PFAST486_FPU_DATA_REG SecondOperand,
-                               PFAST486_FPU_DATA_REG Result)
+static VOID
+Fast486FpuSubtract(PFAST486_STATE State,
+                   PFAST486_FPU_DATA_REG FirstOperand,
+                   PFAST486_FPU_DATA_REG SecondOperand,
+                   PFAST486_FPU_DATA_REG Result)
 {
     FAST486_FPU_DATA_REG NegativeSecondOperand = *SecondOperand;
 
@@ -196,9 +201,10 @@ static VOID Fast486FpuSubtract(PFAST486_STATE State,
     Fast486FpuAdd(State, Result, FirstOperand, &NegativeSecondOperand);
 }
 
-static VOID Fast486FpuCompare(PFAST486_STATE State,
-                              PFAST486_FPU_DATA_REG FirstOperand,
-                              PFAST486_FPU_DATA_REG SecondOperand)
+static VOID
+Fast486FpuCompare(PFAST486_STATE State,
+                  PFAST486_FPU_DATA_REG FirstOperand,
+                  PFAST486_FPU_DATA_REG SecondOperand)
 {
     if (FPU_IS_NAN(FirstOperand) || FPU_IS_NAN(SecondOperand))
     {
@@ -248,10 +254,11 @@ static VOID Fast486FpuCompare(PFAST486_STATE State,
     }
 }
 
-static VOID Fast486FpuMultiply(PFAST486_STATE State,
-                               PFAST486_FPU_DATA_REG FirstOperand,
-                               PFAST486_FPU_DATA_REG SecondOperand,
-                               PFAST486_FPU_DATA_REG Result)
+static VOID
+Fast486FpuMultiply(PFAST486_STATE State,
+                   PFAST486_FPU_DATA_REG FirstOperand,
+                   PFAST486_FPU_DATA_REG SecondOperand,
+                   PFAST486_FPU_DATA_REG Result)
 {
     FAST486_FPU_DATA_REG TempResult;
 
@@ -273,10 +280,11 @@ static VOID Fast486FpuMultiply(PFAST486_STATE State,
     *Result = TempResult;
 }
 
-static VOID Fast486FpuDivide(PFAST486_STATE State,
-                             PFAST486_FPU_DATA_REG FirstOperand,
-                             PFAST486_FPU_DATA_REG SecondOperand,
-                             PFAST486_FPU_DATA_REG Result)
+static VOID
+Fast486FpuDivide(PFAST486_STATE State,
+                 PFAST486_FPU_DATA_REG FirstOperand,
+                 PFAST486_FPU_DATA_REG SecondOperand,
+                 PFAST486_FPU_DATA_REG Result)
 {
     FAST486_FPU_DATA_REG TempResult;
 
index b9d198f..a032691 100644 (file)
@@ -6314,3 +6314,5 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOuts)
     /* Return success */
     return TRUE;
 }
+
+/* EOF */
index 45611f4..06de80e 100644 (file)
@@ -157,3 +157,5 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIns);
 FAST486_OPCODE_HANDLER(Fast486OpcodeOuts);
 
 #endif // _OPCODES_H_
+
+/* EOF */
index fa01acc..2dcdcae 100644 (file)
@@ -32,8 +32,8 @@
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
-inline
 static
+inline
 ULONG
 Fast486ArithmeticOperation(PFAST486_STATE State,
                            INT Operation,
index 1bfb091..f74877d 100644 (file)
@@ -50,4 +50,3 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeGroup0FBA);
 #endif // _OPGROUPS_H_
 
 /* EOF */
-