Remove trailing whitespace and fix indentation

svn path=/trunk/; revision=16401
This commit is contained in:
Eric Kohl 2005-07-03 21:37:16 +00:00
parent d3bf39b1f2
commit fae2febad9
2 changed files with 80 additions and 83 deletions

View file

@ -25,16 +25,16 @@
.globl _KiDebugService .globl _KiDebugService
_KiFastCallEntry: _KiFastCallEntry:
/* Set FS to PCR */ /* Set FS to PCR */
movl $PCR_SELECTOR, %ecx movl $PCR_SELECTOR, %ecx
movw %cx, %fs movw %cx, %fs
/* Set the current stack to Kernel Stack */ /* Set the current stack to Kernel Stack */
movl %fs:KPCR_TSS, %ecx movl %fs:KPCR_TSS, %ecx
movl %ss:KTSS_ESP0(%ecx), %ecx movl %ss:KTSS_ESP0(%ecx), %ecx
movl %ecx, %esp movl %ecx, %esp
/* Set up a fake INT Stack. */ /* Set up a fake INT Stack. */
pushl $USER_DS pushl $USER_DS
pushl %edx /* Ring 3 SS:ESP */ pushl %edx /* Ring 3 SS:ESP */
@ -42,13 +42,13 @@ _KiFastCallEntry:
orl $X86_EFLAGS_IF, (%esp) /* Re-enable IRQs in EFLAGS, to fake INT */ orl $X86_EFLAGS_IF, (%esp) /* Re-enable IRQs in EFLAGS, to fake INT */
pushl $USER_CS pushl $USER_CS
pushl $KUSER_SHARED_SYSCALL_RET pushl $KUSER_SHARED_SYSCALL_RET
/* User Parameter List */ /* User Parameter List */
add $8, %edx add $8, %edx
_KiSystemService: _KiSystemService:
/* /*
* Construct a trap frame on the stack. * Construct a trap frame on the stack.
* The following are already on the stack. * The following are already on the stack.
*/ */
@ -63,11 +63,11 @@ _KiSystemService:
pushl %esi // + 0x20 pushl %esi // + 0x20
pushl %edi // + 0x24 pushl %edi // + 0x24
pushl %fs // + 0x28 pushl %fs // + 0x28
/* Load PCR Selector into fs */ /* Load PCR Selector into fs */
movw $PCR_SELECTOR, %bx movw $PCR_SELECTOR, %bx
movw %bx, %fs movw %bx, %fs
/* Save the previous exception list */ /* Save the previous exception list */
pushl %fs:KPCR_EXCEPTION_LIST // + 0x2C pushl %fs:KPCR_EXCEPTION_LIST // + 0x2C
@ -79,7 +79,7 @@ _KiSystemService:
/* Save the old previous mode */ /* Save the old previous mode */
pushl %ss:KTHREAD_PREVIOUS_MODE(%esi) // + 0x30 pushl %ss:KTHREAD_PREVIOUS_MODE(%esi) // + 0x30
/* Set the new previous mode based on the saved CS selector */ /* Set the new previous mode based on the saved CS selector */
movl 0x24(%esp), %ebx movl 0x24(%esp), %ebx
andl $1, %ebx andl $1, %ebx
@ -120,7 +120,7 @@ _KiSystemService:
movl %ebp, KTHREAD_TRAP_FRAME(%esi) movl %ebp, KTHREAD_TRAP_FRAME(%esi)
CheckValidCall: CheckValidCall:
#ifdef DBG #ifdef DBG
/* /*
* GDB thinks the function starts here and * GDB thinks the function starts here and
@ -139,29 +139,29 @@ CheckValidCall:
shrl $8, %edi shrl $8, %edi
andl $0x10, %edi andl $0x10, %edi
movl %edi, %ecx movl %edi, %ecx
/* Now add the thread's base system table to the offset */ /* Now add the thread's base system table to the offset */
addl KTHREAD_SERVICE_TABLE(%esi), %edi addl KTHREAD_SERVICE_TABLE(%esi), %edi
/* Get the true syscall ID and check it */ /* Get the true syscall ID and check it */
movl %eax, %ebx movl %eax, %ebx
andl $0x0FFF, %eax andl $0x0FFF, %eax
cmpl 8(%edi), %eax cmpl 8(%edi), %eax
/* Invalid ID, try to load Win32K Table */ /* Invalid ID, try to load Win32K Table */
jnb KiBBTUnexpectedRange jnb KiBBTUnexpectedRange
/* Users's current stack frame pointer is source */ /* Users's current stack frame pointer is source */
movl %edx, %esi movl %edx, %esi
/* Allocate room for argument list from kernel stack */ /* Allocate room for argument list from kernel stack */
movl 12(%edi), %ecx movl 12(%edi), %ecx
movb (%ecx, %eax), %cl movb (%ecx, %eax), %cl
movzx %cl, %ecx movzx %cl, %ecx
/* Allocate space on our stack */ /* Allocate space on our stack */
subl %ecx, %esp subl %ecx, %esp
/* Get pointer to function */ /* Get pointer to function */
movl (%edi), %edi movl (%edi), %edi
movl (%edi, %eax, 4), %eax movl (%edi, %eax, 4), %eax
@ -193,25 +193,25 @@ _KiServiceExit:
/* Get the Current Thread */ /* Get the Current Thread */
cli cli
movl %fs:KPCR_CURRENT_THREAD, %esi movl %fs:KPCR_CURRENT_THREAD, %esi
/* Deliver APCs only if we were called from user mode */ /* Deliver APCs only if we were called from user mode */
testb $1, KTRAP_FRAME_CS(%esp) testb $1, KTRAP_FRAME_CS(%esp)
je KiRosTrapReturn je KiRosTrapReturn
/* And only if any are actually pending */ /* And only if any are actually pending */
cmpb $0, KTHREAD_PENDING_USER_APC(%esi) cmpb $0, KTHREAD_PENDING_USER_APC(%esi)
je KiRosTrapReturn je KiRosTrapReturn
/* Save pointer to Trap Frame */ /* Save pointer to Trap Frame */
movl %esp, %ebx movl %esp, %ebx
/* Raise IRQL to APC_LEVEL */ /* Raise IRQL to APC_LEVEL */
movl $1, %ecx movl $1, %ecx
call @KfRaiseIrql@4 call @KfRaiseIrql@4
/* Save old IRQL */ /* Save old IRQL */
pushl %eax pushl %eax
/* Deliver APCs */ /* Deliver APCs */
sti sti
pushl %ebx pushl %ebx
@ -219,13 +219,13 @@ _KiServiceExit:
pushl $UserMode pushl $UserMode
call _KiDeliverApc@12 call _KiDeliverApc@12
cli cli
/* Return to old IRQL */ /* Return to old IRQL */
popl %ecx popl %ecx
call @KfLowerIrql@4 call @KfLowerIrql@4
KiRosTrapReturn: KiRosTrapReturn:
/* Skip debug information and unsaved registers */ /* Skip debug information and unsaved registers */
addl $0x30, %esp // + 0x48 addl $0x30, %esp // + 0x48
popl %gs // + 0x44 popl %gs // + 0x44
@ -252,11 +252,11 @@ KiRosTrapReturn:
/* Check if previous CS is from user-mode */ /* Check if previous CS is from user-mode */
testl $1, 4(%esp) testl $1, 4(%esp)
/* It is, so use Fast Exit */ /* It is, so use Fast Exit */
jnz FastRet jnz FastRet
/* /*
* Restore what the stub pushed, and return back to it. * Restore what the stub pushed, and return back to it.
* Note that we were CALLed, so the first thing on our stack is the ret EIP! * Note that we were CALLed, so the first thing on our stack is the ret EIP!
*/ */
@ -264,9 +264,9 @@ KiRosTrapReturn:
pop %ecx // + 0x08 pop %ecx // + 0x08
popf // + 0x04 popf // + 0x04
jmp *%edx jmp *%edx
IntRet: IntRet:
iret iret
FastRet: FastRet:
@ -278,15 +278,15 @@ FastRet:
/* Restore FS to TIB */ /* Restore FS to TIB */
mov $TEB_SELECTOR, %ecx mov $TEB_SELECTOR, %ecx
mov %ecx, %fs mov %ecx, %fs
/* We will be cleaning up the stack ourselves */ /* We will be cleaning up the stack ourselves */
popl %edx /* New Ring 3 EIP */ popl %edx /* New Ring 3 EIP */
add $0x4, %esp /* Skip Ring 3 DS */ add $0x4, %esp /* Skip Ring 3 DS */
andl $~X86_EFLAGS_IF, (%esp) /* Remove IRQ hack from EFLAGS */ andl $~X86_EFLAGS_IF, (%esp) /* Remove IRQ hack from EFLAGS */
popfl /* Restore old EFLAGS */ popfl /* Restore old EFLAGS */
popl %ecx /* Old Ring 3 SS:ESP */ popl %ecx /* Old Ring 3 SS:ESP */
/* /*
* At this point: * At this point:
* ECX points to the old User Stack. * ECX points to the old User Stack.
* EDX points to the instruction to execute in usermode after the sysenter * EDX points to the instruction to execute in usermode after the sysenter
@ -306,41 +306,41 @@ KiBBTUnexpectedRange:
call _KiServiceCheck call _KiServiceCheck
popl %eax popl %eax
popl %edx popl %edx
/* Try the Call again */ /* Try the Call again */
jmp CheckValidCall jmp CheckValidCall
InvalidCall: InvalidCall:
/* Invalid System Call */ /* Invalid System Call */
movl $0xC000001C, %eax /* STATUS_INVALID_SYSTEM_SERVICE */ movl $0xC000001C, %eax /* STATUS_INVALID_SYSTEM_SERVICE */
movl %eax, KTRAP_FRAME_EAX(%ebp) movl %eax, KTRAP_FRAME_EAX(%ebp)
jmp _KiServiceExit jmp _KiServiceExit
_KiServiceExit2: _KiServiceExit2:
/* Get the Current Thread */ /* Get the Current Thread */
cli cli
movl %fs:KPCR_CURRENT_THREAD, %esi movl %fs:KPCR_CURRENT_THREAD, %esi
/* Deliver APCs only if we were called from user mode */ /* Deliver APCs only if we were called from user mode */
testb $1, KTRAP_FRAME_CS(%esp) testb $1, KTRAP_FRAME_CS(%esp)
je KiRosTrapReturn je KiRosTrapReturn
/* And only if any are actually pending */ /* And only if any are actually pending */
cmpb $0, KTHREAD_PENDING_USER_APC(%esi) cmpb $0, KTHREAD_PENDING_USER_APC(%esi)
je KiRosTrapReturn je KiRosTrapReturn
/* Save pointer to Trap Frame */ /* Save pointer to Trap Frame */
movl %esp, %ebx movl %esp, %ebx
/* Raise IRQL to APC_LEVEL */ /* Raise IRQL to APC_LEVEL */
movl $1, %ecx movl $1, %ecx
call @KfRaiseIrql@4 call @KfRaiseIrql@4
/* Save old IRQL */ /* Save old IRQL */
pushl %eax pushl %eax
/* Deliver APCs */ /* Deliver APCs */
sti sti
pushl %ebx pushl %ebx
@ -348,14 +348,14 @@ _KiServiceExit2:
pushl $UserMode pushl $UserMode
call _KiDeliverApc@12 call _KiDeliverApc@12
cli cli
/* Return to old IRQL */ /* Return to old IRQL */
popl %ecx popl %ecx
call @KfLowerIrql@4 call @KfLowerIrql@4
/* Skip useless Debug Data */ /* Skip useless Debug Data */
addl $0x18, %esp // + 0x74 addl $0x18, %esp // + 0x74
/* Restore Debug Registers */ /* Restore Debug Registers */
popl %eax // + 0x5C popl %eax // + 0x5C
movl %eax, %dr0 movl %eax, %dr0
@ -369,7 +369,7 @@ _KiServiceExit2:
movl %eax, %dr6 movl %eax, %dr6
popl %eax // + 0x48 popl %eax // + 0x48
movl %eax, %dr7 movl %eax, %dr7
/* Restore Registers */ /* Restore Registers */
popl %gs // + 0x44 popl %gs // + 0x44
popl %es // + 0x40 popl %es // + 0x40
@ -393,12 +393,12 @@ _KiServiceExit2:
popl %ebp // + 0x14 popl %ebp // + 0x14
add $4, %esp // + 0x10 add $4, %esp // + 0x10
/* Return to user-mode */ /* Return to user-mode */
iret iret
.intel_syntax noprefix .intel_syntax noprefix
_KiDebugService: _KiDebugService:
/* Create the Trap Frame */ /* Create the Trap Frame */
push 0 push 0
push ebp push ebp
@ -406,18 +406,18 @@ _KiDebugService:
push esi push esi
push edi push edi
push fs push fs
/* Switch to correct FS */ /* Switch to correct FS */
mov bx, PCR_SELECTOR mov bx, PCR_SELECTOR
mov fs, bx mov fs, bx
/* Save Exception List */ /* Save Exception List */
push fs:[KPCR_EXCEPTION_LIST] push fs:[KPCR_EXCEPTION_LIST]
/* Use Old Previous Mode */ /* Use Old Previous Mode */
mov ebx, fs:[KPCR_CURRENT_THREAD] mov ebx, fs:[KPCR_CURRENT_THREAD]
push [ebx+KTHREAD_PREVIOUS_MODE] push [ebx+KTHREAD_PREVIOUS_MODE]
/* Continue building the Trap Frame */ /* Continue building the Trap Frame */
push eax push eax
push ecx push ecx
@ -425,28 +425,28 @@ _KiDebugService:
push ds push ds
push es push es
push gs push gs
/* Switch Segments to Kernel */ /* Switch Segments to Kernel */
mov bx, KERNEL_DS mov bx, KERNEL_DS
mov ds, bx mov ds, bx
mov es, bx mov es, bx
/* Save Debug Registers */ /* Save Debug Registers */
mov ebx, eax mov ebx, eax
mov eax, dr7 mov eax, dr7
push eax push eax
mov eax, dr6 mov eax, dr6
push eax push eax
mov eax, dr3 mov eax, dr3
push eax push eax
mov eax, dr2 mov eax, dr2
push eax push eax
mov eax, dr1 mov eax, dr1
push eax push eax
mov eax, dr0 mov eax, dr0
push eax push eax
mov eax, ebx mov eax, ebx
/* Skip useless debug data */ /* Skip useless debug data */
sub esp, 0x18 sub esp, 0x18
@ -455,6 +455,6 @@ _KiDebugService:
push ecx push ecx
push eax push eax
call _KdpServiceDispatcher@12 call _KdpServiceDispatcher@12
/* Exit through common routine */ /* Exit through common routine */
jmp _KiServiceExit2 jmp _KiServiceExit2

View file

@ -1,7 +1,8 @@
/* i386-specific implemetation of Translation Buffer Flushing /*
* i386-specific implemetation of Translation Buffer Flushing
* Written By: Alex Ionescu <alex@relsoft.net> * Written By: Alex Ionescu <alex@relsoft.net>
* Reference: IA-32 Intel® Architecture Software Developer's Manual, Volume 3: System Programming Guide, * Reference: IA-32 Intel® Architecture Software Developer's Manual, Volume 3: System Programming Guide,
* Chapter 10 - Memory Cache Control. Section 10.9 - Invalidating the Translation Lookaside Buffers * Chapter 10 - Memory Cache Control. Section 10.9 - Invalidating the Translation Lookaside Buffers
*/ */
#include <internal/i386/ke.h> #include <internal/i386/ke.h>
@ -9,24 +10,20 @@
.globl _KeFlushCurrentTb@0 .globl _KeFlushCurrentTb@0
_KeFlushCurrentTb@0: _KeFlushCurrentTb@0:
/* Check for global page support */ /* Check for global page support */
testb $0xff, (_Ke386GlobalPagesEnabled) testb $0xff, (_Ke386GlobalPagesEnabled)
jz .L1 jz .L1
/* Modifying the PSE, PGE or PAE Flag in CR4 causes the TLB to be flushed */ /* Modifying the PSE, PGE or PAE Flag in CR4 causes the TLB to be flushed */
movl %cr4, %eax movl %cr4, %eax
andl $~X86_CR4_PGE, %eax andl $~X86_CR4_PGE, %eax
movl %eax, %cr4 movl %eax, %cr4
orl $X86_CR4_PGE, %eax orl $X86_CR4_PGE, %eax
movl %eax, %cr4 movl %eax, %cr4
ret
ret
.L1: .L1:
/* the old way ... */ /* the old way ... */
movl %cr3, %eax movl %cr3, %eax
movl %eax, %cr3 movl %eax, %cr3
ret ret