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);
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 & 0x40)
HalDisplayString ("NMI: Channel Check / IOCHK\n");
HalDisplayString ("\n*** The system has halted ***\n"); ucStatus = READ_PORT_UCHAR((PUCHAR) 0x61);
KeEnterKernelDebugger ();
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 & 0x40)
HalDisplayString ("NMI: Channel Check / IOCHK\n");
HalDisplayString ("\n*** The system has halted ***\n");
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
@ -26,7 +26,7 @@
*/ */
/* INCLUDES ******************************************************************/ /* INCLUDES ******************************************************************/
#include <ddk/status.h> #include <ddk/status.h>
#include <internal/i386/segment.h> #include <internal/i386/segment.h>
#include <internal/ps.h> #include <internal/ps.h>
@ -35,16 +35,16 @@
/* Values for contextflags */ /* Values for contextflags */
#define CONTEXT_i386 0x10000 #define CONTEXT_i386 0x10000
#ifndef CONTEXT_CONTROL #ifndef CONTEXT_CONTROL
#define CONTEXT_CONTROL (CONTEXT_i386 | 1) #define CONTEXT_CONTROL (CONTEXT_i386 | 1)
#endif #endif
#ifndef CONTEXT_INTEGER #ifndef CONTEXT_INTEGER
#define CONTEXT_INTEGER (CONTEXT_i386 | 2) #define CONTEXT_INTEGER (CONTEXT_i386 | 2)
#endif #endif
#ifndef CONTEXT_SEGMENTS #ifndef CONTEXT_SEGMENTS
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 4) #define CONTEXT_SEGMENTS (CONTEXT_i386 | 4)
#endif #endif
#ifndef CONTEXT_FLOATING_POINT #ifndef CONTEXT_FLOATING_POINT
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8) #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8)
#endif #endif
#ifndef CONTEXT_DEBUG_REGISTERS #ifndef CONTEXT_DEBUG_REGISTERS
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x10) #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x10)
@ -52,7 +52,7 @@
#ifndef CONTEXT_FULL #ifndef CONTEXT_FULL
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#endif #endif
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
/* /*
@ -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
@ -118,7 +118,7 @@ _PsBeginThreadWithContextInternal:
* Load the context flags. * Load the context flags.
*/ */
popl %ebx popl %ebx
/* /*
* Load the debugging registers * Load the debugging registers
*/ */
@ -139,8 +139,8 @@ _PsBeginThreadWithContextInternal:
jmp .L3 jmp .L3
.L1: .L1:
addl $24, %esp addl $24, %esp
.L3: .L3:
/* /*
* Load the floating point registers * Load the floating point registers
*/ */
@ -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

