/* This attribute allows automatic cleanup of the registered frames */
#define _SEH3$_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_AutoCleanup)))
+int
+__attribute__((regparm(3)))
+__attribute__((returns_twice))
+_SEH3$_RegisterFrameWithNonVolatiles(
+ volatile SEH3$_REGISTRATION_FRAME* RegistrationFrame,
+ const SEH3$_SCOPE_TABLE* ScopeTable,
+ void* AllocaFrame);
+
+int
+__attribute__((regparm(3)))
+__attribute__((returns_twice))
+_SEH3$_RegisterTryLevelWithNonVolatiles(
+ volatile SEH3$_REGISTRATION_FRAME* RegistrationFrame,
+ const SEH3$_SCOPE_TABLE* ScopeTable,
+ void* AllocaFrame);
+
/* CLANG specific definitions! */
#ifdef __clang__
/* CLANG doesn't have asm goto! */
#define _SEH3$_ASM_GOTO(...)
-int
-__attribute__((regparm(3)))
-__attribute__((returns_twice))
-_SEH3$_RegisterFrameWithNonVolatiles(
- volatile SEH3$_REGISTRATION_FRAME* RegistrationFrame,
- const SEH3$_SCOPE_TABLE* ScopeTable,
- void* AllocaFrame);
-
#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \
do { \
int result = _SEH3$_RegisterFrameWithNonVolatiles(_TrylevelFrame, _DataTable, __builtin_alloca(0)); \
} \
} while(0)
-int
-__attribute__((regparm(3)))
-__attribute__((returns_twice))
-_SEH3$_RegisterTryLevelWithNonVolatiles(
- volatile SEH3$_REGISTRATION_FRAME* RegistrationFrame,
- const SEH3$_SCOPE_TABLE* ScopeTable,
- void* AllocaFrame);
-
#define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \
do { \
int result = _SEH3$_RegisterTryLevelWithNonVolatiles(_TrylevelFrame, _DataTable, __builtin_alloca(0)); \
#ifdef __cplusplus
#define _SEH3$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \
- asm goto ("leal %0, %%eax\n" \
- "leal %1, %%edx\n" \
- "call " #_Function "WithStackLayout\n" \
+ asm goto ("leal %0, %%eax\n\t" \
+ "leal %1, %%edx\n\t" \
+ "call " #_Function "WithStackLayout" \
: \
- : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "c"(__builtin_alloca(0)) \
+ : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "c" (__builtin_alloca(0)), "p" (_SEH3$_RegisterFrameWithNonVolatiles) \
: "eax", "edx", "memory" \
: _SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally)
#else
#define _SEH3$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \
- asm goto ("leal %0, %%eax\n" \
- "leal %1, %%edx\n" \
- "call " #_Function "\n" \
+ asm goto ("leal %0, %%eax\n\t" \
+ "leal %1, %%edx\n\t" \
+ "call " #_Function \
: \
- : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)) \
+ : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "p" (_SEH3$_RegisterFrameWithNonVolatiles) \
: "eax", "edx", "ecx", "memory" \
: _SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally)
#endif
/* On invocation, the AllocaFrame field is loaded with the return esp value */
#define _SEH3$_NESTED_FUNC_RETURN(_Result) \
/* Restore esp and return to the caller */ \
- asm volatile ("movl %[FixedEsp], %%esp\nret\n" \
- : : "a"(_Result), [FixedEsp]"m"(_SEH3$_TrylevelFrame.AllocaFrame) : "ebx", "ecx", "edx", "esi", "edi", "flags", "memory")
+ asm volatile ("movl %[FixedEsp], %%esp\n\tret" \
+ : : "a" (_Result), [FixedEsp] "m" (_SEH3$_TrylevelFrame.AllocaFrame) : "ebx", "ecx", "edx", "esi", "edi", "flags", "memory")
/* The filter "function" */
#define _SEH3$_DEFINE_FILTER_FUNC(_Name, expression) \
/* Second call to get the filter result */
"mov $1, %%ecx\n\t"
- "call *%[Filter]\n\t"
- : "=a"(FilterResult)
+ "call *%[Filter]"
+ : "=a" (FilterResult)
: [RegistrationFrame] "m" (RegistrationFrame), [Filter] "m" (Filter)
: "ecx", "edx");
{
asm volatile (
/* Load the registers */
- "movl 20(%%ecx), %%esp\n"
- "movl 24(%%ecx), %%ebp\n"
+ "movl 20(%%ecx), %%esp\n\t"
+ "movl 24(%%ecx), %%ebp\n\t"
/* Stack pointer is 4 off from the call to __SEH3$_RegisterFrame */
- "addl $4, %%esp\n"
+ "addl $4, %%esp\n\t"
/* Jump into the exception handler */
- "jmp *%[Target]\n"
+ "jmp *%[Target]"
: :
"c" (RegistrationFrame),
"a" (RegistrationFrame->ScopeTable),
{
asm volatile (
/* Load the registers */
- "movl 20(%%ecx), %%esp\n"
- "movl 24(%%ecx), %%ebp\n"
+ "movl 20(%%ecx), %%esp\n\t"
+ "movl 24(%%ecx), %%ebp\n\t"
/* Stack pointer is 4 off from the call to __SEH3$_RegisterFrame */
- "addl $4, %%esp\n"
+ "addl $4, %%esp\n\t"
/* Jump into the exception handler */
- "jmp *%[Target]\n"
+ "jmp *%[Target]"
: :
"c" (RegistrationFrame),
"a" (RegistrationFrame->ScopeTable),
LONG FilterResult;
/* Clear the direction flag. */
- asm volatile ("cld\n" : : : "memory");
+ asm volatile ("cld" : : : "memory");
/* Save the exception pointers on the stack */
ExceptionPointers.ExceptionRecord = ExceptionRecord;
__asm__ __volatile__
(
- "subl %1, %%esp\n"
- "movl %%esp, %%edi\n"
- "movl %2, %%esi\n"
- "shrl $2, %1\n"
- "rep movsd\n"
- "call *%3\n"
- "movl %%eax, %0\n"
+ "subl %1, %%esp\n\t"
+ "movl %%esp, %%edi\n\t"
+ "movl %2, %%esi\n\t"
+ "shrl $2, %1\n\t"
+ "rep movsd\n\t"
+ "call *%3\n\t"
+ "movl %%eax, %0"
: "=r"(Result)
: "c"(StackBytes),
"d"(Arguments),
NTSTATUS
KiConvertToGuiThread(VOID)
{
+ NTSTATUS NTAPI PsConvertToGuiThread(VOID);
NTSTATUS Result;
PVOID StackFrame;
"addl %%esp, %1\n\t"
"movl %1, %%ebp"
: "=a"(Result), "=r"(StackFrame)
- :
+ : "p"(PsConvertToGuiThread)
: "%esp", "%ecx", "%edx", "memory"
);
return Result;
VOID
KiSwitchToBootStack(IN ULONG_PTR InitialStack)
{
+ VOID NTAPI KiSystemStartupBootStack(VOID);
+
/* We have to switch to a new stack before continuing kernel initialization */
#ifdef __GNUC__
__asm__
(
- "movl %0, %%esp\n"
- "subl %1, %%esp\n"
- "pushl %2\n"
- "jmp _KiSystemStartupBootStack@0\n"
+ "movl %0, %%esp\n\t"
+ "subl %1, %%esp\n\t"
+ "pushl %2\n\t"
+ "jmp _KiSystemStartupBootStack@0"
:
: "c"(InitialStack),
"i"(NPX_FRAME_LENGTH + KTRAP_FRAME_ALIGN + KTRAP_FRAME_LENGTH),
- "i"(CR0_EM | CR0_TS | CR0_MP)
+ "i"(CR0_EM | CR0_TS | CR0_MP),
+ "p"(KiSystemStartupBootStack)
: "%esp"
);
#elif defined(_MSC_VER)
- VOID NTAPI KiSystemStartupBootStack(VOID);
__asm
{
mov esp, InitialStack
#if defined(__GNUC__)
__asm__ __volatile__
(
- "iret\n"
+ "iret"
);
#elif defined(_MSC_VER)
__asm