Code clean-up.

svn path=/trunk/; revision=11510
This commit is contained in:
Eric Kohl 2004-10-31 19:46:10 +00:00
parent 9bb9d462ba
commit 8c1d092798
10 changed files with 611 additions and 643 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: display.c,v 1.17 2004/10/31 15:56:20 navaraf Exp $
/* $Id: display.c,v 1.18 2004/10/31 19:45:16 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -179,7 +179,7 @@ static ULONG SizeY = 25;
static BOOLEAN DisplayInitialized = FALSE;
static BOOLEAN HalOwnsDisplay = TRUE;
static WORD *VideoBuffer = NULL;
static PUSHORT VideoBuffer = NULL;
static PUCHAR GraphVideoBuffer = NULL;
static PHAL_RESET_DISPLAY_PARAMETERS HalResetDisplayParameters = NULL;
@ -191,7 +191,7 @@ static UCHAR SavedTextAcReg[VGA_AC_NUM_REGISTERS];
static UCHAR SavedTextGcReg[VGA_GC_NUM_REGISTERS];
static UCHAR SavedTextSeqReg[VGA_SEQ_NUM_REGISTERS];
static UCHAR SavedTextFont[2][FONT_AMOUNT];
static BOOL TextPaletteEnabled = FALSE;
static BOOLEAN TextPaletteEnabled = FALSE;
/* PRIVATE FUNCTIONS *********************************************************/
@ -214,7 +214,7 @@ HalClearDisplay (UCHAR CharAttribute)
VOID STATIC
HalScrollDisplay (VOID)
{
WORD *ptr;
PUSHORT ptr;
int i;
ptr = VideoBuffer + SizeX;
@ -232,7 +232,7 @@ HalScrollDisplay (VOID)
VOID STATIC FASTCALL
HalPutCharacter (CHAR Character)
{
WORD *ptr;
PUSHORT ptr;
ptr = VideoBuffer + ((CursorY * SizeX) + CursorX);
*ptr = (CHAR_ATTRIBUTE << 8) + Character;
@ -329,7 +329,7 @@ HalReadCrtc(ULONG Index)
}
VOID STATIC FASTCALL
HalResetSeq(BOOL Start)
HalResetSeq(BOOLEAN Start)
{
if (Start)
{
@ -342,7 +342,7 @@ HalResetSeq(BOOL Start)
}
VOID STATIC FASTCALL
HalBlankScreen(BOOL On)
HalBlankScreen(BOOLEAN On)
{
UCHAR Scrn;
@ -577,7 +577,7 @@ HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
ULONG ScanLines;
ULONG Data;
VideoBuffer = (WORD *)(0xff3b8000);
VideoBuffer = (PUSHORT)(0xff3b8000);
GraphVideoBuffer = (PUCHAR)(0xff3a0000);
/* Set cursor position */
@ -620,7 +620,7 @@ HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock)
/* PUBLIC FUNCTIONS *********************************************************/
VOID STDCALL
HalReleaseDisplayOwnership()
HalReleaseDisplayOwnership(VOID)
/*
* FUNCTION: Release ownership of display back to HAL
*/
@ -675,7 +675,7 @@ HalDisplayString(IN PCH String)
ULONG Flags;
/* See comment at top of file */
if (! HalOwnsDisplay)
if (!HalOwnsDisplay)
{
return;
}
@ -780,10 +780,11 @@ HalSetDisplayParameters(IN ULONG CursorPosX,
CursorY = (CursorPosY < SizeY) ? CursorPosY : SizeY - 1;
}
BOOLEAN STDCALL
HalQueryDisplayOwnership()
HalQueryDisplayOwnership(VOID)
{
return ! HalOwnsDisplay;
return !HalOwnsDisplay;
}
/* EOF */

View file

@ -5,15 +5,6 @@
#ifndef __INTERNAL_HAL_HAL_H
#define __INTERNAL_HAL_HAL_H
/*
* FUNCTION: Probes for a BIOS32 extension
*/
VOID Hal_bios32_probe(VOID);
/*
* FUNCTION: Determines if a a bios32 service is present
*/
BOOLEAN Hal_bios32_is_service_present(ULONG service);
/* display.c */
VOID FASTCALL HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock);

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.5 2004/07/20 21:25:36 hbirr Exp $
/* $Id: misc.c,v 1.6 2004/10/31 19:45:16 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -15,44 +15,45 @@
/* FUNCTIONS ****************************************************************/
VOID STDCALL
HalHandleNMI (ULONG Unused)
HalHandleNMI(ULONG Unused)
{
UCHAR ucStatus;
UCHAR ucStatus;
ucStatus = READ_PORT_UCHAR((PUCHAR) 0x61);
ucStatus = READ_PORT_UCHAR((PUCHAR) 0x61);
HalDisplayString ("\n*** Hardware Malfunction\n\n");
HalDisplayString ("Call your hardware vendor for support\n\n");
HalDisplayString ("\n*** Hardware Malfunction\n\n");
HalDisplayString ("Call your hardware vendor for support\n\n");
if (ucStatus & 0x80)
HalDisplayString ("NMI: Parity Check / Memory Parity Error\n");
if (ucStatus & 0x80)
HalDisplayString ("NMI: Parity Check / Memory Parity Error\n");
if (ucStatus & 0x40)
HalDisplayString ("NMI: Channel Check / IOCHK\n");
if (ucStatus & 0x40)
HalDisplayString ("NMI: Channel Check / IOCHK\n");
HalDisplayString ("\n*** The system has halted ***\n");
KeEnterKernelDebugger ();
HalDisplayString ("\n*** The system has halted ***\n");
KeEnterKernelDebugger ();
}
VOID STDCALL
HalProcessorIdle (VOID)
HalProcessorIdle(VOID)
{
#if 1
Ki386EnableInterrupts();
Ki386HaltProcessor();
Ki386EnableInterrupts();
Ki386HaltProcessor();
#else
#endif
}
VOID STDCALL
HalRequestIpi(ULONG Unknown)
{
return;
return;
}
ULONG FASTCALL
HalSystemVectorDispatchEntry (
ULONG Unknown1,
@ -60,48 +61,29 @@ HalSystemVectorDispatchEntry (
ULONG Unknown3
)
{
return 0;
return 0;
}
VOID STDCALL
KeFlushWriteBuffer (
VOID
)
KeFlushWriteBuffer(VOID)
{
return;
return;
}
VOID STDCALL
HalReportResourceUsage (
VOID
)
HalReportResourceUsage(VOID)
{
/*
* FIXME: Report all resources used by hal.
* Calls IoReportHalResourceUsage()
*/
/*
* FIXME: Report all resources used by hal.
* Calls IoReportHalResourceUsage()
*/
/*
* Initialize PCI bus.
*/
HalpInitPciBus ();
#if 0
/*
* Initialize IsaPnP bus.
*/
HalpInitIsaPnpBus ();
/* Initialize PCI bus. */
HalpInitPciBus ();
/*
* Initialize other busses???
*/
/*
* Probe for a BIOS32 extension
*/
Hal_bios32_probe();
#endif
return;
return;
}
/* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: bthread.S,v 1.9 2003/06/16 19:18:48 hbirr Exp $
/* $Id: bthread.S,v 1.10 2004/10/31 19:46:10 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -94,7 +94,7 @@ _PsBeginThread:
*/
pushl $0
call _KeBugCheck@4
addl $4, %esp
addl $4, %esp
/*
* And if that fails then loop
@ -156,4 +156,3 @@ _PsBeginThreadWithContextInternal:
/* Load the rest of the thread's user mode context. */
movl $0, %eax
jmp KeReturnFromSystemCallWithHook

View file

@ -31,21 +31,21 @@
.globl _mcount
_mcount:
/* Save the caller-clobbered registers. */
pushl %eax
pushl %ecx
pushl %edx
pushl %eax
pushl %ecx
pushl %edx
movw $0xe9, %dx
movl 4(%ebp), %eax
outl %eax, %dx
movl 12(%esp), %eax
outl %eax, %dx
movw $0xe9, %dx
movl 4(%ebp), %eax
outl %eax, %dx
movl 12(%esp), %eax
outl %eax, %dx
/* Pop the saved registers. Please note that `mcount' has no
return value. */
popl %edx
popl %ecx
popl %eax
popl %edx
popl %ecx
popl %eax
ret

View file

@ -6,462 +6,461 @@ _irq_handler_0:
cld
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $0
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $0
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_1
_irq_handler_1:
cld
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $1
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $1
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_2
_irq_handler_2:
cld
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $2
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $2
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_3
_irq_handler_3:
cld
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $3
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $3
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_4
_irq_handler_4:
cld
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $4
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $4
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_5
_irq_handler_5:
cld
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $5
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $5
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_6
_irq_handler_6:
cld
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $6
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $6
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_7
_irq_handler_7:
cld
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $7
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $7
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_8
_irq_handler_8:
cld
pusha
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $8
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $8
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_9
_irq_handler_9:
cld
pusha
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $9
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $9
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_10
_irq_handler_10:
cld
pusha
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $10
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $10
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_11
_irq_handler_11:
cld
pusha
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $11
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $11
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_12
_irq_handler_12:
cld
pusha
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $12
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $12
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_13
_irq_handler_13:
cld
pusha
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $13
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $13
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_14
_irq_handler_14:
cld
pusha
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $14
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $14
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
.global _irq_handler_15
_irq_handler_15:
cld
pusha
pusha
pushl %ds
pushl %es
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
pushl %fs
pushl %gs
movl $0xceafbeef,%eax
pushl %eax
movw $KERNEL_DS,%ax
movw %ax,%ds
movw %ax,%es
movw %ax,%gs
movl $PCR_SELECTOR, %eax
movl %eax, %fs
pushl %esp
pushl $15
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret
pushl %esp
pushl $15
call _KiInterruptDispatch
popl %eax
popl %eax
popl %eax
popl %gs
popl %fs
popl %es
popl %ds
popa
iret

View file

@ -82,9 +82,9 @@ _multiboot_entry:
/*
* Save the multiboot or application processor magic
*/
movl %eax, %edx
movl %eax, %edx
cmpl $AP_MAGIC, %edx
cmpl $AP_MAGIC, %edx
je .m1
#endif /* MP */
@ -232,8 +232,8 @@ _multiboot_entry:
#ifdef MP
cmpl $AP_MAGIC, %edx
jne .m2
cmpl $AP_MAGIC, %edx
jne .m2
/*
* This is an application processor executing

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: syscall.S,v 1.17 2004/08/21 21:13:45 tamlin Exp $
/* $Id: syscall.S,v 1.18 2004/10/31 19:46:10 ekohl Exp $
*
* FILE: ntoskrnl/ke/i386/syscall.S
* PURPOSE: 2E trap handler
@ -149,92 +149,94 @@ new_serviceInRange:
#ifdef DBG
/* GDB thinks the function starts here and
wants a standard prolog, so let's give it */
pushl %ebp
movl %esp,%ebp
popl %ebp
pushl %ebp
movl %esp,%ebp
popl %ebp
#endif
/* Allocate room for argument list from kernel stack */
movl %es:_KeServiceDescriptorTable + 12, %ecx
movb %es:(%ecx, %eax), %cl
movzx %cl, %ecx
subl %ecx, %esp
movl %es:_KeServiceDescriptorTable + 12, %ecx
movb %es:(%ecx, %eax), %cl
movzx %cl, %ecx
subl %ecx, %esp
/* Copy the arguments from the user stack to the kernel stack */
movl %esp,%edi
movl %esp,%edi
cld
rep movsb
rep movsb
/* DS is now also kernel segment */
movw %bx, %ds
movw %bx, %ds
/* Call system call hook */
pushl %eax
call _KiSystemCallHook
popl %eax
pushl %eax
call _KiSystemCallHook
popl %eax
/* Make the system service call */
movl %es:_KeServiceDescriptorTable, %ecx
movl %es:(%ecx, %eax, 4), %eax
call *%eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
movl %es:_KeServiceDescriptorTable, %ecx
movl %es:(%ecx, %eax, 4), %eax
call *%eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
#if CHECKED
/* Bump Service Counter */
#endif
jmp KeDeallocateStackAndReturnFromSystemCallWithHook
jmp KeDeallocateStackAndReturnFromSystemCallWithHook
new_useShadowTable:
subl $0x1000, %eax
subl $0x1000, %eax
/* Check to see if EAX is valid/inrange */
cmpl %es:_KeServiceDescriptorTableShadow + 24, %eax
jbe new_shadowServiceInRange
movl $STATUS_INVALID_SYSTEM_SERVICE, %eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
jmp KeReturnFromSystemCall
cmpl %es:_KeServiceDescriptorTableShadow + 24, %eax
jbe new_shadowServiceInRange
movl $STATUS_INVALID_SYSTEM_SERVICE, %eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
jmp KeReturnFromSystemCall
new_shadowServiceInRange:
#ifdef DBG
/* GDB thinks the function starts here and
wants a standard prolog, so let's give it */
pushl %ebp
movl %esp,%ebp
popl %ebp
/*
* GDB thinks the function starts here and
* wants a standard prolog, so let's give it
*/
pushl %ebp
movl %esp,%ebp
popl %ebp
#endif
/* Allocate room for argument list from kernel stack */
movl %es:_KeServiceDescriptorTableShadow + 28, %ecx
movb %es:(%ecx, %eax), %cl
movzx %cl, %ecx
subl %ecx, %esp
movl %es:_KeServiceDescriptorTableShadow + 28, %ecx
movb %es:(%ecx, %eax), %cl
movzx %cl, %ecx
subl %ecx, %esp
/* Copy the arguments from the user stack to the kernel stack */
movl %esp,%edi
movl %esp,%edi
cld
rep movsb
rep movsb
/* DS is now also kernel segment */
movw %bx,%ds
movw %bx,%ds
/* Call system call hook */
// pushl %eax
// call _KiSystemCallHook
// popl %eax
// pushl %eax
// call _KiSystemCallHook
// popl %eax
/* Call service check routine */
pushl %eax
call _KiServiceCheck
popl %eax
pushl %eax
call _KiServiceCheck
popl %eax
/* Make the system service call */
movl %es:_KeServiceDescriptorTableShadow + 16, %ecx
movl %es:(%ecx, %eax, 4), %eax
call *%eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
movl %es:_KeServiceDescriptorTableShadow + 16, %ecx
movl %es:(%ecx, %eax, 4), %eax
call *%eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
#if CHECKED
/* Bump Service Counter */
@ -242,59 +244,59 @@ new_shadowServiceInRange:
KeDeallocateStackAndReturnFromSystemCallWithHook:
/* Deallocate the kernel stack frame */
movl %ebp,%esp
movl %ebp,%esp
KeReturnFromSystemCallWithHook:
/* Call the post system call hook and deliver any pending APCs */
pushl %esp
call _KiAfterSystemCallHook
addl $4,%esp
pushl %esp
call _KiAfterSystemCallHook
addl $4,%esp
KeReturnFromSystemCall:
/* Restore the user context */
/* Get a pointer to the current thread */
movl %fs:0x124, %esi
movl %fs:0x124, %esi
/* Restore the old trap frame pointer */
movl KTRAP_FRAME_EDX(%esp), %ebx
movl %ebx, KTHREAD_TRAP_FRAME(%esi)
movl KTRAP_FRAME_EDX(%esp), %ebx
movl %ebx, KTHREAD_TRAP_FRAME(%esi)
KiRosTrapReturn:
#if 0
mov KTRAP_FRAME_RESERVED1(%ebp), %ax
cmp %ax, SSIDX_NTCONTINUE
jnz KeNoEpilogPrint
movl KTRAP_FRAME_ESP(%ebp), %ecx
movl KTRAP_FRAME_EBP(%ebp), %edx
call @KeRosPrintEspEbp@8
mov KTRAP_FRAME_RESERVED1(%ebp), %ax
cmp %ax, SSIDX_NTCONTINUE
jnz KeNoEpilogPrint
movl KTRAP_FRAME_ESP(%ebp), %ecx
movl KTRAP_FRAME_EBP(%ebp), %edx
call @KeRosPrintEspEbp@8
KeNoEpilogPrint:
#endif
/* Skip debug information and unsaved registers */
addl $0x30, %esp
popl %gs
popl %es
popl %ds
popl %edx
popl %ecx
popl %eax
addl $0x30, %esp
popl %gs
popl %es
popl %ds
popl %edx
popl %ecx
popl %eax
/* Restore the old previous mode */
popl %ebx
movb %bl, %ss:KTHREAD_PREVIOUS_MODE(%esi)
popl %ebx
movb %bl, %ss:KTHREAD_PREVIOUS_MODE(%esi)
/* Restore the old exception handler list */
popl %ebx
movl %ebx, %fs:KPCR_EXCEPTION_LIST
popl %ebx
movl %ebx, %fs:KPCR_EXCEPTION_LIST
popl %fs
popl %edi
popl %esi
popl %ebx
popl %ebp
addl $0x4, %esp /* Ignore error code */
popl %fs
popl %edi
popl %esi
popl %ebx
popl %ebp
addl $0x4, %esp /* Ignore error code */
iret
@ -305,18 +307,18 @@ KeNoEpilogPrint:
@KeRosTrapReturn@8:
/* point %esp to the trap frame to restore */
movl %ecx, %esp
movl %esp, %ebp
movl %ecx, %esp
movl %esp, %ebp
/* Call the post system call hook and deliver any pending APCs */
pushl %esp
call _KiAfterSystemCallHook
addl $4,%esp
pushl %esp
call _KiAfterSystemCallHook
addl $4,%esp
/* Restore the user context */
/* Get a pointer to the current thread */
movl %fs:0x124, %esi
movl %fs:0x124, %esi
/* Restore the old trap frame pointer */
movl %edx, KTHREAD_TRAP_FRAME(%esi)
movl %edx, KTHREAD_TRAP_FRAME(%esi)
jmp KiRosTrapReturn;
jmp KiRosTrapReturn;

View file

@ -83,10 +83,10 @@ _Ki386ContextSwitch:
*/
movl %ebx, %fs:KPCR_CURRENT_THREAD
/*
/*
* Set the current LDT
*/
xorl %eax, %eax
xorl %eax, %eax
movl KTHREAD_APCSTATE_PROCESS(%ebx), %edi
testw $0xFFFF, KPROCESS_LDT_DESCRIPTOR0(%edi)
jz .L4
@ -106,7 +106,7 @@ _Ki386ContextSwitch:
* Load up the iomap offset for this thread in
* preparation for setting it below.
*/
movl KPROCESS_IOPM_OFFSET(%edi), %eax
movl KPROCESS_IOPM_OFFSET(%edi), %eax
/*
* FIXME: Save debugging state.
@ -130,10 +130,10 @@ _Ki386ContextSwitch:
*/
movl %fs:KPCR_TSS, %esi
/*
* Set current IOPM offset in the TSS
*/
movw %ax, KTSS_IOMAPBASE(%esi)
/*
* Set current IOPM offset in the TSS
*/
movw %ax, KTSS_IOMAPBASE(%esi)
movl KTHREAD_INITIAL_STACK(%ebx), %eax
movl %eax, KTSS_ESP0(%esi)
@ -173,5 +173,5 @@ _Ki386ContextSwitch:
popl %esi
popl %ebx
popl %ebp
popl %ebp
ret

View file

@ -40,7 +40,7 @@
* specified values.
*/
_Ki386RetToV86Mode:
/*
/*
* Setup a stack frame
*/
pushl %ebp
@ -89,7 +89,7 @@ _Ki386RetToV86Mode:
* will be the current stack adjusted so we don't overwrite the
* existing stack frames
*/
movl %fs:KPCR_TSS, %esi
movl %fs:KPCR_TSS, %esi
movl %esp, KTSS_ESP0(%esi)
/*
@ -183,7 +183,7 @@ _KiV86Complete:
* Restore the initial stack
*/
popl %eax
movl %fs:KPCR_TSS, %esi
movl %fs:KPCR_TSS, %esi
movl %eax, KTSS_ESP0(%esi)
/*
@ -207,9 +207,3 @@ _KiV86Complete:
movl %ebp, %esp
popl %ebp
ret