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

View file

@ -5,15 +5,6 @@
#ifndef __INTERNAL_HAL_HAL_H #ifndef __INTERNAL_HAL_HAL_H
#define __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 */ /* display.c */
VOID FASTCALL HalInitializeDisplay (PLOADER_PARAMETER_BLOCK LoaderBlock); 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -15,44 +15,45 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
VOID STDCALL 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 ("\n*** Hardware Malfunction\n\n");
HalDisplayString ("Call your hardware vendor for support\n\n"); HalDisplayString ("Call your hardware vendor for support\n\n");
if (ucStatus & 0x80) if (ucStatus & 0x80)
HalDisplayString ("NMI: Parity Check / Memory Parity Error\n"); HalDisplayString ("NMI: Parity Check / Memory Parity Error\n");
if (ucStatus & 0x40) if (ucStatus & 0x40)
HalDisplayString ("NMI: Channel Check / IOCHK\n"); HalDisplayString ("NMI: Channel Check / IOCHK\n");
HalDisplayString ("\n*** The system has halted ***\n"); HalDisplayString ("\n*** The system has halted ***\n");
KeEnterKernelDebugger (); KeEnterKernelDebugger ();
} }
VOID STDCALL VOID STDCALL
HalProcessorIdle (VOID) HalProcessorIdle(VOID)
{ {
#if 1 #if 1
Ki386EnableInterrupts();
Ki386EnableInterrupts(); Ki386HaltProcessor();
Ki386HaltProcessor();
#else #else
#endif #endif
} }
VOID STDCALL VOID STDCALL
HalRequestIpi(ULONG Unknown) HalRequestIpi(ULONG Unknown)
{ {
return; return;
} }
ULONG FASTCALL ULONG FASTCALL
HalSystemVectorDispatchEntry ( HalSystemVectorDispatchEntry (
ULONG Unknown1, ULONG Unknown1,
@ -60,48 +61,29 @@ HalSystemVectorDispatchEntry (
ULONG Unknown3 ULONG Unknown3
) )
{ {
return 0; return 0;
} }
VOID STDCALL VOID STDCALL
KeFlushWriteBuffer ( KeFlushWriteBuffer(VOID)
VOID
)
{ {
return; return;
} }
VOID STDCALL VOID STDCALL
HalReportResourceUsage ( HalReportResourceUsage(VOID)
VOID
)
{ {
/* /*
* FIXME: Report all resources used by hal. * FIXME: Report all resources used by hal.
* Calls IoReportHalResourceUsage() * Calls IoReportHalResourceUsage()
*/ */
/* /* Initialize PCI bus. */
* Initialize PCI bus. HalpInitPciBus ();
*/
HalpInitPciBus ();
#if 0
/*
* Initialize IsaPnP bus.
*/
HalpInitIsaPnpBus ();
/* return;
* Initialize other busses???
*/
/*
* Probe for a BIOS32 extension
*/
Hal_bios32_probe();
#endif
return;
} }
/* EOF */ /* EOF */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -94,7 +94,7 @@ _PsBeginThread:
*/ */
pushl $0 pushl $0
call _KeBugCheck@4 call _KeBugCheck@4
addl $4, %esp addl $4, %esp
/* /*
* And if that fails then loop * And if that fails then loop
@ -156,4 +156,3 @@ _PsBeginThreadWithContextInternal:
/* Load the rest of the thread's user mode context. */ /* Load the rest of the thread's user mode context. */
movl $0, %eax movl $0, %eax
jmp KeReturnFromSystemCallWithHook jmp KeReturnFromSystemCallWithHook

View file

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

View file

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

View file

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

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * FILE: ntoskrnl/ke/i386/syscall.S
* PURPOSE: 2E trap handler * PURPOSE: 2E trap handler
@ -149,92 +149,94 @@ new_serviceInRange:
#ifdef DBG #ifdef DBG
/* GDB thinks the function starts here and /* GDB thinks the function starts here and
wants a standard prolog, so let's give it */ wants a standard prolog, so let's give it */
pushl %ebp pushl %ebp
movl %esp,%ebp movl %esp,%ebp
popl %ebp popl %ebp
#endif #endif
/* Allocate room for argument list from kernel stack */ /* Allocate room for argument list from kernel stack */
movl %es:_KeServiceDescriptorTable + 12, %ecx movl %es:_KeServiceDescriptorTable + 12, %ecx
movb %es:(%ecx, %eax), %cl movb %es:(%ecx, %eax), %cl
movzx %cl, %ecx movzx %cl, %ecx
subl %ecx, %esp subl %ecx, %esp
/* Copy the arguments from the user stack to the kernel stack */ /* Copy the arguments from the user stack to the kernel stack */
movl %esp,%edi movl %esp,%edi
cld cld
rep movsb rep movsb
/* DS is now also kernel segment */ /* DS is now also kernel segment */
movw %bx, %ds movw %bx, %ds
/* Call system call hook */ /* Call system call hook */
pushl %eax pushl %eax
call _KiSystemCallHook call _KiSystemCallHook
popl %eax popl %eax
/* Make the system service call */ /* Make the system service call */
movl %es:_KeServiceDescriptorTable, %ecx movl %es:_KeServiceDescriptorTable, %ecx
movl %es:(%ecx, %eax, 4), %eax movl %es:(%ecx, %eax, 4), %eax
call *%eax call *%eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */ movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
#if CHECKED #if CHECKED
/* Bump Service Counter */ /* Bump Service Counter */
#endif #endif
jmp KeDeallocateStackAndReturnFromSystemCallWithHook jmp KeDeallocateStackAndReturnFromSystemCallWithHook
new_useShadowTable: new_useShadowTable:
subl $0x1000, %eax subl $0x1000, %eax
/* Check to see if EAX is valid/inrange */ /* Check to see if EAX is valid/inrange */
cmpl %es:_KeServiceDescriptorTableShadow + 24, %eax cmpl %es:_KeServiceDescriptorTableShadow + 24, %eax
jbe new_shadowServiceInRange jbe new_shadowServiceInRange
movl $STATUS_INVALID_SYSTEM_SERVICE, %eax movl $STATUS_INVALID_SYSTEM_SERVICE, %eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */ movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
jmp KeReturnFromSystemCall jmp KeReturnFromSystemCall
new_shadowServiceInRange: new_shadowServiceInRange:
#ifdef DBG #ifdef DBG
/* GDB thinks the function starts here and /*
wants a standard prolog, so let's give it */ * GDB thinks the function starts here and
pushl %ebp * wants a standard prolog, so let's give it
movl %esp,%ebp */
popl %ebp pushl %ebp
movl %esp,%ebp
popl %ebp
#endif #endif
/* Allocate room for argument list from kernel stack */ /* Allocate room for argument list from kernel stack */
movl %es:_KeServiceDescriptorTableShadow + 28, %ecx movl %es:_KeServiceDescriptorTableShadow + 28, %ecx
movb %es:(%ecx, %eax), %cl movb %es:(%ecx, %eax), %cl
movzx %cl, %ecx movzx %cl, %ecx
subl %ecx, %esp subl %ecx, %esp
/* Copy the arguments from the user stack to the kernel stack */ /* Copy the arguments from the user stack to the kernel stack */
movl %esp,%edi movl %esp,%edi
cld cld
rep movsb rep movsb
/* DS is now also kernel segment */ /* DS is now also kernel segment */
movw %bx,%ds movw %bx,%ds
/* Call system call hook */ /* Call system call hook */
// pushl %eax // pushl %eax
// call _KiSystemCallHook // call _KiSystemCallHook
// popl %eax // popl %eax
/* Call service check routine */ /* Call service check routine */
pushl %eax pushl %eax
call _KiServiceCheck call _KiServiceCheck
popl %eax popl %eax
/* Make the system service call */ /* Make the system service call */
movl %es:_KeServiceDescriptorTableShadow + 16, %ecx movl %es:_KeServiceDescriptorTableShadow + 16, %ecx
movl %es:(%ecx, %eax, 4), %eax movl %es:(%ecx, %eax, 4), %eax
call *%eax call *%eax
movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */ movl %eax, KTRAP_FRAME_EAX(%ebp) /* save our return value in PKTRAP_FRAME->Eax */
#if CHECKED #if CHECKED
/* Bump Service Counter */ /* Bump Service Counter */
@ -242,59 +244,59 @@ new_shadowServiceInRange:
KeDeallocateStackAndReturnFromSystemCallWithHook: KeDeallocateStackAndReturnFromSystemCallWithHook:
/* Deallocate the kernel stack frame */ /* Deallocate the kernel stack frame */
movl %ebp,%esp movl %ebp,%esp
KeReturnFromSystemCallWithHook: KeReturnFromSystemCallWithHook:
/* Call the post system call hook and deliver any pending APCs */ /* Call the post system call hook and deliver any pending APCs */
pushl %esp pushl %esp
call _KiAfterSystemCallHook call _KiAfterSystemCallHook
addl $4,%esp addl $4,%esp
KeReturnFromSystemCall: KeReturnFromSystemCall:
/* Restore the user context */ /* Restore the user context */
/* Get a pointer to the current thread */ /* Get a pointer to the current thread */
movl %fs:0x124, %esi movl %fs:0x124, %esi
/* Restore the old trap frame pointer */ /* Restore the old trap frame pointer */
movl KTRAP_FRAME_EDX(%esp), %ebx movl KTRAP_FRAME_EDX(%esp), %ebx
movl %ebx, KTHREAD_TRAP_FRAME(%esi) movl %ebx, KTHREAD_TRAP_FRAME(%esi)
KiRosTrapReturn: KiRosTrapReturn:
#if 0 #if 0
mov KTRAP_FRAME_RESERVED1(%ebp), %ax mov KTRAP_FRAME_RESERVED1(%ebp), %ax
cmp %ax, SSIDX_NTCONTINUE cmp %ax, SSIDX_NTCONTINUE
jnz KeNoEpilogPrint jnz KeNoEpilogPrint
movl KTRAP_FRAME_ESP(%ebp), %ecx movl KTRAP_FRAME_ESP(%ebp), %ecx
movl KTRAP_FRAME_EBP(%ebp), %edx movl KTRAP_FRAME_EBP(%ebp), %edx
call @KeRosPrintEspEbp@8 call @KeRosPrintEspEbp@8
KeNoEpilogPrint: KeNoEpilogPrint:
#endif #endif
/* Skip debug information and unsaved registers */ /* Skip debug information and unsaved registers */
addl $0x30, %esp addl $0x30, %esp
popl %gs popl %gs
popl %es popl %es
popl %ds popl %ds
popl %edx popl %edx
popl %ecx popl %ecx
popl %eax popl %eax
/* Restore the old previous mode */ /* Restore the old previous mode */
popl %ebx popl %ebx
movb %bl, %ss:KTHREAD_PREVIOUS_MODE(%esi) movb %bl, %ss:KTHREAD_PREVIOUS_MODE(%esi)
/* Restore the old exception handler list */ /* Restore the old exception handler list */
popl %ebx popl %ebx
movl %ebx, %fs:KPCR_EXCEPTION_LIST movl %ebx, %fs:KPCR_EXCEPTION_LIST
popl %fs popl %fs
popl %edi popl %edi
popl %esi popl %esi
popl %ebx popl %ebx
popl %ebp popl %ebp
addl $0x4, %esp /* Ignore error code */ addl $0x4, %esp /* Ignore error code */
iret iret
@ -305,18 +307,18 @@ KeNoEpilogPrint:
@KeRosTrapReturn@8: @KeRosTrapReturn@8:
/* point %esp to the trap frame to restore */ /* point %esp to the trap frame to restore */
movl %ecx, %esp movl %ecx, %esp
movl %esp, %ebp movl %esp, %ebp
/* Call the post system call hook and deliver any pending APCs */ /* Call the post system call hook and deliver any pending APCs */
pushl %esp pushl %esp
call _KiAfterSystemCallHook call _KiAfterSystemCallHook
addl $4,%esp addl $4,%esp
/* Restore the user context */ /* Restore the user context */
/* Get a pointer to the current thread */ /* Get a pointer to the current thread */
movl %fs:0x124, %esi movl %fs:0x124, %esi
/* Restore the old trap frame pointer */ /* 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 movl %ebx, %fs:KPCR_CURRENT_THREAD
/* /*
* Set the current LDT * Set the current LDT
*/ */
xorl %eax, %eax xorl %eax, %eax
movl KTHREAD_APCSTATE_PROCESS(%ebx), %edi movl KTHREAD_APCSTATE_PROCESS(%ebx), %edi
testw $0xFFFF, KPROCESS_LDT_DESCRIPTOR0(%edi) testw $0xFFFF, KPROCESS_LDT_DESCRIPTOR0(%edi)
jz .L4 jz .L4
@ -106,7 +106,7 @@ _Ki386ContextSwitch:
* Load up the iomap offset for this thread in * Load up the iomap offset for this thread in
* preparation for setting it below. * preparation for setting it below.
*/ */
movl KPROCESS_IOPM_OFFSET(%edi), %eax movl KPROCESS_IOPM_OFFSET(%edi), %eax
/* /*
* FIXME: Save debugging state. * FIXME: Save debugging state.
@ -130,10 +130,10 @@ _Ki386ContextSwitch:
*/ */
movl %fs:KPCR_TSS, %esi movl %fs:KPCR_TSS, %esi
/* /*
* Set current IOPM offset in the TSS * Set current IOPM offset in the TSS
*/ */
movw %ax, KTSS_IOMAPBASE(%esi) movw %ax, KTSS_IOMAPBASE(%esi)
movl KTHREAD_INITIAL_STACK(%ebx), %eax movl KTHREAD_INITIAL_STACK(%ebx), %eax
movl %eax, KTSS_ESP0(%esi) movl %eax, KTSS_ESP0(%esi)
@ -173,5 +173,5 @@ _Ki386ContextSwitch:
popl %esi popl %esi
popl %ebx popl %ebx
popl %ebp popl %ebp
ret ret

View file

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