Author: hyperion
Date: Wed Jan 14 08:51:23 2009
New Revision: 38760
URL:
http://svn.reactos.org/svn/reactos?rev=38760&view=rev
Log:
deleted lib/pseh/framebased-gcchack.c
added lib/pseh/i386/framebased-gcchack-asm.S
added lib/pseh/i386/framebased-gcchack.c
deleted lib/pseh/i386/framebased-gcchack.S
modified lib/pseh/pseh.rbuild
framebased-gcchack.c is irreversibly married to the x86 architecture. Move it to the
appropriate place
Rename framebased-gcchack.S because its base name now conflicts with
framebased-gcchack.c
Added:
trunk/reactos/lib/pseh/i386/framebased-gcchack-asm.S (props changed)
- copied unchanged from r38757, trunk/reactos/lib/pseh/i386/framebased-gcchack.S
trunk/reactos/lib/pseh/i386/framebased-gcchack.c (props changed)
- copied unchanged from r38757, trunk/reactos/lib/pseh/framebased-gcchack.c
Removed:
trunk/reactos/lib/pseh/framebased-gcchack.c
trunk/reactos/lib/pseh/i386/framebased-gcchack.S
Modified:
trunk/reactos/lib/pseh/pseh.rbuild
Removed: trunk/reactos/lib/pseh/framebased-gcchack.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/framebased-gcchac…
==============================================================================
--- trunk/reactos/lib/pseh/framebased-gcchack.c [iso-8859-1] (original)
+++ trunk/reactos/lib/pseh/framebased-gcchack.c (removed)
@@ -1,280 +1,0 @@
-/*
- Copyright (c) 2008 KJK::Hyperion
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
-*/
-
-#define _NTSYSTEM_ /* removes dllimport attribute from RtlUnwind */
-
-#define STRICT
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#include <pseh/pseh2.h>
-#include <excpt.h>
-#include <intrin.h>
-
-#ifndef EXCEPTION_EXIT_UNWIND
-#define EXCEPTION_EXIT_UNWIND 4
-#endif
-
-#ifndef EXCEPTION_UNWINDING
-#define EXCEPTION_UNWINDING 2
-#endif
-
-extern DECLSPEC_NORETURN int __SEH2Handle(void *, void *, void *, void *, void *, void
*);
-extern int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT
*, void *);
-extern int __cdecl __SEH2UnwindHandler(struct _EXCEPTION_RECORD *, void *, struct
_CONTEXT *, void *);
-
-FORCEINLINE
-_SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void)
-{
- return (_SEH2Registration_t *)__readfsdword(0);
-}
-
-FORCEINLINE
-void __cdecl __SEH2EnterFrame(_SEH2Registration_t * frame)
-{
- frame->SER_Prev = _SEH2CurrentRegistration();
- __writefsdword(0, (unsigned long)frame);
-}
-
-FORCEINLINE
-void __cdecl __SEH2LeaveFrame(void)
-{
- __writefsdword(0, (unsigned long)_SEH2CurrentRegistration()->SER_Prev);
-}
-
-FORCEINLINE
-void _SEH2GlobalUnwind(void * target)
-{
- __asm__ __volatile__
- (
- "push %%ebp\n"
- "push $0\n"
- "push $0\n"
- "push $Return%=\n"
- "push %[target]\n"
- "call %c[RtlUnwind]\n"
- "Return%=: pop %%ebp\n" :
- :
- [target] "g" (target), [RtlUnwind] "g" (&RtlUnwind) :
- "eax", "ebx", "ecx", "edx", "esi",
"edi", "flags", "memory"
- );
-}
-
-static
-__SEH_EXCEPT_RET _SEH2Except(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel,
struct _EXCEPTION_POINTERS * ep)
-{
- void * filter = trylevel->ST_Filter;
- void * context = NULL;
- __SEH_EXCEPT_RET ret;
-
- if(filter == (void *)0)
- return 0;
-
- if(filter == (void *)1)
- return 1;
-
- if(filter == (void *)-1)
- return -1;
-
- if(_SEHIsTrampoline((_SEHTrampoline_t *)filter))
- {
- context = _SEHClosureFromTrampoline((_SEHTrampoline_t *)filter);
- filter = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)filter);
- }
-
- __asm__ __volatile__
- (
- "push %[ep]\n"
- "push %[frame]\n"
- "call *%[filter]\n"
- "pop %%edx\n"
- "pop %%edx\n" :
- [ret] "=a" (ret) :
- "c" (context), [filter] "r" (filter), [frame] "g"
(frame), [ep] "g" (ep) :
- "edx", "flags", "memory"
- );
-
- return ret;
-}
-
-static
-void _SEH2Finally(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
-{
- if(trylevel->ST_Filter == NULL && trylevel->ST_Body != NULL)
- {
- void * body = trylevel->ST_Body;
- void * context = NULL;
-
- if(_SEHIsTrampoline((_SEHTrampoline_t *)body))
- {
- context = _SEHClosureFromTrampoline((_SEHTrampoline_t *)body);
- body = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)body);
- }
-
- __asm__ __volatile__("call *%1\n" : : "c" (context), "r"
(body) : "eax", "edx", "flags", "memory");
- }
-}
-
-typedef struct __SEH2UnwindFrame
-{
- _SEH2Registration_t SUF_Registration;
- _SEH2Frame_t * SUF_Frame;
- volatile _SEH2TryLevel_t * SUF_TargetTryLevel;
-}
-_SEH2UnwindFrame_t;
-
-static void _SEH2LocalUnwind(_SEH2Frame_t *, volatile _SEH2TryLevel_t *);
-
-extern
-int __cdecl _SEH2UnwindHandler
-(
- struct _EXCEPTION_RECORD * ExceptionRecord,
- void * EstablisherFrame,
- struct _CONTEXT * ContextRecord,
- void * DispatcherContext
-)
-{
- if(ExceptionRecord->ExceptionFlags & (EXCEPTION_EXIT_UNWIND |
EXCEPTION_UNWINDING))
- {
- _SEH2UnwindFrame_t * unwindframe = CONTAINING_RECORD(EstablisherFrame,
_SEH2UnwindFrame_t, SUF_Registration);
- _SEH2LocalUnwind(unwindframe->SUF_Frame, unwindframe->SUF_TargetTryLevel);
- *((void **)DispatcherContext) = EstablisherFrame;
- return ExceptionCollidedUnwind;
- }
-
- return ExceptionContinueSearch;
-}
-
-static
-void _SEH2LocalUnwind(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * dsttrylevel)
-{
- volatile _SEH2TryLevel_t * trylevel;
- _SEH2UnwindFrame_t unwindframe;
-
- unwindframe.SUF_Frame = frame;
- unwindframe.SUF_TargetTryLevel = dsttrylevel;
-
- unwindframe.SUF_Registration.SER_Handler = &__SEH2UnwindHandler;
- __SEH2EnterFrame(&unwindframe.SUF_Registration);
-
- for(trylevel = frame->SF_TopTryLevel; trylevel && trylevel != dsttrylevel;
trylevel = trylevel->ST_Next)
- {
- frame->SF_TopTryLevel = trylevel->ST_Next;
- _SEH2Finally(frame, trylevel);
- }
-
- __SEH2LeaveFrame();
-}
-
-static DECLSPEC_NORETURN
-void _SEH2Handle(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
-{
- volatile _SEH2HandleTryLevel_t * fulltrylevel = CONTAINING_RECORD(trylevel,
_SEH2HandleTryLevel_t, SHT_Common);
-
- _SEH2GlobalUnwind(frame);
- _SEH2LocalUnwind(frame, &fulltrylevel->SHT_Common);
-
- __SEH2Handle
- (
- fulltrylevel->SHT_Common.ST_Body,
- fulltrylevel->SHT_Esp,
- fulltrylevel->SHT_Ebp,
- fulltrylevel->SHT_Ebx,
- fulltrylevel->SHT_Esi,
- fulltrylevel->SHT_Edi
- );
-}
-
-extern
-int __cdecl _SEH2FrameHandler
-(
- struct _EXCEPTION_RECORD * ExceptionRecord,
- void * EstablisherFrame,
- struct _CONTEXT * ContextRecord,
- void * DispatcherContext
-)
-{
- _SEH2Frame_t * frame;
-
- frame = EstablisherFrame;
-
- /* Unwinding */
- if(ExceptionRecord->ExceptionFlags & (EXCEPTION_EXIT_UNWIND |
EXCEPTION_UNWINDING))
- {
- _SEH2LocalUnwind(frame, NULL);
- }
- /* Handling */
- else
- {
- int ret = 0;
- volatile _SEH2TryLevel_t * trylevel;
- EXCEPTION_POINTERS ep;
-
- ep.ExceptionRecord = ExceptionRecord;
- ep.ContextRecord = ContextRecord;
-
- frame->SF_Code = ExceptionRecord->ExceptionCode;
-
- for(trylevel = frame->SF_TopTryLevel; trylevel != NULL; trylevel =
trylevel->ST_Next)
- {
- ret = _SEH2Except(frame, trylevel, &ep);
-
- if(ret < 0)
- return ExceptionContinueExecution;
- else if(ret > 0)
- _SEH2Handle(frame, trylevel);
- }
- }
-
- return ExceptionContinueSearch;
-}
-
-extern
-void __cdecl _SEH2EnterFrame(_SEH2Frame_t * frame)
-{
- frame->SF_Registration.SER_Handler = __SEH2FrameHandler;
- frame->SF_Code = 0;
- __SEH2EnterFrame(&frame->SF_Registration);
-}
-
-extern
-int __cdecl _SEH2EnterFrameAndTrylevel(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t *
trylevel)
-{
- frame->SF_TopTryLevel = trylevel;
- _SEH2EnterFrame(frame);
- return 0;
-}
-
-extern
-void __cdecl _SEH2LeaveFrame(void)
-{
- __SEH2LeaveFrame();
-}
-
-extern
-void __cdecl _SEH2Return(void)
-{
- _SEH2LocalUnwind(CONTAINING_RECORD(_SEH2CurrentRegistration(), _SEH2Frame_t,
SF_Registration), NULL);
- _SEH2LeaveFrame();
-}
-
-/* EOF */
Propchange: trunk/reactos/lib/pseh/i386/framebased-gcchack-asm.S
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/lib/pseh/i386/framebased-gcchack-asm.S
------------------------------------------------------------------------------
svn:mergeinfo =
Removed: trunk/reactos/lib/pseh/i386/framebased-gcchack.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/i386/framebased-g…
==============================================================================
--- trunk/reactos/lib/pseh/i386/framebased-gcchack.S [iso-8859-1] (original)
+++ trunk/reactos/lib/pseh/i386/framebased-gcchack.S (removed)
@@ -1,89 +1,0 @@
-// Copyright (c) 2008 KJK::Hyperion
-
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to dos so, subject to the following conditions:
-
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-
-.text
-.intel_syntax noprefix
-
-.func _SEH2EnterHandleTrylevel
-.globl __SEH2EnterHandleTrylevel
-__SEH2EnterHandleTrylevel:
- mov eax, [esp+8]
- mov ecx, [esp+12]
- mov [eax+8], ecx
- mov [eax+16], ebp
- mov [eax+20], ebx
- mov [eax+24], esi
- mov [eax+28], edi
-
- mov edx, [esp+4]
- mov [edx+8], eax
-
- xor eax, eax
- ret
-.endfunc
-
-.func _SEH2EnterFrameAndHandleTrylevel
-.globl __SEH2EnterFrameAndHandleTrylevel
-__SEH2EnterFrameAndHandleTrylevel:
- mov eax, [esp+8]
- mov ecx, [esp+12]
- mov [eax+8], ecx
- mov [eax+16], ebp
- mov [eax+20], ebx
- mov [eax+24], esi
- mov [eax+28], edi
-
-.extern __SEH2EnterFrameAndTrylevel
- jmp __SEH2EnterFrameAndTrylevel
-.endfunc
-
-.func __SEH2Handle
-.globl ___SEH2Handle
-___SEH2Handle:
- mov eax, [esp+4]
- mov ebp, [esp+12]
- mov ebx, [esp+16]
- mov esi, [esp+20]
- mov edi, [esp+24]
- mov esp, [esp+8]
- jmp eax
-.endfunc
-
-.func __SEH2FrameHandler
-.globl ___SEH2FrameHandler
-___SEH2FrameHandler:
-
-.extern __SEH2FrameHandler
-
- cld
- jmp __SEH2FrameHandler
-.endfunc
-
-.func __SEH2UnwindHandler
-.globl ___SEH2UnwindHandler
-___SEH2UnwindHandler:
-
-.extern __SEH2UnwindHandler
-
- cld
- jmp __SEH2UnwindHandler
-.endfunc
-
-// EOF
Propchange: trunk/reactos/lib/pseh/i386/framebased-gcchack.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/lib/pseh/i386/framebased-gcchack.c
------------------------------------------------------------------------------
svn:mergeinfo =
Modified: trunk/reactos/lib/pseh/pseh.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/pseh.rbuild?rev=3…
==============================================================================
--- trunk/reactos/lib/pseh/pseh.rbuild [iso-8859-1] (original)
+++ trunk/reactos/lib/pseh/pseh.rbuild [iso-8859-1] Wed Jan 14 08:51:23 2009
@@ -4,7 +4,8 @@
<if property="ARCH" value="i386">
<directory name="i386">
<file>framebased.S</file>
- <file>framebased-gcchack.S</file>
+ <file>framebased-gcchack.c</file>
+ <file>framebased-gcchack-asm.S</file>
</directory>
</if>
<if property="ARCH" value="powerpc">
@@ -13,5 +14,4 @@
</directory>
</if>
<file>framebased.c</file>
- <file>framebased-gcchack.c</file>
</module>