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

View file

@ -15,7 +15,7 @@ EXTERN _BaseThreadStartup@8:PROC
.code
PUBLIC _BaseFiberStartup@0
.PROC BaseFiberStartup@0
.PROC _BaseFiberStartup@0
/* Frame pointer is zeroed */
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_EAX] /* Start Address */
call _BaseThreadStartup@8
.ENDP BaseFiberStartup@0
.ENDP
PUBLIC _SwitchToFiber@4
@ -135,6 +135,7 @@ NoFpuStateRestore:
/* Jump to new fiber */
mov esp, [ecx+FIBER_CONTEXT_ESP]
ret 4
END
END
/* EOF */

View file

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

View file

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

View file

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

View file

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

View file

@ -32,14 +32,20 @@ rip = 0
/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */
.PROC MACRO name
name PROC FRAME
_name:
__current_function_name EQU %name
#ifdef _M_IX86
%name PROC
#else
%name PROC FRAME
#endif
ENDM
#define FUNC .PROC
/* ... and .ENDP, replacing ENDP */
.ENDP MACRO name
name ENDP
.ENDP MACRO
%__current_function_name ENDP
ENDM
#define ENDFUNC .ENDP
/* 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 */
@ -150,17 +156,17 @@ ENDM
.macro .PROC name
.func \name
#ifdef _X86_
/* x86 gas expects a label with _ prefix */
_\name:
#else
\name:
#endif
\name:
.cfi_startproc
.equ cfa_current_offset, -8
.endm
#define FUNC .PROC
/* ... and .ENDP, replacing ENDP */
.macro .ENDP name
.macro .ENDP
.cfi_endproc
.endfunc
.endm

View file

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

View file

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

View file

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

View file

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

View file

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