Improve .proc / .endproc syntax, so that the full symbolic name is passed, which allows to create fastcall symbols. Remove the need to pass the function name to .endp

svn path=/trunk/; revision=54112
This commit is contained in:
Timo Kreuzer 2011-10-13 15:16:29 +00:00
parent 9955d0ed84
commit 143732711e
12 changed files with 67 additions and 72 deletions

View file

@ -184,7 +184,7 @@ _KiRaiseUserExceptionDispatcher@0:
PUBLIC _KiUserExceptionDispatcher@8 PUBLIC _KiUserExceptionDispatcher@8
.PROC KiUserExceptionDispatcher@8 .PROC _KiUserExceptionDispatcher@8
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
/* Clear direction flag */ /* Clear direction flag */
@ -241,10 +241,10 @@ Exit:
call _RtlRaiseException@4 call _RtlRaiseException@4
ret 8 ret 8
.ENDP KiUserExceptionDispatcher@8 .ENDP
PUBLIC _KiIntSystemCall@0 PUBLIC _KiIntSystemCall@0
.PROC KiIntSystemCall@0 .PROC _KiIntSystemCall@0
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
/* Set stack in EDX and do the interrupt */ /* Set stack in EDX and do the interrupt */
@ -254,26 +254,26 @@ PUBLIC _KiIntSystemCall@0
/* Return to caller */ /* Return to caller */
ret ret
.ENDP KiIntSystemCall@0 .ENDP
PUBLIC _KiFastSystemCall@0 PUBLIC _KiFastSystemCall@0
.PROC KiFastSystemCall@0 .PROC _KiFastSystemCall@0
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
/* Put ESP in EDX and do the SYSENTER */ /* Put ESP in EDX and do the SYSENTER */
mov edx, esp mov edx, esp
sysenter sysenter
.ENDP KiFastSystemCall@0 .ENDP
PUBLIC _KiFastSystemCallRet@0 PUBLIC _KiFastSystemCallRet@0
.PROC KiFastSystemCallRet@0 .PROC _KiFastSystemCallRet@0
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
/* Just return to caller */ /* Just return to caller */
ret ret
.ENDP KiFastSystemCallRet@0 .ENDP
PUBLIC _RtlpGetStackLimits@8 PUBLIC _RtlpGetStackLimits@8
_RtlpGetStackLimits@8: _RtlpGetStackLimits@8:

View file

@ -15,7 +15,7 @@ EXTERN _BaseThreadStartup@8:PROC
.code .code
PUBLIC _BaseFiberStartup@0 PUBLIC _BaseFiberStartup@0
.PROC BaseFiberStartup@0 .PROC _BaseFiberStartup@0
/* Frame pointer is zeroed */ /* Frame pointer is zeroed */
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
@ -25,7 +25,7 @@ PUBLIC _BaseFiberStartup@0
push dword ptr [eax+FIBER_CONTEXT_EBX] /* Parameter */ push dword ptr [eax+FIBER_CONTEXT_EBX] /* Parameter */
push dword ptr [eax+FIBER_CONTEXT_EAX] /* Start Address */ push dword ptr [eax+FIBER_CONTEXT_EAX] /* Start Address */
call _BaseThreadStartup@8 call _BaseThreadStartup@8
.ENDP BaseFiberStartup@0 .ENDP
PUBLIC _SwitchToFiber@4 PUBLIC _SwitchToFiber@4
@ -135,6 +135,7 @@ NoFpuStateRestore:
/* Jump to new fiber */ /* Jump to new fiber */
mov esp, [ecx+FIBER_CONTEXT_ESP] mov esp, [ecx+FIBER_CONTEXT_ESP]
ret 4 ret 4
END
END
/* EOF */ /* EOF */

View file

@ -63,7 +63,7 @@ FUNC call_stubless_func
call ndr_client_call call ndr_client_call
add rsp, 38h add rsp, 38h
ret ret
ENDFUNC call_stubless_func ENDFUNC
PUBLIC call_server_func PUBLIC call_server_func
FUNC call_server_func FUNC call_server_func
@ -102,7 +102,7 @@ FUNC call_server_func
pop rsi pop rsi
pop rbp pop rbp
ret ret
ENDFUNC call_server_func ENDFUNC
PUBLIC NdrClientCall2 PUBLIC NdrClientCall2
@ -121,7 +121,7 @@ FUNC NdrClientCall2
add rsp, 28h add rsp, 28h
ret ret
ENDFUNC NdrClientCall2 ENDFUNC
EXTERN ndr_async_client_call:PROC EXTERN ndr_async_client_call:PROC
PUBLIC NdrAsyncClientCall PUBLIC NdrAsyncClientCall
@ -139,7 +139,7 @@ FUNC NdrAsyncClientCall
add rsp, 28h add rsp, 28h
ret ret
ENDFUNC NdrAsyncClientCall ENDFUNC
#endif #endif

