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