@ -27,25 +27,25 @@
/* dwelch: Altered for ReactOS to output the files to port 0xe9 for processing /* dwelch: Altered for ReactOS to output the files to port 0xe9 for processing
by bochs. */ by bochs. */
.globl _mcount
_mcount:
/* Save the caller-clobbered registers. */
pushl %eax
pushl %ecx
pushl %edx
movw $0xe9, %dx .globl _mcount
movl 4(%ebp), %eax _mcount:
outl %eax, %dx /* Save the caller-clobbered registers. */
movl 12(%esp), %eax pushl %eax
outl %eax, %dx pushl %ecx
pushl %edx
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 /* 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

@ -15,13 +15,13 @@
#define AP_MAGIC (0x12481020) #define AP_MAGIC (0x12481020)
#endif /* MP */ #endif /* MP */
.globl _NtProcessStartup .globl _NtProcessStartup
.globl _start .globl _start
.globl _init_stack .globl _init_stack
.globl _init_stack_top .globl _init_stack_top
.globl _trap_stack .globl _trap_stack
.globl _trap_stack_top .globl _trap_stack_top
.globl _unmap_me .globl _unmap_me
.globl _unmap_me2 .globl _unmap_me2
.globl _unmap_me3 .globl _unmap_me3
@ -29,7 +29,7 @@
.globl _pagetable_start .globl _pagetable_start
.globl _pagetable_end .globl _pagetable_end
.globl _pae_pagedirtable .globl _pae_pagedirtable
/* /*
* This is called by the realmode loader, with protected mode * This is called by the realmode loader, with protected mode
* enabled, paging disabled and the segment registers pointing * enabled, paging disabled and the segment registers pointing
@ -47,7 +47,7 @@ _start:
/* Align 32 bits boundary */ /* Align 32 bits boundary */
.align 4 .align 4
/* Multiboot header */ /* Multiboot header */
multiboot_header: multiboot_header:
/* magic */ /* magic */
@ -67,11 +67,11 @@ multiboot_header:
/* entry_addr */ /* entry_addr */
.long (0x200000 + _start - KERNEL_BASE) .long (0x200000 + _start - KERNEL_BASE)
_multiboot_entry: _multiboot_entry:
/* /*
* This must be PIC because we haven't set up paging yet * This must be PIC because we haven't set up paging yet
*/ */
/* /*
* Gcc expects this at all times * Gcc expects this at all times
*/ */
@ -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 */
@ -143,16 +143,16 @@ _multiboot_entry:
addl $4, %edi addl $4, %edi
cmpl $6144, %edi cmpl $6144, %edi
jl .l4 jl .l4
#ifdef MP #ifdef MP
/* /*
* Initialize the page table that maps the APIC register address space * Initialize the page table that maps the APIC register address space
*/ */
/* /*
* FIXME: APIC register address space can be non-standard so do the * FIXME: APIC register address space can be non-standard so do the
* mapping later * mapping later
*/ */
movl $V2P(apic_pagetable), %esi movl $V2P(apic_pagetable), %esi
movl $0, %edi movl $0, %edi
@ -178,7 +178,7 @@ _multiboot_entry:
movl $0xa0003, %eax movl $0xa0003, %eax
movl $0x20, %ecx movl $0x20, %ecx
movl $0xE80, %edi movl $0xE80, %edi
.l9: .l9:
movl %eax, (%esi, %edi) movl %eax, (%esi, %edi)
add $4, %edi add $4, %edi
add $0x1000, %eax add $0x1000, %eax
@ -192,7 +192,7 @@ _multiboot_entry:
/* /*
* Set up the PDBR * Set up the PDBR
*/ */
movl $(V2P(startup_pagedirectory)), %eax movl $(V2P(startup_pagedirectory)), %eax
movl %eax, %cr3 movl %eax, %cr3
@ -205,16 +205,16 @@ _multiboot_entry:
/* /*
* Do an absolute jump because we now want to execute above 0xc0000000 * Do an absolute jump because we now want to execute above 0xc0000000
*/ */
movl $.l2, %eax movl $.l2, %eax
jmp *%eax jmp *%eax
.l2: .l2:
/* /*
* Load the GDTR and IDTR with new tables located above * Load the GDTR and IDTR with new tables located above
* 0xc0000000 * 0xc0000000
*/ */
/* FIXME: Application processors should have their own GDT/IDT */ /* FIXME: Application processors should have their own GDT/IDT */
lgdt _KiGdtDescriptor lgdt _KiGdtDescriptor
lidt _KiIdtDescriptor lidt _KiIdtDescriptor
@ -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
@ -265,7 +265,7 @@ _multiboot_entry:
.l8: .l8:
jmp .l8 jmp .l8
.m2: .m2:
#endif /* MP */ #endif /* MP */
@ -297,7 +297,7 @@ _multiboot_entry:
pushl $KERNEL_CS pushl $KERNEL_CS
pushl $__main pushl $__main
lret lret
/* /*
* Catch illegal returns from main, try bug checking the system, * Catch illegal returns from main, try bug checking the system,
* if that fails then loop forever. * if that fails then loop forever.
@ -311,7 +311,7 @@ _multiboot_entry:
.l6: .l6:
jmp .l6 jmp .l6
/* /*
* This needs to be page aligned so put it at the beginning of the bss * This needs to be page aligned so put it at the beginning of the bss
* segment * segment
@ -325,7 +325,7 @@ lowmem_pagetable:
.fill 4096, 1, 0 .fill 4096, 1, 0
kernel_pagetable: kernel_pagetable:
.fill 2*4096, 1, 0 .fill 2*4096, 1, 0
kernelmap_pagetable: kernelmap_pagetable:
.fill 4096, 1, 0 .fill 4096, 1, 0
@ -333,25 +333,25 @@ _pae_pagedirtable:
.fill 4096, 1, 0 .fill 4096, 1, 0
#ifdef MP #ifdef MP
apic_pagetable: apic_pagetable:
.fill 4096, 1, 0 .fill 4096, 1, 0
#endif /* MP */ #endif /* MP */
kpcr_pagetable: kpcr_pagetable:
.fill 4096, 1, 0 .fill 4096, 1, 0
_pagetable_end: _pagetable_end:
_unmap_me: _unmap_me:
.fill 4096, 1, 0 .fill 4096, 1, 0
_init_stack: _init_stack:
.fill 3*4096, 1, 0 .fill 3*4096, 1, 0
_init_stack_top: _init_stack_top:
_unmap_me2: _unmap_me2:
.fill 4096, 1, 0 .fill 4096, 1, 0
_trap_stack: _trap_stack:
.fill 3*4096, 1, 0 .fill 3*4096, 1, 0
_trap_stack_top: _trap_stack_top:
_unmap_me3: _unmap_me3:
.fill 4096, 1, 0 .fill 4096, 1, 0

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

