[ros-diffs] [hyperion] 37315: added include/reactos/libs/pseh/pseh2.h added lib/pseh/framebased-gcchack.c added lib/pseh/i386/framebased-gcchack.S modified lib/pseh/pseh.rbuild Introducing PSEH 2.0. It only wants to be loved. Highlights of this version: - PSEH 2.0 syntax is 99% compatible with native SEH syntax - PSEH 2.0 binary code a vast improvement over 1.1 - no more setjmp, no bogus loops, no weird optimizer behavior PSEH 2.0 is a horrible, GCC-only, x86-only hack. It makes several non-portable assumptions and hey, did you know __builtin_frame_address(0) is *not* the same thing as EBP? Overall, it must be a world record for compiler abuse PSEH 2.0 is, sadly, not binary-compatible with PSEH 1.1, although I will almost certainly unify the implementation at a later time PSEH 2.0 needs testers. And love. Not implemented yet: returning from a SEH block (i.e. _SEH2_YIELD()) Example of 2.0 syntax (yes, _SEH2_END is unavoidable): _SEH2_TRY { _SEH2_TRY { /* ... */ } _SEH2_EXCEPT((/* ... */)) { /* ... */ } _SEH2_END; } _SEH2_FINALLY { /* ... */ } _SEH2_END; -- Happy early birthday, Aleksey.
hyperion at svn.reactos.org
hyperion at svn.reactos.org
Wed Nov 12 20:52:16 CET 2008
- Previous message: [ros-diffs] [ekohl] 37314: Sync to wine-0.9.61: Oooops, forgot to add these files!! - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Stop looping in check_remoting_args when a context_handle or wire_marshal type is found as they are in effect fundamental types. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Check that fields in structures and unions referenced by non-local functions can be marshalled and that their attributes are consistent. -Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: The implicit_handle attribute is allowed with a handle explicitly specified in the function parameters. In that case, that handle is used instead of the implicit handle. Fix the check for the explicit_handle attribute being specified without a handle being specified in the function parameters, even though issuing an error is wrong. (Thanks to Marcus Meissner & Coverity for spotting that the check didn't do what it was supposed to do.) - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Automatically add "handle_t IDL_handle" parameter to functions with no explicit handle specified whose containing interface has the explicit_handle attribute. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Issue an error instead of crashing for dividing by zero in a constant expression. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Add support for "->" and "." operators in expressions. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Add support for arrays in expressions. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Add support for '%' operator in expressions. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Fix operator precedence in expressions. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Require a constant expression for case statements. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Add support for comparison, exclusive or, logical not and positive operators in expressions. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Remove EXPR_MEMBERPTR and implement it using EXPR_PPTR and EXPR_MEMBER instead. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Don't free input_name in pop_import as we keep pointers to it in the var_t type now. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Pass the actual type into check_remoting_fields and check_field_common instead of the type name. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Check that expressions resolve so that expressions in generated code will compile. Also check that expressions return the correct type for the attribute. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Move expression functions to a new file, expr.c. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Use expr_resolve_type to get the type of the identifier in write_conf_or_var_desc. Remove the conversion of pointer types into base types as this was only needed due to lack of proper type resolving. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Remove duplicated code in the form of the write_struct_expr function by enhancing write_expr to allow toplevel identifiers to be prefixed by a string, if specified. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Implement lcid property on library declarations. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Construct the pointer chain while parsing pointers, rather than storing a ptr_level. This method is more flexible and somewhat simpler. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Allow NULL to be used in expressions. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Create a list of statements in the whole IDL file, instead of just a list of interfaces. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Add typedef statements to the statement lists. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Consolidate most of the inner loop of reg_typedefs into set_type. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Rename pident to declarator and parse the array declarations as part of declarators. This allows arrays to be used in typedefs and const statements. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Make the rules for parsing fields in structures, encapsulated unions and non-encapsulated unions more strict. Move the rules in fields that handle empty union cases into separate union rules so that they can't erroneously be accepted for structures or other types of unions. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Add support for declaring multiple fields of a structure in one statement. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Add support for string literals and wide-string literals in expressions. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Create a statement object for import statements. Move the writing of include directives into the generated header into header.c. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Move the func_declarator rule entirely into direct_declarator. - Rob Shearman <rob at codeweavers.com> Sat, 26 Apr 2008 widl: Add typedefs to typelibs which have the public or uuid attributes, not any other attribute. - Rob Shearman <rob at codeweavers.com> Sat, 26 Apr 2008 widl: Support hex digits that use an uppercase 0X prefix. - Rob Shearman <rob at codeweavers.com> Sun, 27 Apr 2008 widl: Accept integer constant suffixes in the lexer. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: Keep const attributes applied to pointers when writing out the type. Use an attribute to store the const qualifier for the pointer and type. Allow multiple type-qualifiers to be applied to a type by adding a declaration-specifier rule that encompasses type-qualifiers and types. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: Add support for "inline" on function definitions. Fix applying calling convention to function type. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: Make constdef and externdef take a declarator instead of an ident so that functions and arrays can be defined using the statements. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: Allow pointer attributes to be applied to function pointers. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: callback, code, comm_status and in_line are attribute names, not keywords. - Rob Shearman <rob at codeweavers.com> Wed, 30 Apr 2008 widl: Prepare for supporting storage classes in declaration statements. Return a decl_spec_t structure from decl_spec rules so that the storage class and type qualifiers can both be returned. - Rob Shearman <rob at codeweavers.com> Wed, 30 Apr 2008 widl: Add the parsing of storage classes into declaration-specifiers. Support the static and register keywords. This consolidates externdef and constdef rules into one declaration rule. - Rob Shearman <rob at codeweavers.com> Thu, 1 May 2008 widl: Consolidate writing of COM and dispatch interfaces into one function to remove duplicated code. Split up the writing into start and end to eventually support the style MIDL uses where it writes declared types, etc. between the start and end of the interface. Make internal header functions take the file pointer to print to. Don't write interface IDs for non-object interfaces and always write handle declarations even if the interface has no methods, like MIDL does. - Gerald Pfeifer <gerald at pfeifer.com> Fri, 2 May 2008 widl: Fix syntax to also work with older versions of bison.
- Next message: [ros-diffs] [mkupfer] 37316: - add and enable partition creation and file system selection dialog
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: hyperion
Date: Wed Nov 12 13:52:16 2008
New Revision: 37315
URL: http://svn.reactos.org/svn/reactos?rev=37315&view=rev
Log:
added include/reactos/libs/pseh/pseh2.h
added lib/pseh/framebased-gcchack.c
added lib/pseh/i386/framebased-gcchack.S
modified lib/pseh/pseh.rbuild
Introducing PSEH 2.0. It only wants to be loved. Highlights of this version:
- PSEH 2.0 syntax is 99% compatible with native SEH syntax
- PSEH 2.0 binary code a vast improvement over 1.1 - no more setjmp, no bogus loops, no weird optimizer behavior
PSEH 2.0 is a horrible, GCC-only, x86-only hack. It makes several non-portable assumptions and hey, did you know __builtin_frame_address(0) is *not* the same thing as EBP? Overall, it must be a world record for compiler abuse
PSEH 2.0 is, sadly, not binary-compatible with PSEH 1.1, although I will almost certainly unify the implementation at a later time
PSEH 2.0 needs testers. And love.
Not implemented yet: returning from a SEH block (i.e. _SEH2_YIELD())
Example of 2.0 syntax (yes, _SEH2_END is unavoidable):
_SEH2_TRY
{
_SEH2_TRY
{
/* ... */
}
_SEH2_EXCEPT((/* ... */))
{
/* ... */
}
_SEH2_END;
}
_SEH2_FINALLY
{
/* ... */
}
_SEH2_END;
--
Happy early birthday, Aleksey.
Added:
trunk/reactos/include/reactos/libs/pseh/pseh2.h (with props)
trunk/reactos/lib/pseh/framebased-gcchack.c (with props)
trunk/reactos/lib/pseh/i386/framebased-gcchack.S (with props)
Modified:
trunk/reactos/lib/pseh/pseh.rbuild
Added: trunk/reactos/include/reactos/libs/pseh/pseh2.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/pseh2.h?rev=37315&view=auto
==============================================================================
--- trunk/reactos/include/reactos/libs/pseh/pseh2.h (added)
+++ trunk/reactos/include/reactos/libs/pseh/pseh2.h [iso-8859-1] Wed Nov 12 13:52:16 2008
@@ -1,0 +1,359 @@
+/*
+ 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.
+*/
+
+#ifndef KJK_PSEH2_H_
+#define KJK_PSEH2_H_
+
+#ifndef __GNUC__
+#error TODO
+#endif
+
+struct _EXCEPTION_RECORD;
+struct _EXCEPTION_POINTERS;
+struct _CONTEXT;
+
+typedef int (__cdecl * _SEHFrameHandler_t)
+(
+ struct _EXCEPTION_RECORD *,
+ void *,
+ struct _CONTEXT *,
+ void *
+);
+
+#if defined(__i386__)
+typedef struct __SEHTrampoline
+{
+ unsigned char STR_MovEcx;
+ unsigned char STR_Closure[4];
+ unsigned char STR_Jmp;
+ unsigned char STR_Function[4];
+}
+_SEHTrampoline_t;
+
+static
+__inline__
+__attribute__((always_inline))
+int _SEHIsTrampoline(_SEHTrampoline_t * trampoline_)
+{
+ return trampoline_->STR_MovEcx == 0xb9 && trampoline_->STR_Jmp == 0xe9;
+}
+
+static
+__inline__
+__attribute__((always_inline))
+void * _SEHFunctionFromTrampoline(_SEHTrampoline_t * trampoline_)
+{
+ return (void *)(*(int *)(&trampoline_->STR_Function[0]) + (int)(trampoline_ + 1));
+}
+
+static
+__inline__
+__attribute__((always_inline))
+void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
+{
+ return (void *)*(int *)(&trampoline_->STR_Closure[0]);
+}
+#else
+#error TODO
+#endif
+
+/* A no-op side effect that scares GCC */
+#define __SEH_SIDE_EFFECT __asm__ __volatile__("#")
+
+/* A no-op without any real side effects, but silences warnings */
+#define __SEH_PRETEND_SIDE_EFFECT (void)0
+
+/* Forces GCC to consider the specified label reachable */
+#define __SEH_USE_LABEL(L_) __asm__ __volatile__("# %0\n" : : "i" (&&L_))
+
+/* Makes GCC pretend the specified label is reachable, to silence warnings */
+#define __SEH_PRETEND_USE_LABEL(L_) (void)(&&L_)
+
+/* Forces GCC to emit the specified nested function as a function */
+#define __SEH_USE_NESTED_FUNCTION(F_) (void)(&F_) /* __attribute__((noinline)) seems to do the trick */
+
+/* Soft memory barrier */
+#define __SEH_BARRIER __asm__ __volatile__("#":::"memory")
+
+typedef struct __SEHRegistration
+{
+ struct __SEHRegistration * SER_Prev;
+ _SEHFrameHandler_t SER_Handler;
+}
+_SEHRegistration_t;
+
+#define __SEH_FORCE_NEST \
+ __asm__ __volatile__("#%0" : : "r" (&_SEHFrame))
+
+#define __SEH_NESTED_PROLOG \
+ __SEH_FORCE_NEST;
+
+#define __SEH_DECLARE_EXCEPT_PFN(NAME_) int (__cdecl * NAME_)(void *)
+#define __SEH_DECLARE_EXCEPT(NAME_) int __cdecl NAME_(void *)
+#define __SEH_DEFINE_EXCEPT(NAME_) int __cdecl NAME_(void * _SEHExceptionPointers)
+
+#define __SEH_DECLARE_FINALLY_PFN(NAME_) void (__cdecl * NAME_)(void)
+#define __SEH_DECLARE_FINALLY(NAME_) void __cdecl NAME_(void)
+#define __SEH_DEFINE_FINALLY(NAME_) void __cdecl NAME_(void)
+
+#define __SEH_RETURN_EXCEPT(R_) return (int)(R_)
+#define __SEH_RETURN_FINALLY() return
+
+typedef struct __SEHFrame
+{
+ _SEHRegistration_t SF_Registration;
+ volatile struct __SEHTryLevel * volatile SF_TopTryLevel;
+ void * SF_FramePointer;
+ void * volatile SF_StackPointer;
+ volatile unsigned long SF_Code;
+}
+_SEHFrame_t;
+
+typedef struct __SEHTryLevel
+{
+ volatile struct __SEHTryLevel * ST_Next;
+ void * ST_FramePointer;
+ void * ST_Filter;
+ void * ST_Body;
+}
+_SEHTryLevel_t;
+
+#define __SEH_BEGIN_TRY \
+ { \
+ __label__ _SEHBeginTry; \
+ __label__ _SEHEndTry; \
+ \
+ __SEH_USE_LABEL(_SEHBeginTry); \
+ __SEH_USE_LABEL(_SEHEndTry); \
+ \
+ _SEHBeginTry: __SEH_SIDE_EFFECT; \
+ { \
+ __SEH_BARRIER;
+
+#define __SEH_END_TRY \
+ __SEH_BARRIER; \
+ } \
+ _SEHEndTry: __SEH_SIDE_EFFECT; \
+ }
+
+#define __SEH_SET_TRYLEVEL(TRYLEVEL_) \
+ { \
+ __SEH_BARRIER; _SEHFrameP->SF_TopTryLevel = (TRYLEVEL_); __SEH_BARRIER; \
+ }
+
+#define __SEH_ENTER_TRYLEVEL() __SEH_SET_TRYLEVEL(&_SEHTryLevel)
+#define __SEH_LEAVE_TRYLEVEL() __SEH_SET_TRYLEVEL(_SEHPrevTryLevelP)
+
+#define __SEH_END_SCOPE_CHAIN \
+ static const int _SEHScopeKind = 1; \
+ static _SEHFrame_t * const _SEHFrameP = 0; \
+ static _SEHTryLevel_t * const _SEHTryLevelP = 0;
+
+#define __SEH_BEGIN_SCOPE \
+ for(;;) \
+ { \
+ __label__ _SEHBeginScope; \
+ __label__ _SEHEndScope; \
+ \
+ _SEHBeginScope: __SEH_SIDE_EFFECT; \
+ \
+ static const int _SEHTopTryLevel = (_SEHScopeKind != 0); \
+ _SEHFrame_t * const _SEHCurFrameP = _SEHFrameP; \
+ volatile _SEHTryLevel_t * const _SEHPrevTryLevelP = _SEHTryLevelP; \
+ \
+ (void)_SEHTopTryLevel; \
+ (void)_SEHCurFrameP; \
+ (void)_SEHPrevTryLevelP; \
+ \
+ __SEH_USE_LABEL(_SEHBeginScope); \
+ __SEH_USE_LABEL(_SEHEndScope); \
+ \
+ { \
+ __label__ _SEHBeforeTry; \
+ __label__ _SEHDoTry; \
+ __label__ _SEHAfterTry; \
+ static const int _SEHScopeKind = 0; \
+ _SEHFrame_t _SEHFrame; \
+ volatile _SEHTryLevel_t _SEHTryLevel; \
+ _SEHFrame_t * const _SEHFrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
+ volatile _SEHTryLevel_t * const _SEHTryLevelP = &_SEHTryLevel; \
+ \
+ (void)_SEHScopeKind; \
+ (void)_SEHFrame; \
+ (void)_SEHTryLevel; \
+ (void)_SEHFrameP; \
+ (void)_SEHTryLevelP; \
+ \
+ _SEHTryLevel.ST_Next = _SEHPrevTryLevelP; \
+ goto _SEHBeforeTry; \
+ \
+ _SEHDoTry:; \
+ __SEH_ENTER_TRYLEVEL(); \
+ \
+ if(_SEHTopTryLevel) \
+ { \
+ __SEH_BARRIER; __asm__ __volatile__("mov %%ebp, %0\n#%1" : "=m" (_SEHFrame.SF_FramePointer) : "r" (__builtin_frame_address(0))); __SEH_BARRIER; \
+ _SEH2EnterFrame(&_SEHFrame); \
+ } \
+
+#define __SEH_END_SCOPE \
+ } \
+ \
+ _SEHEndScope: __SEH_SIDE_EFFECT; \
+ \
+ break; \
+ }
+
+#define __SEH_SCOPE_LOCALS \
+ __label__ _SEHBeginExcept; \
+ __label__ _SEHEndExcept; \
+ \
+ auto __SEH_DECLARE_EXCEPT(_SEHExcept); \
+ auto __SEH_DECLARE_FINALLY(_SEHFinally);
+
+#define _SEH2_TRY \
+ __SEH_BEGIN_SCOPE \
+ { \
+ __SEH_SCOPE_LOCALS; \
+ \
+ void _SEHJumpToHandler() { goto _SEHBeginExcept; } \
+\
+ __SEH_BEGIN_TRY \
+ {
+
+#define _SEH2_FINALLY \
+ } \
+ __SEH_END_TRY; \
+ \
+ goto _SEHAfterTry; \
+ _SEHBeforeTry:; \
+ \
+ __SEH_PRETEND_USE_LABEL(_SEHBeginExcept); \
+ __SEH_PRETEND_USE_LABEL(_SEHEndExcept); \
+ \
+ __SEH_USE_NESTED_FUNCTION(_SEHFinally); \
+ \
+ _SEHTryLevel.ST_FramePointer = _SEHClosureFromTrampoline((_SEHTrampoline_t *)&_SEHFinally); \
+ _SEHTryLevel.ST_Filter = NULL; \
+ _SEHTryLevel.ST_Body = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)&_SEHFinally); \
+ \
+ goto _SEHDoTry; \
+ _SEHAfterTry:; \
+ \
+ if(_SEHTopTryLevel) \
+ _SEH2LeaveFrame(); \
+ else \
+ { \
+ __SEH_LEAVE_TRYLEVEL(); \
+ } \
+ \
+ _SEHFinally(); \
+ goto _SEHEndExcept; \
+ \
+ _SEHBeginExcept: __SEH_PRETEND_SIDE_EFFECT; \
+ __attribute__((unused)) __SEH_DEFINE_EXCEPT(_SEHExcept) { __SEH_RETURN_EXCEPT(0); } \
+ \
+ __attribute__((noinline)) __attribute__((used)) __SEH_DEFINE_FINALLY(_SEHFinally) \
+ { \
+ __SEH_END_SCOPE_CHAIN; \
+ \
+ (void)_SEHScopeKind; \
+ (void)_SEHFrameP; \
+ (void)_SEHTryLevelP; \
+ \
+ __SEH_NESTED_PROLOG; \
+ \
+ for(;; ({ __SEH_RETURN_FINALLY(); })) \
+ {
+
+#define _SEH2_EXCEPT(E_) \
+ } \
+ __SEH_END_TRY; \
+ \
+ goto _SEHAfterTry; \
+ \
+ _SEHBeforeTry:; \
+\
+ __SEH_USE_LABEL(_SEHBeginExcept); \
+ __SEH_USE_LABEL(_SEHEndExcept); \
+\
+ __SEH_USE_NESTED_FUNCTION(_SEHExcept); \
+ \
+ _SEHTryLevel.ST_FramePointer = _SEHClosureFromTrampoline((_SEHTrampoline_t *)&_SEHExcept); \
+ _SEHTryLevel.ST_Filter = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)&_SEHExcept); \
+ _SEHTryLevel.ST_Body = &&_SEHBeginExcept; \
+ __SEH_BARRIER; __asm__ __volatile__("mov %%esp, %0" : "=m" (_SEHFrameP->SF_StackPointer)); __SEH_BARRIER; \
+\
+ goto _SEHDoTry; \
+\
+ __attribute__((noinline)) __attribute__((used)) __SEH_DEFINE_EXCEPT(_SEHExcept) \
+ { \
+ __SEH_NESTED_PROLOG; \
+ __SEH_RETURN_EXCEPT(E_); \
+ } \
+\
+ __attribute__((unused)) __SEH_DEFINE_FINALLY(_SEHFinally) { __SEH_RETURN_FINALLY(); } \
+\
+ _SEHAfterTry:; \
+ if(_SEHTopTryLevel) \
+ _SEH2LeaveFrame(); \
+ else \
+ { \
+ __SEH_LEAVE_TRYLEVEL(); \
+ } \
+\
+ goto _SEHEndExcept; \
+\
+ _SEHBeginExcept: __SEH_SIDE_EFFECT; \
+ { \
+ { \
+ _SEHFrame_t * const _SEHFrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
+ __SEH_BARRIER;
+
+#define _SEH2_END \
+ __SEH_BARRIER; \
+ } \
+ } \
+ _SEHEndExcept: __SEH_SIDE_EFFECT; \
+ } \
+ __SEH_END_SCOPE;
+
+#define _SEH2_GetExceptionPointers() ((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers)
+#define _SEH2_GetExceptionCode() ((_SEHFrameP)->SF_Code)
+
+__SEH_END_SCOPE_CHAIN;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern void __cdecl _SEH2EnterFrame(_SEHFrame_t *);
+extern void __cdecl _SEH2LeaveFrame(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+/* EOF */
Propchange: trunk/reactos/include/reactos/libs/pseh/pseh2.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/lib/pseh/framebased-gcchack.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/framebased-gcchack.c?rev=37315&view=auto
==============================================================================
--- trunk/reactos/lib/pseh/framebased-gcchack.c (added)
+++ trunk/reactos/lib/pseh/framebased-gcchack.c [iso-8859-1] Wed Nov 12 13:52:16 2008
@@ -1,0 +1,159 @@
+/*
+ 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_
+#define STRICT
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#include <pseh/pseh2.h>
+
+#include <excpt.h>
+
+extern int __SEH2Except(void *, void *, void *);
+extern void __SEH2Finally(void *, void *);
+
+static
+__attribute__((always_inline))
+int _SEH2Except(_SEHFrame_t * frame, volatile _SEHTryLevel_t * trylevel, EXCEPTION_POINTERS * ep)
+{
+ return __SEH2Except(trylevel->ST_Filter, trylevel->ST_FramePointer, ep);
+}
+
+static
+__attribute__((noinline))
+void _SEH2Finally(_SEHFrame_t * frame, volatile _SEHTryLevel_t * trylevel)
+{
+ __SEH2Finally(trylevel->ST_Body, trylevel->ST_FramePointer);
+}
+
+static
+void _SEH2LocalUnwind(_SEHFrame_t * frame, volatile _SEHTryLevel_t * dsttrylevel)
+{
+ volatile _SEHTryLevel_t * trylevel;
+
+ for(trylevel = frame->SF_TopTryLevel; trylevel && trylevel != dsttrylevel; trylevel = trylevel->ST_Next)
+ {
+ if(!trylevel->ST_Filter)
+ _SEH2Finally(frame, trylevel);
+ }
+
+ frame->SF_TopTryLevel = dsttrylevel;
+}
+
+extern void _SEH2GlobalUnwind(void *);
+
+static
+__attribute__((noreturn))
+void _SEH2Handle(_SEHFrame_t * frame, volatile _SEHTryLevel_t * trylevel)
+{
+ _SEH2GlobalUnwind(frame);
+ _SEH2LocalUnwind(frame, trylevel);
+
+ __asm__ __volatile__
+ (
+ "mov %[frame], %%ebp\n"
+ "mov %[stack], %%esp\n"
+ "jmp *%[handler]\n" :
+ :
+ [frame] "m" (frame->SF_FramePointer), [stack] "m" (frame->SF_StackPointer), [handler] "r" (trylevel->ST_Body)
+ );
+
+ for(;;);
+}
+
+static
+int __cdecl _SEH2FrameHandler
+(
+ struct _EXCEPTION_RECORD * ExceptionRecord,
+ void * EstablisherFrame,
+ struct _CONTEXT * ContextRecord,
+ void * DispatcherContext
+)
+{
+ _SEHFrame_t * frame;
+
+ __asm__ __volatile__("cld");
+
+ frame = EstablisherFrame;
+
+ /* Unwinding */
+ if(ExceptionRecord->ExceptionFlags & (4 | 2))
+ {
+ _SEH2LocalUnwind(frame, NULL);
+ }
+ /* Handling */
+ else
+ {
+ int ret = 0;
+ volatile _SEHTryLevel_t * trylevel;
+
+ frame->SF_Code = ExceptionRecord->ExceptionCode;
+
+ for(trylevel = frame->SF_TopTryLevel; trylevel != NULL; trylevel = trylevel->ST_Next)
+ {
+ if(trylevel->ST_Filter)
+ {
+ EXCEPTION_POINTERS ep;
+
+ ep.ExceptionRecord = ExceptionRecord;
+ ep.ContextRecord = ContextRecord;
+
+ ret = _SEH2Except(frame, trylevel, &ep);
+
+ if(ret < 0)
+ return ExceptionContinueExecution;
+ else if(ret > 0)
+ _SEH2Handle(frame, trylevel);
+ }
+ }
+ }
+
+ return ExceptionContinueSearch;
+}
+
+extern
+void __cdecl _SEH2EnterFrame(_SEHFrame_t * frame)
+{
+ frame->SF_Registration.SER_Handler = _SEH2FrameHandler;
+ frame->SF_Code = 0;
+ __asm__ __volatile__("movl %%fs:0, %k0\n" : "=q" (frame->SF_Registration.SER_Prev));
+
+ __SEH_BARRIER;
+ __asm__ __volatile__("movl %k0, %%fs:0\n" : : "q" (&frame->SF_Registration));
+}
+
+extern
+void __cdecl _SEH2LeaveFrame()
+{
+ __asm__ __volatile__
+ (
+ "movl %%fs:0, %%edx\n"
+ "movl 0(%%edx), %%edx\n"
+ "movl %%edx, %%fs:0\n" :
+ :
+ :
+ "ecx"
+ );
+}
+
+/* EOF */
Propchange: trunk/reactos/lib/pseh/framebased-gcchack.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/lib/pseh/i386/framebased-gcchack.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/i386/framebased-gcchack.S?rev=37315&view=auto
==============================================================================
--- trunk/reactos/lib/pseh/i386/framebased-gcchack.S (added)
+++ trunk/reactos/lib/pseh/i386/framebased-gcchack.S [iso-8859-1] Wed Nov 12 13:52:16 2008
@@ -1,0 +1,68 @@
+// 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
+
+.globl ___SEH2Except
+___SEH2Except:
+ mov eax, [esp+4]
+ mov ecx, [esp+8]
+
+ push [esp+12]
+ call eax
+
+ pop ecx
+
+ ret
+
+.globl ___SEH2Finally
+___SEH2Finally:
+ mov eax, [esp+4]
+ mov ecx, [esp+8]
+
+ call eax
+
+ ret
+
+.globl __SEH2GlobalUnwind
+__SEH2GlobalUnwind:
+
+.extern _RtlUnwind at 16
+
+ push ebx
+ mov ebx, [esp+8]
+ push esi
+ push edi
+
+ push 0 // ReturnValue
+ push 0 // ExceptionRecord
+ push .RestoreRegisters // TargetIp
+ push ebx // TargetFrame
+ call _RtlUnwind at 16
+
+.RestoreRegisters:
+ pop edi
+ pop esi
+ pop ebx
+
+ ret
+
+// EOF
Propchange: trunk/reactos/lib/pseh/i386/framebased-gcchack.S
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/lib/pseh/pseh.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/pseh.rbuild?rev=37315&r1=37314&r2=37315&view=diff
==============================================================================
--- trunk/reactos/lib/pseh/pseh.rbuild [iso-8859-1] (original)
+++ trunk/reactos/lib/pseh/pseh.rbuild [iso-8859-1] Wed Nov 12 13:52:16 2008
@@ -4,6 +4,7 @@
<if property="ARCH" value="i386">
<directory name="i386">
<file>framebased.S</file>
+ <file>framebased-gcchack.S</file>
</directory>
</if>
<if property="ARCH" value="powerpc">
@@ -12,4 +13,5 @@
</directory>
</if>
<file>framebased.c</file>
+ <file>framebased-gcchack.c</file>
</module>
- Previous message: [ros-diffs] [ekohl] 37314: Sync to wine-0.9.61: Oooops, forgot to add these files!! - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Stop looping in check_remoting_args when a context_handle or wire_marshal type is found as they are in effect fundamental types. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Check that fields in structures and unions referenced by non-local functions can be marshalled and that their attributes are consistent. -Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: The implicit_handle attribute is allowed with a handle explicitly specified in the function parameters. In that case, that handle is used instead of the implicit handle. Fix the check for the explicit_handle attribute being specified without a handle being specified in the function parameters, even though issuing an error is wrong. (Thanks to Marcus Meissner & Coverity for spotting that the check didn't do what it was supposed to do.) - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Automatically add "handle_t IDL_handle" parameter to functions with no explicit handle specified whose containing interface has the explicit_handle attribute. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Issue an error instead of crashing for dividing by zero in a constant expression. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Add support for "->" and "." operators in expressions. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Add support for arrays in expressions. - Rob Shearman <rob at codeweavers.com> Sun, 20 Apr 2008 widl: Add support for '%' operator in expressions. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Fix operator precedence in expressions. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Require a constant expression for case statements. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Add support for comparison, exclusive or, logical not and positive operators in expressions. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Remove EXPR_MEMBERPTR and implement it using EXPR_PPTR and EXPR_MEMBER instead. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Don't free input_name in pop_import as we keep pointers to it in the var_t type now. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Pass the actual type into check_remoting_fields and check_field_common instead of the type name. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Check that expressions resolve so that expressions in generated code will compile. Also check that expressions return the correct type for the attribute. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Move expression functions to a new file, expr.c. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Use expr_resolve_type to get the type of the identifier in write_conf_or_var_desc. Remove the conversion of pointer types into base types as this was only needed due to lack of proper type resolving. - Rob Shearman <rob at codeweavers.com> Tue, 22 Apr 2008 widl: Remove duplicated code in the form of the write_struct_expr function by enhancing write_expr to allow toplevel identifiers to be prefixed by a string, if specified. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Implement lcid property on library declarations. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Construct the pointer chain while parsing pointers, rather than storing a ptr_level. This method is more flexible and somewhat simpler. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Allow NULL to be used in expressions. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Create a list of statements in the whole IDL file, instead of just a list of interfaces. - Rob Shearman <rob at codeweavers.com> Thu, 24 Apr 2008 widl: Add typedef statements to the statement lists. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Consolidate most of the inner loop of reg_typedefs into set_type. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Rename pident to declarator and parse the array declarations as part of declarators. This allows arrays to be used in typedefs and const statements. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Make the rules for parsing fields in structures, encapsulated unions and non-encapsulated unions more strict. Move the rules in fields that handle empty union cases into separate union rules so that they can't erroneously be accepted for structures or other types of unions. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Add support for declaring multiple fields of a structure in one statement. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Add support for string literals and wide-string literals in expressions. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Create a statement object for import statements. Move the writing of include directives into the generated header into header.c. - Rob Shearman <rob at codeweavers.com> Fri, 25 Apr 2008 widl: Move the func_declarator rule entirely into direct_declarator. - Rob Shearman <rob at codeweavers.com> Sat, 26 Apr 2008 widl: Add typedefs to typelibs which have the public or uuid attributes, not any other attribute. - Rob Shearman <rob at codeweavers.com> Sat, 26 Apr 2008 widl: Support hex digits that use an uppercase 0X prefix. - Rob Shearman <rob at codeweavers.com> Sun, 27 Apr 2008 widl: Accept integer constant suffixes in the lexer. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: Keep const attributes applied to pointers when writing out the type. Use an attribute to store the const qualifier for the pointer and type. Allow multiple type-qualifiers to be applied to a type by adding a declaration-specifier rule that encompasses type-qualifiers and types. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: Add support for "inline" on function definitions. Fix applying calling convention to function type. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: Make constdef and externdef take a declarator instead of an ident so that functions and arrays can be defined using the statements. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: Allow pointer attributes to be applied to function pointers. - Rob Shearman <rob at codeweavers.com> Tue, 29 Apr 2008 widl: callback, code, comm_status and in_line are attribute names, not keywords. - Rob Shearman <rob at codeweavers.com> Wed, 30 Apr 2008 widl: Prepare for supporting storage classes in declaration statements. Return a decl_spec_t structure from decl_spec rules so that the storage class and type qualifiers can both be returned. - Rob Shearman <rob at codeweavers.com> Wed, 30 Apr 2008 widl: Add the parsing of storage classes into declaration-specifiers. Support the static and register keywords. This consolidates externdef and constdef rules into one declaration rule. - Rob Shearman <rob at codeweavers.com> Thu, 1 May 2008 widl: Consolidate writing of COM and dispatch interfaces into one function to remove duplicated code. Split up the writing into start and end to eventually support the style MIDL uses where it writes declared types, etc. between the start and end of the interface. Make internal header functions take the file pointer to print to. Don't write interface IDs for non-object interfaces and always write handle declarations even if the interface has no methods, like MIDL does. - Gerald Pfeifer <gerald at pfeifer.com> Fri, 2 May 2008 widl: Fix syntax to also work with older versions of bison.
- Next message: [ros-diffs] [mkupfer] 37316: - add and enable partition creation and file system selection dialog
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Ros-diffs
mailing list