View file

@ -100,7 +100,7 @@ CalibrationISR_Exit:
pop rbx pop rbx
pop rax pop rax
iretq iretq
ENDFUNC TscCalibrationISR ENDFUNC
#endif #endif
END END

View file

@ -32,21 +32,18 @@ rip = 0
/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */
.PROC MACRO name .PROC MACRO name
__current_function_name EQU %name
#ifdef _M_IX86 #ifdef _M_IX86
_&name PROC %name PROC
#else #else
&name PROC FRAME %name PROC FRAME
#endif #endif
ENDM ENDM
#define FUNC .PROC #define FUNC .PROC
/* ... and .ENDP, replacing ENDP */ /* ... and .ENDP, replacing ENDP */
.ENDP MACRO name .ENDP MACRO
#ifdef _M_IX86 %__current_function_name ENDP
_&name ENDP
#else
&name ENDP
#endif
ENDM ENDM
#define ENDFUNC .ENDP #define ENDFUNC .ENDP
@ -203,17 +200,17 @@ ENDM
.macro .PROC name .macro .PROC name
.func \name .func \name
#ifdef _X86_ #ifdef _X86_
/* x86 gas expects a label with _ prefix */
_\name: _\name:
#else
\name:
#endif #endif
\name:
.cfi_startproc .cfi_startproc
.equ cfa_current_offset, -8 .equ cfa_current_offset, -8
.endm .endm
#define FUNC .PROC #define FUNC .PROC
/* ... and .ENDP, replacing ENDP */ /* ... and .ENDP, replacing ENDP */
.macro .ENDP name .macro .ENDP
.cfi_endproc .cfi_endproc
.endfunc .endfunc
.endm .endm

View file

@ -77,10 +77,7 @@ MACRO(MAKE_LABEL, Name, Stackbytes)
ENDM ENDM
MACRO(START_PROC, Name, Stackbytes) MACRO(START_PROC, Name, Stackbytes)
PUBLIC _&Name&@&Stackbytes PUBLIC _&Name&@&Stackbytes
.PROC &Name&@&Stackbytes .PROC _&Name&@&Stackbytes
ENDM
MACRO(END_PROC, Name, Stackbytes)
.ENDP &Name&@&Stackbytes
ENDM ENDM
#else #else
MACRO(MAKE_LABEL, Name, Stackbytes) MACRO(MAKE_LABEL, Name, Stackbytes)
@ -91,9 +88,6 @@ MACRO(START_PROC, Name, Stackbytes)
PUBLIC &Name PUBLIC &Name
.PROC &Name .PROC &Name
ENDM ENDM
MACRO(END_PROC, Name, Stackbytes)
.ENDP &Name
ENDM
#endif #endif
MACRO(STUB_U, Name, ArgCount) MACRO(STUB_U, Name, ArgCount)
@ -101,7 +95,7 @@ MACRO(STUB_U, Name, ArgCount)
MAKE_LABEL Zw&Name, %Stackbytes MAKE_LABEL Zw&Name, %Stackbytes
START_PROC Nt&Name, %Stackbytes START_PROC Nt&Name, %Stackbytes
STUBCODE_U SyscallId, %Stackbytes STUBCODE_U SyscallId, %Stackbytes
END_PROC Nt&Name, %Stackbytes .ENDP
SyscallId = SyscallId + 1 SyscallId = SyscallId + 1
ENDM ENDM
@ -109,6 +103,6 @@ MACRO(STUB_K, Name, ArgCount)
Stackbytes = 4 * &ArgCount Stackbytes = 4 * &ArgCount
START_PROC Zw&Name, %Stackbytes START_PROC Zw&Name, %Stackbytes
STUBCODE_K SyscallId, %Stackbytes STUBCODE_K SyscallId, %Stackbytes
END_PROC Zw&Name, %Stackbytes .ENDP
SyscallId = SyscallId + 1 SyscallId = SyscallId + 1
ENDM ENDM

