- Cleanup except_asm.s and add .func/.endfunc and fix some double definitions.

svn path=/trunk/; revision=24174
This commit is contained in:
Alex Ionescu 2006-09-17 18:44:52 +00:00
parent b820ec4930
commit 23dc37d575

View file

@ -12,24 +12,22 @@
#include <ndk/asm.h>
.intel_syntax noprefix
#define EXCEPTION_UNWINDING 2
#define EXCEPTION_EXIT_UNWIND 4
#define EXCEPTION_UNWIND (EXCEPTION_UNWINDING + EXCEPTION_EXIT_UNWIND)
#define ExceptionContinueExecution 0
#define ExceptionContinueSearch 1
#define ExceptionNestedException 2
#define ExceptionCollidedUnwind 3
/* FUNCTIONS ****************************************************************/
.func RtlpGetExceptionList@0
.globl _RtlpGetExceptionList@0
_RtlpGetExceptionList@0:
/* Return the exception list */
mov eax, [fs:TEB_EXCEPTION_LIST]
ret
.endfunc
.func RtlpSetExceptionList@4
.globl _RtlpSetExceptionList@4
_RtlpSetExceptionList@4:
@ -42,7 +40,9 @@ _RtlpSetExceptionList@4:
/* Return */
ret 4
.endfunc
.func RtlpGetExceptionAddress@0
.globl _RtlpGetExceptionAddress@0
_RtlpGetExceptionAddress@0:
@ -51,7 +51,9 @@ _RtlpGetExceptionAddress@0:
/* Return */
ret
.endfunc
.func RtlCaptureContext@4
.globl _RtlCaptureContext@4
_RtlCaptureContext@4:
@ -63,21 +65,23 @@ _RtlCaptureContext@4:
mov [ebx+CONTEXT_EAX], eax
mov [ebx+CONTEXT_ECX], ecx
mov [ebx+CONTEXT_EDX], edx
mov eax, [esp] /* We pushed EBX, remember? ;) */
mov eax, [esp]
mov [ebx+CONTEXT_EBX], eax
mov [ebx+CONTEXT_ESI], esi
mov [ebx+CONTEXT_EDI], edi
/* Capture the other regs */
jmp CaptureRest
.endfunc
.func RtlpCaptureContext@4
.globl _RtlpCaptureContext@4
_RtlpCaptureContext@4:
/* Preserve EBX and put the context in it */
push ebx
mov ebx, [esp+8]
/* Clear the basic register context */
mov dword ptr [ebx+CONTEXT_EAX], 0
mov dword ptr [ebx+CONTEXT_ECX], 0
@ -85,7 +89,7 @@ _RtlpCaptureContext@4:
mov dword ptr [ebx+CONTEXT_EBX], 0
mov dword ptr [ebx+CONTEXT_ESI], 0
mov dword ptr [ebx+CONTEXT_EDI], 0
CaptureRest:
/* Capture the segment registers */
mov [ebx+CONTEXT_SEGCS], cs
@ -114,7 +118,9 @@ CaptureRest:
/* Return to the caller */
pop ebx
ret 4
.endfunc
.func RtlpExecuteHandlerForException@20
.globl _RtlpExecuteHandlerForException@20
_RtlpExecuteHandlerForException@20:
@ -123,21 +129,23 @@ _RtlpExecuteHandlerForException@20:
/* Jump to common routine */
jmp _RtlpExecuteHandler@20
.endfunc
.func RtlpExecuteHandlerForUnwind@20
.globl _RtlpExecuteHandlerForUnwind@20
_RtlpExecuteHandlerForUnwind@20:
/* Copy the routine in EDX */
mov edx, offset _RtlpExceptionProtector
.endfunc
/* Run the common routine */
.func RtlpExecuteHandler@20
_RtlpExecuteHandler@20:
/* Save non-volatile */
push ebx
push esi
push edi
/* Clear registers */
xor eax, eax
xor ebx, ebx
@ -157,7 +165,9 @@ _RtlpExecuteHandler@20:
pop esi
pop ebx
ret 0x14
.endfunc
.func RtlpExecuteHandler2@20
.globl _RtlpExecuteHandler2@20
_RtlpExecuteHandler2@20:
@ -195,7 +205,9 @@ _RtlpExecuteHandler2@20:
mov esp, ebp
pop ebp
ret 0x14
.endfunc
.func RtlpExceptionProtector
_RtlpExceptionProtector:
/* Assume we'll continue */
@ -203,7 +215,7 @@ _RtlpExceptionProtector:
/* Put the exception record in ECX and check the Flags */
mov ecx, [esp+4]
test dword ptr [ecx+EXCEPTION_RECORD_EXCEPTION_FLAGS], EXCEPTION_UNWIND
test dword ptr [ecx+EXCEPTION_RECORD_EXCEPTION_FLAGS], EXCEPTION_UNWINDING + EXCEPTION_EXIT_UNWIND
jnz return
/* Save the frame in ECX and Context in EDX */
@ -221,14 +233,17 @@ _RtlpExceptionProtector:
return:
ret 16
.endfunc
.func RtlpUnwindProtector
_RtlpUnwindProtector:
/* Assume we'll continue */
mov eax, ExceptionContinueSearch
/* Put the exception record in ECX and check the Flags */
mov ecx, [esp+4]
test dword ptr [ecx+EXCEPTION_RECORD_EXCEPTION_FLAGS], EXCEPTION_UNWIND
test dword ptr [ecx+EXCEPTION_RECORD_EXCEPTION_FLAGS], EXCEPTION_UNWINDING + EXCEPTION_EXIT_UNWIND
jnz .return
/* Save the frame in ECX and Context in EDX */
@ -246,4 +261,5 @@ _RtlpUnwindProtector:
.return:
ret 16
.endfunc