зеркало из https://github.com/mozilla/pjs.git
x86Win32ExceptionHandler.h => x86ExceptionHandler.h
This commit is contained in:
Родитель
9d7415a38e
Коммит
b1e1abe173
|
@ -1,67 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
#######################################################################
|
||||
# (1) Directory specific info #
|
||||
#######################################################################
|
||||
|
||||
DEPTH = ../../../..
|
||||
|
||||
CPPSRCS = x86ExceptionHandler.cpp \
|
||||
x86SysCallsRuntime.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_MD_EXPORTS_x86 = x86SysCallsRuntime.h \
|
||||
x86Win32ExceptionHandler.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE_NAME = EF
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
#######################################################################
|
||||
# (3) Include "local" platform-dependent assignments (OPTIONAL). #
|
||||
#######################################################################
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
|
||||
CPPSRCS += Win32ExceptionHandler.cpp \
|
||||
x86Win32InvokeNative.cpp \
|
||||
x86Win32Thread.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_MD_EXPORTS_x86 += x86Win32Thread.h \
|
||||
$(NULL)
|
||||
else
|
||||
|
||||
ASFILES = x86Exception_gas.s \
|
||||
x86InvokeNative_gas.s \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS += x86UnixishThread.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_MD_EXPORTS_x86 += x86UnixishThread.h \
|
||||
$(NULL)
|
||||
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
|
@ -37,7 +37,7 @@
|
|||
#include "NativeCodeCache.h"
|
||||
#include "LogModule.h"
|
||||
|
||||
#include "x86Win32ExceptionHandler.h"
|
||||
#include "x86ExceptionHandler.h"
|
||||
|
||||
// declarations
|
||||
extern "C" SYSCALL_FUNC(void) x86SoftwareExceptionHandler(Uint32 EBP, Uint32 EDI, Uint32 ESI, Uint32 EBX, const JavaObject& inObject);
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
|
||||
#include "SysCalls.h"
|
||||
#include "prprf.h"
|
||||
#include "x86Win32ExceptionHandler.h"
|
||||
#include "x86ExceptionHandler.h"
|
||||
#include "ExceptionTable.h"
|
||||
#include "NativeCodeCache.h"
|
||||
#include "LogModule.h"
|
||||
|
||||
UT_DEFINE_LOG_MODULE(Win32ExceptionHandler);
|
||||
UT_DEFINE_LOG_MODULE(x86ExceptionHandler);
|
||||
UT_DEFINE_LOG_MODULE(ExceptionRegs);
|
||||
|
||||
extern "C" SYSCALL_FUNC(void) x86JumpToHandler(const JavaObject* inObject, Uint8* handler, Uint32 EBX, Uint32 ESI, Uint32 EDI, Uint32* EBP, Uint32* ESP);
|
||||
|
@ -139,7 +139,7 @@ extern "C" SYSCALL_FUNC(void) x86SoftwareExceptionHandler(Uint32 inEBP, Uint32 i
|
|||
context.restoreESP = (Uint32*) ((Uint8*)context.sucessorEBP + 12);
|
||||
|
||||
// now that the context struct is filled we can print debugging information
|
||||
DEBUG_LOG_ONLY(printExceptionBegin(UT_LOG_MODULE(Win32ExceptionHandler), &context));
|
||||
DEBUG_LOG_ONLY(printExceptionBegin(UT_LOG_MODULE(x86ExceptionHandler), &context));
|
||||
|
||||
// find the exception handler
|
||||
Uint8* handler = findExceptionHandler(&context);
|
||||
|
@ -147,7 +147,7 @@ extern "C" SYSCALL_FUNC(void) x86SoftwareExceptionHandler(Uint32 inEBP, Uint32 i
|
|||
// jump to it
|
||||
UT_LOG(ExceptionRegs, PR_LOG_DEBUG, ("Exit: "));
|
||||
DEBUG_LOG_ONLY(printRegs(UT_LOG_MODULE(ExceptionRegs), &context));
|
||||
UT_LOG(Win32ExceptionHandler, PR_LOG_DEBUG, ("\n===============================\n\n"));
|
||||
UT_LOG(x86ExceptionHandler, PR_LOG_DEBUG, ("\n===============================\n\n"));
|
||||
assert(handler);
|
||||
x86JumpToHandler(context.object, handler, context.EBX, context.ESI, context.EDI, context.sourceEBP, context.restoreESP);
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ bool x86PopStackFrame(Context* context)
|
|||
context->restoreESP = NULL;
|
||||
}
|
||||
|
||||
DEBUG_LOG_ONLY(printContext(UT_LOG_MODULE(Win32ExceptionHandler), context));
|
||||
DEBUG_LOG_ONLY(printContext(UT_LOG_MODULE(x86ExceptionHandler), context));
|
||||
DEBUG_ONLY(checkForNativeStub(context));
|
||||
return true;
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ bool isGuardFrame(Context* context, bool printIdentifier = false)
|
|||
if( ((Uint32)(sysInvokeNativeStubs[i]) + 9 + 5 * i) == retAddress)
|
||||
{
|
||||
if(printIdentifier)
|
||||
UT_LOG(Win32ExceptionHandler, PR_LOG_DEBUG, ("Guard Frame (made by sysInvokeNative%d())\n", i));
|
||||
UT_LOG(x86ExceptionHandler, PR_LOG_DEBUG, ("Guard Frame (made by sysInvokeNative%d())\n", i));
|
||||
return true;
|
||||
}
|
||||
// check other stubs
|
||||
|
@ -261,7 +261,7 @@ bool isGuardFrame(Context* context, bool printIdentifier = false)
|
|||
if( ((Uint32)(sysInvokeNativeStubs[i]) + 23) == retAddress)
|
||||
{
|
||||
if(printIdentifier)
|
||||
UT_LOG(Win32ExceptionHandler, PR_LOG_DEBUG, ("Guard Frame (made by sysInvokeNative(%d))\n", i));
|
||||
UT_LOG(x86ExceptionHandler, PR_LOG_DEBUG, ("Guard Frame (made by sysInvokeNative(%d))\n", i));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ bool isGuardFrame(Context* context, bool printIdentifier = false)
|
|||
if((Uint32)compileStubReEntryPoint == retAddress)
|
||||
{
|
||||
if(printIdentifier)
|
||||
UT_LOG(Win32ExceptionHandler, PR_LOG_DEBUG, ("Guard Frame (staticCompileStub)\n"));
|
||||
UT_LOG(x86ExceptionHandler, PR_LOG_DEBUG, ("Guard Frame (staticCompileStub)\n"));
|
||||
DEBUG_LOG_ONLY(PR_fprintf(PR_STDOUT,"WARNING: exception unwinding past a static compile stub\n"));
|
||||
return true;
|
||||
}
|
||||
|
@ -426,16 +426,16 @@ Uint8* findExceptionHandler(Context* context)
|
|||
if (!x86PopStackFrame(context)) // when popStack() fails, we are faced with an uncaught exception
|
||||
{
|
||||
Uint8* uncaughtHandler = uncaughtExceptionExit(context);
|
||||
UT_LOG(Win32ExceptionHandler, PR_LOG_DEBUG, ("\n-------------------------------\n"));
|
||||
UT_LOG(Win32ExceptionHandler, PR_LOG_DEBUG, ("Uncaught Exception -- jumping to handler at 0x%p\n", uncaughtHandler));
|
||||
UT_LOG(x86ExceptionHandler, PR_LOG_DEBUG, ("\n-------------------------------\n"));
|
||||
UT_LOG(x86ExceptionHandler, PR_LOG_DEBUG, ("Uncaught Exception -- jumping to handler at 0x%p\n", uncaughtHandler));
|
||||
return uncaughtHandler;
|
||||
}
|
||||
}
|
||||
|
||||
Uint8* pHandler = context->sourceCE->eTable->getStart()+ete->pHandler;
|
||||
assert(pHandler);
|
||||
UT_LOG(Win32ExceptionHandler, PR_LOG_DEBUG, ("\n-------------------------------\n"));
|
||||
UT_LOG(Win32ExceptionHandler, PR_LOG_DEBUG, ("Matched to catch handler at %p\n\n", pHandler));
|
||||
UT_LOG(x86ExceptionHandler, PR_LOG_DEBUG, ("\n-------------------------------\n"));
|
||||
UT_LOG(x86ExceptionHandler, PR_LOG_DEBUG, ("Matched to catch handler at %p\n\n", pHandler));
|
||||
assert(context->restoreESP != NULL); // restore ESP must not be null, could mean that we are trying to return to a native method, NYI
|
||||
return pHandler;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
// x86ExceptionHandler.h
|
||||
//
|
||||
// simon
|
||||
|
||||
#ifndef _X86EXCEPTIONHANDLER_H_
|
||||
#define _X86EXCEPTIONHANDLER_H_
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <excpt.h>
|
||||
#endif
|
||||
|
||||
#include "SysCallsRuntime.h"
|
||||
#include "Fundamentals.h"
|
||||
#include "LogModule.h"
|
||||
|
||||
struct JavaObject;
|
||||
struct CacheEntry;
|
||||
|
||||
extern void* sysInvokeNativeStubs[];
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// Do not mess with ordering!
|
||||
struct Context
|
||||
{
|
||||
// save registers
|
||||
Uint32 EBX;
|
||||
Uint32 ESI;
|
||||
Uint32 EDI;
|
||||
|
||||
Uint32* sourceEBP;
|
||||
Uint32* sucessorEBP;
|
||||
|
||||
Uint8* sourceAddress;
|
||||
|
||||
Uint32* restoreESP; // where ESP should be set if returning back to this frame
|
||||
|
||||
CacheEntry* sourceCE;
|
||||
CacheEntry* successorCE;
|
||||
|
||||
JavaObject* object;
|
||||
};
|
||||
|
||||
#if defined(_WIN32)
|
||||
NS_EXTERN EXCEPTION_DISPOSITION win32HardwareThrow(struct _EXCEPTION_RECORD *ExceptionRecord,
|
||||
void * EstablisherFrame,
|
||||
struct _CONTEXT *ContextRecord,
|
||||
void * DispatcherContext);
|
||||
NS_EXTERN EXCEPTION_DISPOSITION win32HardwareThrowExit(struct _EXCEPTION_RECORD *ExceptionRecord,
|
||||
void * EstablisherFrame,
|
||||
struct _CONTEXT *ContextRecord,
|
||||
void * DispatcherContext);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
void printContext(LogModuleObject &f, Context* context);
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
#endif // _X86EXCEPTIONHANDLER_H_
|
Загрузка…
Ссылка в новой задаче