View file

@ -32,14 +32,20 @@ rip = 0
/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */
.PROC MACRO name .PROC MACRO name
name PROC FRAME __current_function_name EQU %name
_name: #ifdef _M_IX86
%name PROC
#else
%name PROC FRAME
#endif
ENDM ENDM
#define FUNC .PROC
/* ... and .ENDP, replacing ENDP */ /* ... and .ENDP, replacing ENDP */
.ENDP MACRO name .ENDP MACRO
name ENDP %__current_function_name ENDP
ENDM ENDM
#define ENDFUNC .ENDP
/* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx /* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx
and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */ and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */
@ -150,17 +156,17 @@ ENDM
.macro .PROC name .macro .PROC name
.func \name .func \name
#ifdef _X86_ #ifdef _X86_
/* x86 gas expects a label with _ prefix */
_\name: _\name:
#else
\name:
#endif #endif
\name:
.cfi_startproc .cfi_startproc
.equ cfa_current_offset, -8 .equ cfa_current_offset, -8
.endm .endm
#define FUNC .PROC #define FUNC .PROC
/* ... and .ENDP, replacing ENDP */ /* ... and .ENDP, replacing ENDP */
.macro .ENDP name .macro .ENDP
.cfi_endproc .cfi_endproc
.endfunc .endfunc
.endm .endm

View file

@ -22,31 +22,31 @@ PUBLIC _RtlpBreakWithStatusInstruction@0
.code .code
FUNC DbgBreakPointNoBugCheck@0 FUNC _DbgBreakPointNoBugCheck@0
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
int 3 int 3
ret ret
ENDFUNC DbgBreakPointNoBugCheck@0 ENDFUNC
_DbgUserBreakPoint@0: _DbgUserBreakPoint@0:
FUNC DbgBreakPoint@0 FUNC _DbgBreakPoint@0
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
int 3 int 3
ret ret
ENDFUNC DbgBreakPoint@0 ENDFUNC
FUNC DbgBreakPointWithStatus@4 FUNC _DbgBreakPointWithStatus@4
FPO 0, 1, 0, 0, 0, FRAME_FPO FPO 0, 1, 0, 0, 0, FRAME_FPO
mov eax, [esp+4] mov eax, [esp+4]
ENDFUNC DbgBreakPointWithStatus@4 ENDFUNC
FUNC RtlpBreakWithStatusInstruction@0 FUNC _RtlpBreakWithStatusInstruction@0
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
int 3 int 3
ret 4 ret 4
ENDFUNC RtlpBreakWithStatusInstruction@0 ENDFUNC
FUNC DebugService2@12 FUNC _DebugService2@12
FPO 0, 3, 3, 0, 1, FRAME_NONFPO FPO 0, 3, 3, 0, 1, FRAME_NONFPO
/* Setup the stack */ /* Setup the stack */
@ -63,9 +63,9 @@ FUNC DebugService2@12
/* Restore stack */ /* Restore stack */
pop ebp pop ebp
ret 12 ret 12
ENDFUNC DebugService2@12 ENDFUNC
FUNC DebugService@20 FUNC _DebugService@20
FPO 0, 5, 3, 0, 1, FRAME_NONFPO FPO 0, 5, 3, 0, 1, FRAME_NONFPO
/* Setup the stack */ /* Setup the stack */
@ -92,6 +92,6 @@ FUNC DebugService@20
/* Return */ /* Return */
pop ebp pop ebp
ret 20 ret 20
ENDFUNC DebugService@20 ENDFUNC
END END

View file

