Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
feat: prioritize using my jbcxrval.c
Browse files Browse the repository at this point in the history
undo: unnecessary changes
  • Loading branch information
MiroKaku committed Jul 1, 2024
1 parent 04de8af commit 0871055
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ bld/
[Oo]bj/
[Bb]in/
[Ll]ib/
ucxxrt/

# Visual Studio 2015 cache/options directory
.vs/
Expand Down Expand Up @@ -262,4 +263,3 @@ __pycache__/

# VSCode
.vscode/
/ucxxrt
2 changes: 2 additions & 0 deletions msvc/ucxxrt.test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
<TargetVersion Condition="'$(Platform)' == 'ARM64'">Windows10</TargetVersion>
<DriverTargetPlatform Condition="'$(Platform)' == 'ARM64'"></DriverTargetPlatform>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand Down
8 changes: 6 additions & 2 deletions src/crt/i386/chandler4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,17 @@ _EH4_LocalUnwind(

#endif

extern "C"
void
extern "C"
void
__cdecl
__except_validate_context_record(
_In_ PCONTEXT ContextRecord
);

#if defined(_X86_)
_VEIL_DECLARE_ALTERNATE_NAME(__except_validate_context_record, _UCXXRT___except_validate_context_record);
#endif

/***
*ValidateLocalCookies - perform local cookie validation during SEH processing
*
Expand Down
10 changes: 7 additions & 3 deletions src/crt/i386/trnsctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,17 @@ extern "C" _VCRTIMP __declspec(naked) DECLSPEC_GUARD_SUPPRESS EXCEPTION_DISPOSIT
}
}

extern "C"
void
__cdecl
extern "C"
void
__cdecl
__except_validate_jump_buffer (
_In_ _JUMP_BUFFER *JumpBuffer
);

#if defined(_X86_)
_VEIL_DECLARE_ALTERNATE_NAME(__except_validate_jump_buffer, _UCXXRT___except_validate_jump_buffer);
#endif

/////////////////////////////////////////////////////////////////////////////
//
// __CxxLongjmpUnwind - Entry point for local unwind required by longjmp
Expand Down
4 changes: 2 additions & 2 deletions src/crt/vcruntime/ehhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define MANAGED_EXCEPTION_CODE_V4 0XE0434352

extern "C"
void
void
__cdecl
__except_validate_context_record(
_In_ PCONTEXT ContextRecord
Expand Down Expand Up @@ -61,7 +61,7 @@ extern "C" _VCRTIMP int __cdecl RENAME_EH_EXTERN(__TypeMatch4)(
FH4::HandlerType4 *,
CatchableType *,
ThrowInfo *
);
);

extern "C" _VCRTIMP int __cdecl RENAME_EH_EXTERN(__TypeMatch)(
HandlerType *,
Expand Down
4 changes: 4 additions & 0 deletions src/crt/vcruntime/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include "winapi_thunks.h"


#if defined(_X86_)
_VEIL_DECLARE_ALTERNATE_NAME(__except_validate_context_record, _UCXXRT___except_validate_context_record);
#endif

// Make non-namespace prefixed names available for FH4
using namespace FH4;

Expand Down
16 changes: 10 additions & 6 deletions src/crt/vcruntime/jbcxrval.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,15 @@ __except_validate_jump_buffer(

#else // defined(NTOS_KERNEL_RUNTIME)


#if !defined(_X86_) // In X86, this function conflicts with the function in libcntpr.lib
void
__cdecl
#if defined(_X86_)
_UCXXRT___except_validate_context_record(
_In_ PCONTEXT ContextRecord
#else
__except_validate_context_record(
_In_ PCONTEXT ContextRecord
#endif
)

/*++
Expand Down Expand Up @@ -214,7 +217,6 @@ Return Value:
}
}
}
#endif // !defined(_X86_)


__forceinline
Expand Down Expand Up @@ -279,17 +281,19 @@ static PVOID __except_get_jumpbuf_sp(_In_reads_(_JBLEN) jmp_buf JumpBuffer)
return (PVOID)JUMP_BUFFER_TO_STACK_POINTER((_JUMP_BUFFER*)JumpBuffer);
}


#if !defined(_X86_) // In X86, this function conflicts with the function in libcntpr.lib
void
__cdecl
#if defined(_X86_)
_UCXXRT___except_validate_jump_buffer(
_In_reads_(_JBLEN) jmp_buf JumpBuffer
#else
__except_validate_jump_buffer(
_In_reads_(_JBLEN) jmp_buf JumpBuffer
#endif
)
{
__except_validate_jump_buffer_common(JumpBuffer, __except_get_jumpbuf_sp);
}
#endif // !defined(_X86_)


#endif // !defined(NTOS_KERNEL_RUNTIME)

0 comments on commit 0871055

Please sign in to comment.