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;
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");
UCHAR ucStatus;
HalDisplayString ("\n*** The system has halted ***\n");
KeEnterKernelDebugger ();
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");
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
@ -26,7 +26,7 @@
*/
/* INCLUDES ******************************************************************/
#include <ddk/status.h>
#include <internal/i386/segment.h>
#include <internal/ps.h>
@ -35,16 +35,16 @@
/* Values for contextflags */
#define CONTEXT_i386 0x10000
#ifndef CONTEXT_CONTROL
#define CONTEXT_CONTROL (CONTEXT_i386 | 1)
#define CONTEXT_CONTROL (CONTEXT_i386 | 1)
#endif
#ifndef CONTEXT_INTEGER
#define CONTEXT_INTEGER (CONTEXT_i386 | 2)
#define CONTEXT_INTEGER (CONTEXT_i386 | 2)
#endif
#ifndef CONTEXT_SEGMENTS
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 4)
#define CONTEXT_SEGMENTS (CONTEXT_i386 | 4)
#endif
#ifndef CONTEXT_FLOATING_POINT
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8)
#define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 8)
#endif
#ifndef CONTEXT_DEBUG_REGISTERS
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x10)
@ -52,7 +52,7 @@
#ifndef CONTEXT_FULL
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#endif
/* FUNCTIONS *****************************************************************/
/*
@ -94,7 +94,7 @@ _PsBeginThread:
*/
pushl $0
call _KeBugCheck@4
addl $4, %esp
addl $4, %esp
/*
* And if that fails then loop
@ -118,7 +118,7 @@ _PsBeginThreadWithContextInternal:
* Load the context flags.
*/
popl %ebx
/*
* Load the debugging registers
*/
@ -139,8 +139,8 @@ _PsBeginThreadWithContextInternal:
jmp .L3
.L1:
addl $24, %esp
.L3:
.L3:
/*
* Load the floating point registers
*/
@ -156,4 +156,3 @@ _PsBeginThreadWithContextInternal:
/* Load the rest of the thread's user mode context. */
movl $0, %eax
jmp KeReturnFromSystemCallWithHook

View file

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

View file

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

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

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

View file

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