@ -16,28 +16,25 @@ PUBLIC @RtlUlonglongByteSwap@8
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
.code .code
@RtlUshortByteSwap@4: FUNC @RtlUshortByteSwap@4
FUNC RtlUshortByteSwap
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
/* Swap high and low bits */ /* Swap high and low bits */
mov ah, cl mov ah, cl
mov al, ch mov al, ch
ret ret
ENDFUNC RtlUshortByteSwap ENDFUNC
@RtlUlongByteSwap@4: FUNC @RtlUlongByteSwap@4
FUNC RtlUlongByteSwap
FPO 0, 0, 0, 0, 0, FRAME_FPO FPO 0, 0, 0, 0, 0, FRAME_FPO
/* Swap high and low bits */ /* Swap high and low bits */
mov eax, ecx mov eax, ecx
bswap eax bswap eax
ret ret
ENDFUNC RtlUlongByteSwap ENDFUNC
@RtlUlonglongByteSwap@8: FUNC @RtlUlonglongByteSwap@8
FUNC RtlUlonglongByteSwap
FPO 0, 2, 0, 0, 0, FRAME_FPO FPO 0, 2, 0, 0, 0, FRAME_FPO
/* Get 64-bit integer */ /* Get 64-bit integer */
@ -53,6 +50,6 @@ FUNC RtlUlonglongByteSwap
and therefore put on tthe stack instead of in ecx and edx, and therefore put on tthe stack instead of in ecx and edx,
but thats exactly how the function behaves on Windows! */ but thats exactly how the function behaves on Windows! */
ret ret
ENDFUNC RtlUlonglongByteSwap ENDFUNC
END END

View file

@ -7,7 +7,7 @@
PUBLIC _tcscpy PUBLIC _tcscpy
.code .code
FUNC tcscpy FUNC _tcscpy
FPO 0, 2, 2, 2, 0, FRAME_FPO FPO 0, 2, 2, 2, 0, FRAME_FPO
push esi push esi
push edi push edi
@ -27,7 +27,7 @@ FUNC tcscpy
pop edi pop edi
pop esi pop esi
ret ret
ENDFUNC tcscpy ENDFUNC
END END
/* EOF */ /* EOF */

View file

@ -219,7 +219,7 @@ ENDM
MACRO(TRAP_ENTRY, Trap, Flags) MACRO(TRAP_ENTRY, Trap, Flags)
EXTERN @&Trap&Handler@4 :PROC EXTERN @&Trap&Handler@4 :PROC
PUBLIC _&Trap PUBLIC _&Trap
.PROC &Trap .PROC _&Trap
/* Generate proper debugging symbols */ /* Generate proper debugging symbols */
FPO 0, 0, 0, 0, 1, FRAME_TRAP FPO 0, 0, 0, 0, 1, FRAME_TRAP
@ -228,7 +228,7 @@ MACRO(TRAP_ENTRY, Trap, Flags)
/* Call the C handler */ /* Call the C handler */
KiCallHandler @&Trap&Handler@4 KiCallHandler @&Trap&Handler@4
.ENDP &Trap .ENDP
ENDM ENDM
#define KI_RESTORE_EAX HEX(001) #define KI_RESTORE_EAX HEX(001)

View file

@ -136,19 +136,19 @@ _KiInterruptTemplateDispatch:
EXTERN @KiSystemServiceHandler@8:PROC EXTERN @KiSystemServiceHandler@8:PROC
PUBLIC _KiSystemService PUBLIC _KiSystemService
.PROC KiSystemService .PROC _KiSystemService
FPO 0, 0, 0, 0, 1, FRAME_TRAP FPO 0, 0, 0, 0, 1, FRAME_TRAP
KiEnterTrap (KI_PUSH_FAKE_ERROR_CODE OR KI_NONVOLATILES_ONLY OR KI_DONT_SAVE_SEGS) KiEnterTrap (KI_PUSH_FAKE_ERROR_CODE OR KI_NONVOLATILES_ONLY OR KI_DONT_SAVE_SEGS)
KiCallHandler @KiSystemServiceHandler@8 KiCallHandler @KiSystemServiceHandler@8
.ENDP KiSystemService .ENDP
EXTERN @KiFastCallEntryHandler@8:PROC EXTERN @KiFastCallEntryHandler@8:PROC
PUBLIC _KiFastCallEntry PUBLIC _KiFastCallEntry
.PROC KiFastCallEntry .PROC _KiFastCallEntry
FPO 0, 0, 0, 0, 1, FRAME_TRAP FPO 0, 0, 0, 0, 1, FRAME_TRAP
KiEnterTrap (KI_FAST_SYSTEM_CALL OR KI_NONVOLATILES_ONLY OR KI_DONT_SAVE_SEGS) KiEnterTrap (KI_FAST_SYSTEM_CALL OR KI_NONVOLATILES_ONLY OR KI_DONT_SAVE_SEGS)
KiCallHandler @KiFastCallEntryHandler@8 KiCallHandler @KiFastCallEntryHandler@8
.ENDP KiFastCallEntry .ENDP
PUBLIC _KiEndUnexpectedRange@0 PUBLIC _KiEndUnexpectedRange@0