mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Share compiler-generated asm exports between ntdll and ntoskrnl (stuff like aullshr, alldiv, etc
svn path=/trunk/; revision=14785
This commit is contained in:
parent
1d0c612395
commit
a1151864cc
23 changed files with 21 additions and 816 deletions
|
@ -51,15 +51,6 @@ LDR_OBJECTS = \
|
|||
ldr/utils.o
|
||||
|
||||
RTL_I386_OBJECTS = \
|
||||
rtl/i386/alldiv.o \
|
||||
rtl/i386/allmul.o \
|
||||
rtl/i386/allrem.o \
|
||||
rtl/i386/allshl.o \
|
||||
rtl/i386/allshr.o \
|
||||
rtl/i386/aulldiv.o \
|
||||
rtl/i386/aullrem.o \
|
||||
rtl/i386/aullshr.o \
|
||||
rtl/i386/float.o \
|
||||
rtl/i386/ftol.o
|
||||
|
||||
RTL_OBJECTS = \
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <string.h>
|
||||
#include <debug.h>
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
|
@ -41,12 +42,14 @@ KiUserApcDispatcher(PIO_APC_ROUTINE ApcRoutine,
|
|||
/*
|
||||
* Call the APC
|
||||
*/
|
||||
//DPRINT1("ITS ME\n");
|
||||
ApcRoutine(ApcContext,
|
||||
Iosb,
|
||||
Reserved);
|
||||
/*
|
||||
* Switch back to the interrupted context
|
||||
*/
|
||||
//DPRINT1("switch back\n");
|
||||
NtContinue(Context, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Math support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/alldiv.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
*/
|
||||
|
||||
/*
|
||||
* long long
|
||||
* __alldiv(long long Dividend, long long Divisor);
|
||||
*
|
||||
* Parameters:
|
||||
* [ESP+04h] - long long Dividend
|
||||
* [ESP+0Ch] - long long Divisor
|
||||
* Registers:
|
||||
* Unknown
|
||||
* Returns:
|
||||
* EDX:EAX - long long quotient (Dividend/Divisor)
|
||||
* Notes:
|
||||
* Routine removes the arguments from the stack.
|
||||
*/
|
||||
.globl __alldiv
|
||||
__alldiv:
|
||||
call ___divdi3
|
||||
ret $0x10
|
||||
|
||||
/*
|
||||
__alldiv:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
pushl %eax
|
||||
pushl %eax
|
||||
movl 20(%ebp), %eax
|
||||
pushl %eax
|
||||
movl 16(%ebp), %eax
|
||||
pushl %eax
|
||||
movl 12(%ebp), %eax
|
||||
pushl %eax
|
||||
movl 8(%ebp), %eax
|
||||
pushl %eax
|
||||
call ___divdi3
|
||||
addl $16, %esp
|
||||
movl %ebp, %esp
|
||||
popl %ebp
|
||||
ret
|
||||
*/
|
||||
|
||||
/* EOF */
|
|
@ -1,54 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Math support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/allmul.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
*/
|
||||
|
||||
/*
|
||||
* long long
|
||||
* __allmul(long long Multiplier, long long Multiplicand);
|
||||
*
|
||||
* Parameters:
|
||||
* [ESP+04h] - long long Multiplier
|
||||
* [ESP+0Ch] - long long Multiplicand
|
||||
* Registers:
|
||||
* Unknown
|
||||
* Returns:
|
||||
* EDX:EAX - long long product (Multiplier*Multiplicand)
|
||||
* Notes:
|
||||
* Routine removes the arguments from the stack.
|
||||
*/
|
||||
.globl __allmul
|
||||
__allmul:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
pushl %edi
|
||||
pushl %esi
|
||||
pushl %ebx
|
||||
subl $12, %esp
|
||||
movl 16(%ebp), %ebx
|
||||
movl 8(%ebp), %eax
|
||||
mull %ebx
|
||||
movl 20(%ebp), %ecx
|
||||
movl %eax, -24(%ebp)
|
||||
movl 8(%ebp), %eax
|
||||
movl %edx, %esi
|
||||
imull %ecx, %eax
|
||||
addl %eax, %esi
|
||||
movl 12(%ebp), %eax
|
||||
imull %eax, %ebx
|
||||
leal (%ebx,%esi), %eax
|
||||
movl %eax, -20(%ebp)
|
||||
movl -24(%ebp), %eax
|
||||
movl -20(%ebp), %edx
|
||||
addl $12, %esp
|
||||
popl %ebx
|
||||
popl %esi
|
||||
popl %edi
|
||||
popl %ebp
|
||||
ret $0x10
|
||||
|
||||
/* EOF */
|
|
@ -1,31 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Math support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/math.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
* NOTES: This file is shared with ntoskrnl/rtl/i386/math.s.
|
||||
* Please keep the files synchronized!
|
||||
*/
|
||||
|
||||
/*
|
||||
* long long
|
||||
* __allrem(long long Dividend, long long Divisor);
|
||||
*
|
||||
* Parameters:
|
||||
* [ESP+04h] - long long Dividend
|
||||
* [ESP+0Ch] - long long Divisor
|
||||
* Registers:
|
||||
* Unknown
|
||||
* Returns:
|
||||
* EDX:EAX - long long remainder (Dividend/Divisor)
|
||||
* Notes:
|
||||
* Routine removes the arguments from the stack.
|
||||
*/
|
||||
.globl __allrem
|
||||
__allrem:
|
||||
call ___moddi3
|
||||
ret $16
|
||||
|
||||
/* EOF */
|
|
@ -1,33 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Math support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/allshl.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
*/
|
||||
|
||||
/*
|
||||
* long long
|
||||
* __allshl(long long Value, unsigned char Shift);
|
||||
*
|
||||
* Parameters:
|
||||
* EDX:EAX - signed long long value to be shifted left
|
||||
* CL - number of bits to shift by
|
||||
* Registers:
|
||||
* Destroys CL
|
||||
* Returns:
|
||||
* EDX:EAX - shifted value
|
||||
*/
|
||||
.globl __allshl
|
||||
__allshl:
|
||||
shldl %cl, %eax, %edx
|
||||
sall %cl, %eax
|
||||
andl $32, %ecx
|
||||
je L1
|
||||
movl %eax, %edx
|
||||
xorl %eax, %eax
|
||||
L1:
|
||||
ret
|
||||
|
||||
/* EOF */
|
|
@ -1,33 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Math support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/allshr.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
*/
|
||||
|
||||
/*
|
||||
* long long
|
||||
* __allshr(long long Value, unsigned char Shift);
|
||||
*
|
||||
* Parameters:
|
||||
* EDX:EAX - signed long long value to be shifted right
|
||||
* CL - number of bits to shift by
|
||||
* Registers:
|
||||
* Destroys CL
|
||||
* Returns:
|
||||
* EDX:EAX - shifted value
|
||||
*/
|
||||
.globl __allshr
|
||||
__allshr:
|
||||
shrdl %cl, %edx, %eax
|
||||
sarl %cl, %edx
|
||||
andl $32, %ecx
|
||||
je L1
|
||||
movl %edx, %eax
|
||||
sarl $31, %edx
|
||||
L1:
|
||||
ret
|
||||
|
||||
/* EOF */
|
|
@ -1,29 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Math support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/aulldiv.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
*/
|
||||
|
||||
/*
|
||||
* unsigned long long
|
||||
* __aulldiv(unsigned long long Dividend, unsigned long long Divisor);
|
||||
*
|
||||
* Parameters:
|
||||
* [ESP+04h] - unsigned long long Dividend
|
||||
* [ESP+0Ch] - unsigned long long Divisor
|
||||
* Registers:
|
||||
* Unknown
|
||||
* Returns:
|
||||
* EDX:EAX - unsigned long long quotient (Dividend/Divisor)
|
||||
* Notes:
|
||||
* Routine removes the arguments from the stack.
|
||||
*/
|
||||
.globl __aulldiv
|
||||
__aulldiv:
|
||||
call ___udivdi3
|
||||
ret $16
|
||||
|
||||
/* EOF */
|
|
@ -1,29 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Math support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/aullrem.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
*/
|
||||
|
||||
/*
|
||||
* unsigned long long
|
||||
* __aullrem(unsigned long long Dividend, unsigned long long Divisor);
|
||||
*
|
||||
* Parameters:
|
||||
* [ESP+04h] - unsigned long long Dividend
|
||||
* [ESP+0Ch] - unsigned long long Divisor
|
||||
* Registers:
|
||||
* Unknown
|
||||
* Returns:
|
||||
* EDX:EAX - unsigned long long remainder (Dividend%Divisor)
|
||||
* Notes:
|
||||
* Routine removes the arguments from the stack.
|
||||
*/
|
||||
.globl __aullrem
|
||||
__aullrem:
|
||||
call ___umoddi3
|
||||
ret $16
|
||||
|
||||
/* EOF */
|
|
@ -1,32 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: Math support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/aullshr.s
|
||||
* PROGRAMER: Eric Kohl (ekohl@rz-online.de)
|
||||
*/
|
||||
|
||||
/*
|
||||
* unsigned long long
|
||||
* __aullshr(unsigned long long Value, unsigned char Shift);
|
||||
*
|
||||
* Parameters:
|
||||
* EDX:EAX - unsigned long long value to be shifted right
|
||||
* CL - number of bits to shift by
|
||||
* Registers:
|
||||
* Destroys CL
|
||||
* Returns:
|
||||
* EDX:EAX - shifted value
|
||||
*/
|
||||
.globl __aullshr
|
||||
__aullshr:
|
||||
shrdl %cl, %edx, %eax
|
||||
shrl %cl, %edx
|
||||
andl $32, %ecx
|
||||
je L1
|
||||
movl %edx, %eax
|
||||
L1:
|
||||
ret
|
||||
|
||||
/* EOF */
|
|
@ -1,446 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: User-mode exception support for IA-32
|
||||
* FILE: lib/ntdll/rtl/i386/exception.c
|
||||
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <windows.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
/* Implemented in except.s */
|
||||
|
||||
VOID
|
||||
RtlpCaptureContext(PCONTEXT pContext);
|
||||
|
||||
/* Macros that will help streamline the SEH implementations for
|
||||
kernel mode and user mode */
|
||||
|
||||
#define SehpGetStackLimits(StackBase, StackLimit) \
|
||||
{ \
|
||||
(*(StackBase)) = NtCurrentTeb()->Tib->StackBase; \
|
||||
(*(StackLimit)) = NtCurrentTeb()->Tib->StackLimit; \
|
||||
}
|
||||
|
||||
#define SehpGetExceptionList() \
|
||||
(PEXCEPTION_REGISTRATION)(NtCurrentTeb()->Tib.ExceptionList)
|
||||
|
||||
#define SehpSetExceptionList(NewExceptionList) \
|
||||
NtCurrentTeb()->Tib.ExceptionList = (PVOID)(NewExceptionList)
|
||||
|
||||
#define SehpCaptureContext(Context) \
|
||||
{ \
|
||||
RtlpCaptureContext(Context); \
|
||||
}
|
||||
|
||||
#define SehpContinue(Context, TestAlert) \
|
||||
NtContinue(Context, TestAlert)
|
||||
|
||||
/*** Code below this line is shared with ntoskrnl/rtl/i386/exception.c - please keep in sync ***/
|
||||
|
||||
VOID STDCALL
|
||||
AsmDebug(ULONG Value)
|
||||
{
|
||||
DbgPrint("Value 0x%.08x\n", Value);
|
||||
}
|
||||
|
||||
|
||||
/* Declare a few prototypes for the functions in except.s */
|
||||
|
||||
EXCEPTION_DISPOSITION
|
||||
RtlpExecuteHandlerForException(
|
||||
PEXCEPTION_RECORD ExceptionRecord,
|
||||
PEXCEPTION_REGISTRATION RegistrationFrame,
|
||||
PCONTEXT Context,
|
||||
PVOID DispatcherContext,
|
||||
PEXCEPTION_HANDLER ExceptionHandler);
|
||||
|
||||
EXCEPTION_DISPOSITION
|
||||
RtlpExecuteHandlerForUnwind(
|
||||
PEXCEPTION_RECORD ExceptionRecord,
|
||||
PEXCEPTION_REGISTRATION RegistrationFrame,
|
||||
PCONTEXT Context,
|
||||
PVOID DispatcherContext,
|
||||
PEXCEPTION_HANDLER ExceptionHandler);
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
||||
VOID RtlpDumpExceptionRegistrations(VOID)
|
||||
{
|
||||
PEXCEPTION_REGISTRATION Current;
|
||||
|
||||
DbgPrint("Dumping exception registrations:\n");
|
||||
|
||||
Current = SehpGetExceptionList();
|
||||
|
||||
if ((ULONG_PTR)Current != -1)
|
||||
{
|
||||
while ((ULONG_PTR)Current != -1)
|
||||
{
|
||||
DbgPrint(" (0x%08X) HANDLER (0x%08X)\n", Current, Current->handler);
|
||||
Current = Current->prev;
|
||||
}
|
||||
DbgPrint(" End-Of-List\n");
|
||||
} else {
|
||||
DbgPrint(" No exception registrations exists.\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* NDEBUG */
|
||||
|
||||
ULONG
|
||||
RtlpDispatchException(IN PEXCEPTION_RECORD ExceptionRecord,
|
||||
IN PCONTEXT Context)
|
||||
{
|
||||
PEXCEPTION_REGISTRATION RegistrationFrame;
|
||||
DWORD DispatcherContext;
|
||||
DWORD ReturnValue;
|
||||
|
||||
DPRINT("RtlpDispatchException()\n");
|
||||
|
||||
#ifndef NDEBUG
|
||||
RtlpDumpExceptionRegistrations();
|
||||
#endif /* NDEBUG */
|
||||
|
||||
RegistrationFrame = SehpGetExceptionList();
|
||||
|
||||
DPRINT("RegistrationFrame is 0x%X\n", RegistrationFrame);
|
||||
|
||||
while ((ULONG_PTR)RegistrationFrame != -1)
|
||||
{
|
||||
EXCEPTION_RECORD ExceptionRecord2;
|
||||
DWORD Temp = 0;
|
||||
//PVOID RegistrationFrameEnd = (PVOID)RegistrationFrame + 8;
|
||||
|
||||
// Make sure the registration frame is located within the stack
|
||||
|
||||
DPRINT("Error checking\n");
|
||||
#if 0
|
||||
if (Teb->Tib.StackBase > RegistrationFrameEnd)
|
||||
{
|
||||
DPRINT("Teb->Tib.StackBase (0x%.08x) > RegistrationFrameEnd (0x%.08x)\n",
|
||||
Teb->Tib.StackBase, RegistrationFrameEnd);
|
||||
ExceptionRecord->ExceptionFlags |= EXCEPTION_STACK_INVALID;
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
// FIXME: Stack top, correct?
|
||||
if (Teb->Tib.StackLimit < RegistrationFrameEnd)
|
||||
{
|
||||
DPRINT("Teb->Tib.StackLimit (0x%.08x) > RegistrationFrameEnd (0x%.08x)\n",
|
||||
Teb->Tib.StackLimit, RegistrationFrameEnd);
|
||||
ExceptionRecord->ExceptionFlags |= EXCEPTION_STACK_INVALID;
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
|
||||
// Make sure stack is DWORD aligned
|
||||
if ((ULONG_PTR)RegistrationFrame & 3)
|
||||
{
|
||||
DPRINT("RegistrationFrameEnd (0x%.08x) is not DWORD aligned.\n",
|
||||
RegistrationFrameEnd);
|
||||
ExceptionRecord->ExceptionFlags |= EXCEPTION_STACK_INVALID;
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* FIXME: */
|
||||
if (someFlag)
|
||||
RtlpLogLastExceptionDisposition( hLog, retValue );
|
||||
#endif
|
||||
|
||||
DPRINT("Calling handler at 0x%X\n", RegistrationFrame->handler);
|
||||
DPRINT("ExceptionRecord 0x%X\n", ExceptionRecord);
|
||||
DPRINT("RegistrationFrame 0x%X\n", RegistrationFrame);
|
||||
DPRINT("Context 0x%X\n", Context);
|
||||
DPRINT("&DispatcherContext 0x%X\n", &DispatcherContext);
|
||||
|
||||
ReturnValue = RtlpExecuteHandlerForException(
|
||||
ExceptionRecord,
|
||||
RegistrationFrame,
|
||||
Context,
|
||||
&DispatcherContext,
|
||||
RegistrationFrame->handler);
|
||||
#ifdef DEBUG
|
||||
DPRINT("Exception handler said 0x%X\n", ReturnValue);
|
||||
DPRINT("RegistrationFrame == 0x%.08x\n", RegistrationFrame);
|
||||
{
|
||||
PULONG sp = (PULONG)((PVOID)RegistrationFrame - 0x08);
|
||||
DPRINT("StandardESP == 0x%.08x\n", sp[0]);
|
||||
DPRINT("Exception Pointers == 0x%.08x\n", sp[1]);
|
||||
DPRINT("PrevFrame == 0x%.08x\n", sp[2]);
|
||||
DPRINT("Handler == 0x%.08x\n", sp[3]);
|
||||
DPRINT("ScopeTable == 0x%.08x\n", sp[4]);
|
||||
DPRINT("TryLevel == 0x%.08x\n", sp[5]);
|
||||
DPRINT("EBP == 0x%.08x\n", sp[6]);
|
||||
}
|
||||
#endif
|
||||
if (RegistrationFrame == NULL)
|
||||
{
|
||||
ExceptionRecord->ExceptionFlags &= ~EXCEPTION_NESTED_CALL; // Turn off flag
|
||||
}
|
||||
|
||||
if (ReturnValue == ExceptionContinueExecution)
|
||||
{
|
||||
DPRINT("ReturnValue == ExceptionContinueExecution\n");
|
||||
if (ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
|
||||
{
|
||||
DPRINT("(ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE) == TRUE\n");
|
||||
|
||||
ExceptionRecord2.ExceptionRecord = ExceptionRecord;
|
||||
ExceptionRecord2.ExceptionCode = STATUS_NONCONTINUABLE_EXCEPTION;
|
||||
ExceptionRecord2.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||
ExceptionRecord2.NumberParameters = 0;
|
||||
RtlRaiseException(&ExceptionRecord2);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Copy the (possibly changed) context back to the trap frame and return */
|
||||
SehpContinue(Context, FALSE);
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
}
|
||||
else if (ReturnValue == ExceptionContinueSearch)
|
||||
{
|
||||
DPRINT("ReturnValue == ExceptionContinueSearch\n");
|
||||
|
||||
/* Nothing to do here */
|
||||
}
|
||||
else if (ReturnValue == ExceptionNestedException)
|
||||
{
|
||||
DPRINT("ReturnValue == ExceptionNestedException\n");
|
||||
|
||||
ExceptionRecord->ExceptionFlags |= EXCEPTION_EXIT_UNWIND;
|
||||
if (DispatcherContext > Temp)
|
||||
{
|
||||
Temp = DispatcherContext;
|
||||
}
|
||||
}
|
||||
else /* if (ReturnValue == ExceptionCollidedUnwind) */
|
||||
{
|
||||
DPRINT("ReturnValue == ExceptionCollidedUnwind or unknown\n");
|
||||
|
||||
ExceptionRecord2.ExceptionRecord = ExceptionRecord;
|
||||
ExceptionRecord2.ExceptionCode = STATUS_INVALID_DISPOSITION;
|
||||
ExceptionRecord2.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||
ExceptionRecord2.NumberParameters = 0;
|
||||
RtlRaiseException(&ExceptionRecord2);
|
||||
}
|
||||
|
||||
RegistrationFrame = RegistrationFrame->prev; // Go to previous frame
|
||||
}
|
||||
|
||||
/* No exception handler will handle this exception */
|
||||
|
||||
DPRINT("RtlpDispatchException(): Return ExceptionContinueExecution\n");
|
||||
|
||||
return ExceptionContinueExecution;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID STDCALL
|
||||
RtlRaiseStatus(NTSTATUS Status)
|
||||
{
|
||||
EXCEPTION_RECORD ExceptionRecord;
|
||||
|
||||
DPRINT("RtlRaiseStatus(Status 0x%.08x)\n", Status);
|
||||
|
||||
ExceptionRecord.ExceptionCode = Status;
|
||||
ExceptionRecord.ExceptionRecord = NULL;
|
||||
ExceptionRecord.NumberParameters = 0;
|
||||
ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||
RtlRaiseException (& ExceptionRecord);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID STDCALL
|
||||
RtlUnwind(PEXCEPTION_REGISTRATION RegistrationFrame,
|
||||
PVOID ReturnAddress,
|
||||
PEXCEPTION_RECORD ExceptionRecord,
|
||||
DWORD EaxValue)
|
||||
{
|
||||
PEXCEPTION_REGISTRATION ERHead;
|
||||
PEXCEPTION_RECORD pExceptRec;
|
||||
EXCEPTION_RECORD TempER;
|
||||
CONTEXT Context;
|
||||
|
||||
DPRINT("RtlUnwind(). RegistrationFrame 0x%X\n", RegistrationFrame);
|
||||
|
||||
#ifndef NDEBUG
|
||||
RtlpDumpExceptionRegistrations();
|
||||
#endif /* NDEBUG */
|
||||
|
||||
ERHead = SehpGetExceptionList();
|
||||
|
||||
DPRINT("ERHead is 0x%X\n", ERHead);
|
||||
|
||||
if (ExceptionRecord == NULL) // The normal case
|
||||
{
|
||||
DPRINT("ExceptionRecord == NULL (normal)\n");
|
||||
|
||||
pExceptRec = &TempER;
|
||||
pExceptRec->ExceptionFlags = 0;
|
||||
pExceptRec->ExceptionCode = STATUS_UNWIND;
|
||||
pExceptRec->ExceptionRecord = NULL;
|
||||
pExceptRec->ExceptionAddress = ReturnAddress;
|
||||
pExceptRec->ExceptionInformation[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pExceptRec = ExceptionRecord;
|
||||
}
|
||||
|
||||
if (RegistrationFrame)
|
||||
pExceptRec->ExceptionFlags |= EXCEPTION_UNWINDING;
|
||||
else
|
||||
pExceptRec->ExceptionFlags |= (EXCEPTION_UNWINDING|EXCEPTION_EXIT_UNWIND);
|
||||
|
||||
#ifndef NDEBUG
|
||||
DPRINT("ExceptionFlags == 0x%x:\n", pExceptRec->ExceptionFlags);
|
||||
if (pExceptRec->ExceptionFlags & EXCEPTION_UNWINDING)
|
||||
{
|
||||
DPRINT(" * EXCEPTION_UNWINDING (0x%x)\n", EXCEPTION_UNWINDING);
|
||||
}
|
||||
if (pExceptRec->ExceptionFlags & EXCEPTION_EXIT_UNWIND)
|
||||
{
|
||||
DPRINT(" * EXCEPTION_EXIT_UNWIND (0x%x)\n", EXCEPTION_EXIT_UNWIND);
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
|
||||
Context.ContextFlags =
|
||||
(CONTEXT_i386 | CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS);
|
||||
|
||||
SehpCaptureContext(&Context);
|
||||
|
||||
DPRINT("Context.Eip = 0x%.08x\n", Context.Eip);
|
||||
DPRINT("Context.Ebp = 0x%.08x\n", Context.Ebp);
|
||||
DPRINT("Context.Esp = 0x%.08x\n", Context.Esp);
|
||||
|
||||
Context.Esp += 0x10;
|
||||
Context.Eax = EaxValue;
|
||||
|
||||
// Begin traversing the list of EXCEPTION_REGISTRATION
|
||||
while ((ULONG_PTR)ERHead != -1)
|
||||
{
|
||||
EXCEPTION_RECORD er2;
|
||||
|
||||
DPRINT("ERHead 0x%X\n", ERHead);
|
||||
|
||||
if (ERHead == RegistrationFrame)
|
||||
{
|
||||
DPRINT("Continueing execution\n");
|
||||
SehpContinue(&Context, FALSE);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If there's an exception frame, but it's lower on the stack
|
||||
// than the head of the exception list, something's wrong!
|
||||
if (RegistrationFrame && (RegistrationFrame <= ERHead))
|
||||
{
|
||||
DPRINT("The exception frame is bad\n");
|
||||
|
||||
// Generate an exception to bail out
|
||||
er2.ExceptionRecord = pExceptRec;
|
||||
er2.NumberParameters = 0;
|
||||
er2.ExceptionCode = STATUS_INVALID_UNWIND_TARGET;
|
||||
er2.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||
|
||||
RtlRaiseException(&er2);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
Stack = ERHead + sizeof(EXCEPTION_REGISTRATION);
|
||||
if ( (Teb->Tib.StackBase <= (PVOID)ERHead ) // Make sure that ERHead
|
||||
&& (Teb->Tib.->StackLimit >= (PVOID)Stack ) // is in range, and a multiple
|
||||
&& (0 == ((ULONG_PTR)ERHead & 3)) ) // of 4 (i.e., sane)
|
||||
{
|
||||
#else
|
||||
if (1) {
|
||||
#endif
|
||||
PEXCEPTION_REGISTRATION NewERHead;
|
||||
PEXCEPTION_REGISTRATION pCurrExceptReg;
|
||||
EXCEPTION_DISPOSITION ReturnValue;
|
||||
|
||||
DPRINT("Executing handler at 0x%X for unwind\n", ERHead->handler);
|
||||
|
||||
ReturnValue = RtlpExecuteHandlerForUnwind(
|
||||
pExceptRec,
|
||||
ERHead,
|
||||
&Context,
|
||||
&NewERHead,
|
||||
ERHead->handler);
|
||||
|
||||
DPRINT("Handler at 0x%X returned 0x%X\n", ERHead->handler, ReturnValue);
|
||||
|
||||
if (ReturnValue != ExceptionContinueSearch)
|
||||
{
|
||||
if (ReturnValue != ExceptionCollidedUnwind)
|
||||
{
|
||||
DPRINT("Bad return value\n");
|
||||
|
||||
er2.ExceptionRecord = pExceptRec;
|
||||
er2.NumberParameters = 0;
|
||||
er2.ExceptionCode = STATUS_INVALID_DISPOSITION;
|
||||
er2.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||
|
||||
RtlRaiseException(&er2);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERHead = NewERHead;
|
||||
}
|
||||
}
|
||||
|
||||
pCurrExceptReg = ERHead;
|
||||
ERHead = ERHead->prev;
|
||||
|
||||
DPRINT("New ERHead is 0x%X\n", ERHead);
|
||||
|
||||
DPRINT("Setting exception registration at 0x%X as current\n",
|
||||
RegistrationFrame->prev);
|
||||
|
||||
// Unlink the exception handler
|
||||
SehpSetExceptionList(RegistrationFrame->prev);
|
||||
}
|
||||
else // The stack looks goofy! Raise an exception to bail out
|
||||
{
|
||||
DPRINT("Bad stack\n");
|
||||
|
||||
er2.ExceptionRecord = pExceptRec;
|
||||
er2.NumberParameters = 0;
|
||||
er2.ExceptionCode = STATUS_BAD_STACK;
|
||||
er2.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
|
||||
|
||||
RtlRaiseException(&er2);
|
||||
}
|
||||
}
|
||||
|
||||
// If we get here, we reached the end of the EXCEPTION_REGISTRATION list.
|
||||
// This shouldn't happen normally.
|
||||
|
||||
DPRINT("Ran out of exception registrations. RegistrationFrame is (0x%X)\n",
|
||||
RegistrationFrame);
|
||||
|
||||
if ((ULONG_PTR)RegistrationFrame == -1)
|
||||
SehpContinue(&Context, FALSE);
|
||||
else
|
||||
NtRaiseException(pExceptRec, &Context, 0);
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -8,6 +8,7 @@
|
|||
* REVISION HISTORY: 2003/04/24 Created
|
||||
*/
|
||||
|
||||
int _fltused = 0x9875;
|
||||
/*
|
||||
* This routine is called by MSVC-generated code to convert from floating point
|
||||
* to integer representation. The floating point number to be converted is
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/* $Id: alldiv.s 12852 2005-01-06 13:58:04Z mf $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/* $Id: allmul.s 12852 2005-01-06 13:58:04Z mf $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/* $Id: allrem.s 12852 2005-01-06 13:58:04Z mf $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/* $Id: allshl.s 12852 2005-01-06 13:58:04Z mf $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/* $Id: allshr.s 12852 2005-01-06 13:58:04Z mf $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/* $Id: aulldiv.s 12852 2005-01-06 13:58:04Z mf $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/* $Id: aullrem.s 12852 2005-01-06 13:58:04Z mf $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/* $Id: aullshr.s 12852 2005-01-06 13:58:04Z mf $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
|
@ -52,7 +52,15 @@ TARGET_OBJECTS = \
|
|||
version.o \
|
||||
i386/chkstk.o \
|
||||
i386/exception.o \
|
||||
i386/except.o
|
||||
i386/except.o \
|
||||
i386/alldiv.o \
|
||||
i386/allmul.o \
|
||||
i386/allrem.o \
|
||||
i386/allshl.o \
|
||||
i386/allshr.o \
|
||||
i386/aulldiv.o \
|
||||
i386/aullrem.o \
|
||||
i386/aullshr.o \
|
||||
|
||||
# atom
|
||||
# registry
|
||||
|
|
|
@ -23,7 +23,6 @@ OBJECTS_KE_I386 := \
|
|||
ke/i386/v86m_sup.o \
|
||||
ke/i386/vdm.o \
|
||||
ke/i386/bios.o \
|
||||
ke/i386/i386-mcount.o \
|
||||
ke/i386/gdt.o \
|
||||
ke/i386/idt.o \
|
||||
ke/i386/ldt.o \
|
||||
|
@ -41,14 +40,6 @@ OBJECTS_MM_I386 := \
|
|||
mm/i386/pfault.o
|
||||
|
||||
OBJECTS_RTL_I386 := \
|
||||
rtl/i386/alldiv.o \
|
||||
rtl/i386/allmul.o \
|
||||
rtl/i386/allrem.o \
|
||||
rtl/i386/allshl.o \
|
||||
rtl/i386/allshr.o \
|
||||
rtl/i386/aulldiv.o \
|
||||
rtl/i386/aullrem.o \
|
||||
rtl/i386/aullshr.o \
|
||||
rtl/i386/exception.o \
|
||||
rtl/i386/seh.o
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
/* i386-specific implemetation of profiling support.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* We need a special version of the `mcount' function since for ix86 it
|
||||
must not clobber any register. This has several reasons:
|
||||
- there is a bug in gcc as of version 2.7.2.2 which prohibits the
|
||||
use of profiling together with nested functions
|
||||
- the ELF `fixup' function uses GCC's regparm feature
|
||||
- some (future) systems might want to pass parameters in registers. */
|
||||
/* 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
|
||||
|
||||
/* Pop the saved registers. Please note that `mcount' has no
|
||||
return value. */
|
||||
popl %edx
|
||||
popl %ecx
|
||||
popl %eax
|
||||
ret
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue