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

Commit

Permalink
Merge pull request #42 from silver3-github/fixbug
Browse files Browse the repository at this point in the history
修复x86编译bug
  • Loading branch information
MiroKaku authored Jul 1, 2024
2 parents 8d249a2 + acfe5ad commit 545e40f
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 12 deletions.
1 change: 1 addition & 0 deletions .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
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
10 changes: 8 additions & 2 deletions src/crt/i386/chandler4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,16 @@ _EH4_LocalUnwind(

#endif

extern 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: 8 additions & 2 deletions src/crt/i386/trnsctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,16 @@ extern "C" _VCRTIMP __declspec(naked) DECLSPEC_GUARD_SUPPRESS EXCEPTION_DISPOSIT
}
}

extern "C" void
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

/////////////////////////////////////////////////////////////////////////////
//
Expand Down
8 changes: 5 additions & 3 deletions src/crt/vcruntime/ehhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
// V4 and later managed exception code
#define MANAGED_EXCEPTION_CODE_V4 0XE0434352

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

extern "C" _VCRTIMP void * __cdecl __AdjustPointer(
void *,
Expand Down Expand Up @@ -59,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
13 changes: 13 additions & 0 deletions src/crt/vcruntime/jbcxrval.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,13 @@ __except_validate_jump_buffer(

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 @@ -213,6 +218,7 @@ Return Value:
}
}


__forceinline
void
__except_validate_jump_buffer_common(
Expand Down Expand Up @@ -277,10 +283,17 @@ static PVOID __except_get_jumpbuf_sp(_In_reads_(_JBLEN) jmp_buf JumpBuffer)

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(NTOS_KERNEL_RUNTIME)
3 changes: 0 additions & 3 deletions src/crt/vcruntime/sys_common.inl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ _CRTALLOC(".CRT$XIAA") static _PIFV pre_c_initializer = pre_c_initialization;
_CRTALLOC(".CRT$XCAA") static _PVFV pre_cpp_initializer = pre_cpp_initialization;


//extern PDRIVER_OBJECT __drvobj = nullptr;
static PDRIVER_UNLOAD __drv_unload = nullptr;

static __declspec(noinline) void __scrt_common_exit(PDRIVER_OBJECT drvobj)
Expand All @@ -84,8 +83,6 @@ static __declspec(noinline) void __scrt_common_exit(PDRIVER_OBJECT drvobj)

static __declspec(noinline) long __cdecl __scrt_common_main_seh(PDRIVER_OBJECT drvobj, PUNICODE_STRING regpath)
{
// __drvobj = drvobj;

if (!__scrt_initialize_crt())
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);

Expand Down
1 change: 0 additions & 1 deletion src/ucrt/startup/exit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ static int __cdecl atexit_exception_filter(unsigned long const _exception_code)
return EXCEPTION_CONTINUE_SEARCH;
}

//extern PDRIVER_OBJECT __drvobj;

static void __cdecl common_exit(
int const /*return_code*/,
Expand Down
6 changes: 5 additions & 1 deletion src/ucxxrt.h
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
#pragma once
#pragma once


// 这是一个标识文件
// 用于属性表识别当前目录是否存在ucxxrt库,请勿删除!

0 comments on commit 545e40f

Please sign in to comment.