@ -30,9 +30,9 @@
#include <internal/ps.h> #include <internal/ps.h>
#include <ntos/tss.h> #include <ntos/tss.h>
#include <internal/ntoskrnl.h> #include <internal/ntoskrnl.h>
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
.globl _Ki386ContextSwitch .globl _Ki386ContextSwitch
_Ki386ContextSwitch: _Ki386ContextSwitch:
/* /*
@ -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.
@ -120,7 +120,7 @@ _Ki386ContextSwitch:
* Switch stacks * Switch stacks
*/ */
movl 12(%ebp), %ebx movl 12(%ebp), %ebx
movl %esp, KTHREAD_KERNEL_STACK(%ebx) movl %esp, KTHREAD_KERNEL_STACK(%ebx)
movl 8(%ebp), %ebx movl 8(%ebp), %ebx
movl KTHREAD_KERNEL_STACK(%ebx), %esp movl KTHREAD_KERNEL_STACK(%ebx), %esp
movl KTHREAD_STACK_LIMIT(%ebx), %edi movl KTHREAD_STACK_LIMIT(%ebx), %edi
@ -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)
@ -157,21 +157,21 @@ _Ki386ContextSwitch:
* Exit the critical section * Exit the critical section
*/ */
sti sti
push $_PiThreadLock push $_PiThreadLock
call _KeReleaseSpinLockFromDpcLevel@4 call _KeReleaseSpinLockFromDpcLevel@4
cmpl $0, _PiNrThreadsAwaitingReaping cmpl $0, _PiNrThreadsAwaitingReaping
je .L3 je .L3
call _PiWakeupReaperThread@0 call _PiWakeupReaperThread@0
.L3: .L3:
/* /*
* Restore the saved register and exit * Restore the saved register and exit
*/ */
popl %edi popl %edi
popl %esi popl %esi
popl %ebx popl %ebx
popl %ebp popl %ebp
ret ret

View file

@ -28,29 +28,29 @@
#include <ntos/tss.h> #include <ntos/tss.h>
#include <internal/trap.h> #include <internal/trap.h>
#include <internal/ps.h> #include <internal/ps.h>
.globl _Ki386RetToV86Mode .globl _Ki386RetToV86Mode
.globl _KiV86Complete .globl _KiV86Complete
/* /*
* VOID Ki386RetToV86Mode(KV86M_REGISTERS* InRegs, * VOID Ki386RetToV86Mode(KV86M_REGISTERS* InRegs,
* KV86M_REGISTERS* OutRegs); * KV86M_REGISTERS* OutRegs);
* *
* Starts in v86 mode with the registers set to the * Starts in v86 mode with the registers set to the
* specified values. * specified values.
*/ */
_Ki386RetToV86Mode: _Ki386RetToV86Mode:
/* /*
* Setup a stack frame * Setup a stack frame
*/ */
pushl %ebp pushl %ebp
movl %esp, %ebp movl %esp, %ebp
/* /*
* Save registers * Save registers
*/ */
pusha pusha
/* /*
* Get a pointer to IN_REGS * Get a pointer to IN_REGS
*/ */
@ -60,7 +60,7 @@ _Ki386RetToV86Mode:
* Save ebp * Save ebp
*/ */
pushl %ebp pushl %ebp
/* /*
* Save a pointer to IN_REGS which the v86m exception handler will * Save a pointer to IN_REGS which the v86m exception handler will
* use to handle exceptions * use to handle exceptions
@ -71,7 +71,7 @@ _Ki386RetToV86Mode:
* Since we are going to fiddle with the stack pointer this must be * Since we are going to fiddle with the stack pointer this must be
* a critical section for this processor * a critical section for this processor
*/ */
/* /*
* Save the old initial stack * Save the old initial stack
*/ */
@ -83,15 +83,15 @@ _Ki386RetToV86Mode:
* We also need to set the stack in the kthread structure * We also need to set the stack in the kthread structure
*/ */
movl %esp, KTHREAD_INITIAL_STACK(%esi) movl %esp, KTHREAD_INITIAL_STACK(%esi)
/* /*
* The stack used for handling exceptions from v86 mode in this thread * The stack used for handling exceptions from v86 mode in this thread
* 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)
/* /*
* Create the stack frame for an iret to v86 mode * Create the stack frame for an iret to v86 mode
*/ */
@ -120,7 +120,7 @@ _Ki386RetToV86Mode:
* Go to v86 mode * Go to v86 mode
*/ */
iret iret
/* /*
* Handle the completion of a vm86 routine. We are called from * Handle the completion of a vm86 routine. We are called from
* an exception handler with the registers at the point of the * an exception handler with the registers at the point of the
@ -129,7 +129,7 @@ _Ki386RetToV86Mode:
_KiV86Complete: _KiV86Complete:
/* Restore the original ebp */ /* Restore the original ebp */
movl TF_ORIG_EBP(%esp), %ebp movl TF_ORIG_EBP(%esp), %ebp
/* Get a pointer to the OUT_REGS structure */ /* Get a pointer to the OUT_REGS structure */
movl 12(%ebp), %ebx movl 12(%ebp), %ebx
@ -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)
/* /*
@ -195,21 +195,15 @@ _KiV86Complete:
/* Exit the critical section */ /* Exit the critical section */
sti sti
/* Ignore IN_REGS pointer */ /* Ignore IN_REGS pointer */
addl $4, %esp addl $4, %esp
/* Ignore ebp restored above */ /* Ignore ebp restored above */
addl $4, %esp addl $4, %esp
/* Return to caller */ /* Return to caller */
popa popa
movl %ebp, %esp movl %ebp, %esp
popl %ebp popl %ebp
ret ret