[HALX86] Trailing whitespace fixes only.

This commit is contained in:
Hermès Bélusca-Maïto 2019-11-24 22:05:37 +01:00
parent 03a9ccce65
commit 00cb464d9d
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -81,35 +81,35 @@ HalpPushInt(IN PHAL_BIOS_FRAME BiosFrame,
{ {
PUSHORT Stack; PUSHORT Stack;
ULONG Eip; ULONG Eip;
/* Calculate stack address (SP) */ /* Calculate stack address (SP) */
Stack = (PUSHORT)(BiosFrame->SsBase + (BiosFrame->Esp & 0xFFFF)); Stack = (PUSHORT)(BiosFrame->SsBase + (BiosFrame->Esp & 0xFFFF));
/* Push EFlags */ /* Push EFlags */
Stack--; Stack--;
*Stack = BiosFrame->EFlags & 0xFFFF; *Stack = BiosFrame->EFlags & 0xFFFF;
/* Push CS */ /* Push CS */
Stack--; Stack--;
*Stack = BiosFrame->SegCs & 0xFFFF; *Stack = BiosFrame->SegCs & 0xFFFF;
/* Push IP */ /* Push IP */
Stack--; Stack--;
*Stack = BiosFrame->Eip & 0xFFFF; *Stack = BiosFrame->Eip & 0xFFFF;
/* Compute new CS:IP from the IVT address for this interrupt entry */ /* Compute new CS:IP from the IVT address for this interrupt entry */
Eip = *(PULONG)(Interrupt * 4); Eip = *(PULONG)(Interrupt * 4);
BiosFrame->Eip = Eip & 0xFFFF; BiosFrame->Eip = Eip & 0xFFFF;
BiosFrame->SegCs = Eip >> 16; BiosFrame->SegCs = Eip >> 16;
/* Update stack address */ /* Update stack address */
BiosFrame->Esp = (ULONG_PTR)Stack & 0xFFFF; BiosFrame->Esp = (ULONG_PTR)Stack & 0xFFFF;
/* Update CS to linear */ /* Update CS to linear */
BiosFrame->CsBase = BiosFrame->SegCs << 4; BiosFrame->CsBase = BiosFrame->SegCs << 4;
BiosFrame->CsLimit = 0xFFFF; BiosFrame->CsLimit = 0xFFFF;
BiosFrame->CsFlags = 0; BiosFrame->CsFlags = 0;
/* We're done */ /* We're done */
return TRUE; return TRUE;
} }
@ -120,19 +120,19 @@ HalpOpcodeINTnn(IN PHAL_BIOS_FRAME BiosFrame)
{ {
UCHAR Interrupt; UCHAR Interrupt;
PKTRAP_FRAME TrapFrame; PKTRAP_FRAME TrapFrame;
/* Convert SS to linear */ /* Convert SS to linear */
BiosFrame->SsBase = BiosFrame->SegSs << 4; BiosFrame->SsBase = BiosFrame->SegSs << 4;
BiosFrame->SsLimit = 0xFFFF; BiosFrame->SsLimit = 0xFFFF;
BiosFrame->SsFlags = 0; BiosFrame->SsFlags = 0;
/* Increase EIP and validate */ /* Increase EIP and validate */
BiosFrame->Eip++; BiosFrame->Eip++;
if (BiosFrame->Eip > BiosFrame->CsLimit) return FALSE; if (BiosFrame->Eip > BiosFrame->CsLimit) return FALSE;
/* Read interrupt number */ /* Read interrupt number */
Interrupt = *(PUCHAR)(BiosFrame->CsBase + BiosFrame->Eip); Interrupt = *(PUCHAR)(BiosFrame->CsBase + BiosFrame->Eip);
/* Increase EIP and push the interrupt */ /* Increase EIP and push the interrupt */
BiosFrame->Eip++; BiosFrame->Eip++;
if (HalpPushInt(BiosFrame, Interrupt)) if (HalpPushInt(BiosFrame, Interrupt))
@ -143,11 +143,11 @@ HalpOpcodeINTnn(IN PHAL_BIOS_FRAME BiosFrame)
TrapFrame->HardwareEsp = BiosFrame->Esp; TrapFrame->HardwareEsp = BiosFrame->Esp;
TrapFrame->SegCs = BiosFrame->SegCs; TrapFrame->SegCs = BiosFrame->SegCs;
TrapFrame->EFlags = BiosFrame->EFlags; TrapFrame->EFlags = BiosFrame->EFlags;
/* Success */ /* Success */
return TRUE; return TRUE;
} }
/* Failure */ /* Failure */
return FALSE; return FALSE;
} }
@ -158,7 +158,7 @@ HalpDispatchV86Opcode(IN PKTRAP_FRAME TrapFrame)
{ {
UCHAR Instruction; UCHAR Instruction;
HAL_BIOS_FRAME BiosFrame; HAL_BIOS_FRAME BiosFrame;
/* Fill out the BIOS frame */ /* Fill out the BIOS frame */
BiosFrame.TrapFrame = TrapFrame; BiosFrame.TrapFrame = TrapFrame;
BiosFrame.SegSs = TrapFrame->HardwareSegSs; BiosFrame.SegSs = TrapFrame->HardwareSegSs;
@ -167,15 +167,15 @@ HalpDispatchV86Opcode(IN PKTRAP_FRAME TrapFrame)
BiosFrame.SegCs = TrapFrame->SegCs; BiosFrame.SegCs = TrapFrame->SegCs;
BiosFrame.Eip = TrapFrame->Eip; BiosFrame.Eip = TrapFrame->Eip;
BiosFrame.Prefix = 0; BiosFrame.Prefix = 0;
/* Convert CS to linear */ /* Convert CS to linear */
BiosFrame.CsBase = BiosFrame.SegCs << 4; BiosFrame.CsBase = BiosFrame.SegCs << 4;
BiosFrame.CsLimit = 0xFFFF; BiosFrame.CsLimit = 0xFFFF;
BiosFrame.CsFlags = 0; BiosFrame.CsFlags = 0;
/* Validate IP */ /* Validate IP */
if (BiosFrame.Eip > BiosFrame.CsLimit) return FALSE; if (BiosFrame.Eip > BiosFrame.CsLimit) return FALSE;
/* Read IP */ /* Read IP */
Instruction = *(PUCHAR)(BiosFrame.CsBase + BiosFrame.Eip); Instruction = *(PUCHAR)(BiosFrame.CsBase + BiosFrame.Eip);
if (Instruction != 0xCD) if (Instruction != 0xCD)
@ -184,17 +184,17 @@ HalpDispatchV86Opcode(IN PKTRAP_FRAME TrapFrame)
HalpOpcodeInvalid(&BiosFrame); HalpOpcodeInvalid(&BiosFrame);
return FALSE; return FALSE;
} }
/* Handle the interrupt */ /* Handle the interrupt */
if (HalpOpcodeINTnn(&BiosFrame)) if (HalpOpcodeINTnn(&BiosFrame))
{ {
/* Update EIP */ /* Update EIP */
TrapFrame->Eip = BiosFrame.Eip; TrapFrame->Eip = BiosFrame.Eip;
/* We're done */ /* We're done */
return TRUE; return TRUE;
} }
/* Failure */ /* Failure */
return FALSE; return FALSE;
} }
@ -209,7 +209,7 @@ HalpTrap0DHandler(IN PKTRAP_FRAME TrapFrame)
{ {
/* Enter the trap */ /* Enter the trap */
KiEnterTrap(TrapFrame); KiEnterTrap(TrapFrame);
/* Check if this is a V86 trap */ /* Check if this is a V86 trap */
if (TrapFrame->EFlags & EFLAGS_V86_MASK) if (TrapFrame->EFlags & EFLAGS_V86_MASK)
{ {
@ -217,7 +217,7 @@ HalpTrap0DHandler(IN PKTRAP_FRAME TrapFrame)
HalpDispatchV86Opcode(TrapFrame); HalpDispatchV86Opcode(TrapFrame);
KiEoiHelper(TrapFrame); KiEoiHelper(TrapFrame);
} }
/* Strange, it isn't! This can happen during NMI */ /* Strange, it isn't! This can happen during NMI */
DPRINT1("HAL: Trap0D while not in V86 mode\n"); DPRINT1("HAL: Trap0D while not in V86 mode\n");
KiDumpTrapFrame(TrapFrame); KiDumpTrapFrame(TrapFrame);
@ -235,7 +235,7 @@ HalpTrap06(VOID)
Ke386SetDs(KGDT_R3_DATA | RPL_MASK); Ke386SetDs(KGDT_R3_DATA | RPL_MASK);
Ke386SetFs(KGDT_R0_PCR); Ke386SetFs(KGDT_R0_PCR);
/* Restore the stack */ /* Restore the stack */
KeGetPcr()->TSS->Esp0 = HalpSavedEsp0; KeGetPcr()->TSS->Esp0 = HalpSavedEsp0;
/* Return back to where we left */ /* Return back to where we left */
@ -252,24 +252,24 @@ HalpBiosCall(VOID)
/* Must be volatile so it doesn't get optimized away! */ /* Must be volatile so it doesn't get optimized away! */
volatile KTRAP_FRAME V86TrapFrame; volatile KTRAP_FRAME V86TrapFrame;
ULONG_PTR StackOffset, CodeOffset; ULONG_PTR StackOffset, CodeOffset;
/* Save the context, check for return */ /* Save the context, check for return */
if (_setjmp(HalpSavedContext)) if (_setjmp(HalpSavedContext))
{ {
/* Returned from v86 */ /* Returned from v86 */
return; return;
} }
/* Kill alignment faults */ /* Kill alignment faults */
__writecr0(__readcr0() & ~CR0_AM); __writecr0(__readcr0() & ~CR0_AM);
/* Set new stack address */ /* Set new stack address */
KeGetPcr()->TSS->Esp0 = (ULONG)&V86TrapFrame - 0x20 - sizeof(FX_SAVE_AREA); KeGetPcr()->TSS->Esp0 = (ULONG)&V86TrapFrame - 0x20 - sizeof(FX_SAVE_AREA);
/* Compute segmented IP and SP offsets */ /* Compute segmented IP and SP offsets */
StackOffset = (ULONG_PTR)&HalpRealModeEnd - 4 - (ULONG_PTR)HalpRealModeStart; StackOffset = (ULONG_PTR)&HalpRealModeEnd - 4 - (ULONG_PTR)HalpRealModeStart;
CodeOffset = (ULONG_PTR)HalpRealModeStart & 0xFFF; CodeOffset = (ULONG_PTR)HalpRealModeStart & 0xFFF;
/* Now build the V86 trap frame */ /* Now build the V86 trap frame */
V86TrapFrame.V86Es = 0; V86TrapFrame.V86Es = 0;
V86TrapFrame.V86Ds = 0; V86TrapFrame.V86Ds = 0;
@ -280,7 +280,7 @@ HalpBiosCall(VOID)
V86TrapFrame.EFlags = __readeflags() | EFLAGS_V86_MASK | EFLAGS_IOPL; V86TrapFrame.EFlags = __readeflags() | EFLAGS_V86_MASK | EFLAGS_IOPL;
V86TrapFrame.SegCs = 0x2000; V86TrapFrame.SegCs = 0x2000;
V86TrapFrame.Eip = CodeOffset; V86TrapFrame.Eip = CodeOffset;
/* Exit to V86 mode */ /* Exit to V86 mode */
HalpExitToV86((PKTRAP_FRAME)&V86TrapFrame); HalpExitToV86((PKTRAP_FRAME)&V86TrapFrame);
} }
@ -339,7 +339,7 @@ HalpBorrowTss(VOID)
TssGdt->HighWord.Bits.Type = I386_TSS; TssGdt->HighWord.Bits.Type = I386_TSS;
TssGdt->HighWord.Bits.Pres = 1; TssGdt->HighWord.Bits.Pres = 1;
TssGdt->HighWord.Bits.Dpl = 0; TssGdt->HighWord.Bits.Dpl = 0;
// //
// Load new TSS and return old one // Load new TSS and return old one
// //
@ -353,7 +353,7 @@ HalpReturnTss(VOID)
{ {
PKGDTENTRY TssGdt; PKGDTENTRY TssGdt;
PKTSS TssBase; PKTSS TssBase;
// //
// Get the original TSS // Get the original TSS
// //
@ -497,7 +497,7 @@ HalpMapRealModeMemory(VOID)
// Map the physical address into our real-mode region // Map the physical address into our real-mode region
// //
Pte->PageFrameNumber = V86Pte->PageFrameNumber; Pte->PageFrameNumber = V86Pte->PageFrameNumber;
// //
// Keep going until we've reached the end of our region // Keep going until we've reached the end of our region
// //
@ -557,7 +557,7 @@ HalpSetupRealModeIoPermissionsAndTask(VOID)
// //
// Save our stack pointer // Save our stack pointer
// //
HalpSavedEsp0 = KeGetPcr()->TSS->Esp0; HalpSavedEsp0 = KeGetPcr()->TSS->Esp0;
} }
VOID VOID
@ -661,7 +661,7 @@ HalpBiosDisplayReset(VOID)
// //
HalpMapRealModeMemory(); HalpMapRealModeMemory();
// //
// On P5, the first 7 entries of the IDT are write protected to work around // On P5, the first 7 entries of the IDT are write protected to work around
// the cmpxchg8b lock errata. Unprotect them here so we can set our custom // the cmpxchg8b lock errata. Unprotect them here so we can set our custom
// invalid op-code handler. // invalid op-code handler.
@ -699,7 +699,7 @@ HalpBiosDisplayReset(VOID)
// Restore TSS and IOPM // Restore TSS and IOPM
// //
HalpRestoreIoPermissionsAndTask(); HalpRestoreIoPermissionsAndTask();
// //
// Restore low memory mapping // Restore low memory mapping
// //