Update some asm macros, partly adding MASM/ML support

svn path=/branches/ros-amd64-bringup/; revision=45328
This commit is contained in:
Timo Kreuzer 2010-01-30 00:22:03 +00:00
parent fde64b37c3
commit 459f389307

View file

@ -8,26 +8,54 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#else /* MASM/ML doesn't want explicit [rip] addressing */
#define RIP(address) address
/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */
#define MACRO(name, ...) name MACRO __VA_ARGS__
/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */
.PROC MACRO namex
namex PROC FRAME
ENDM
/* ... and .ENDP, replacing ENDP */
.ENDP MACRO name
name ENDP
ENDM
#else /***********************************************************************/
/* Force intel syntax */
.intel_syntax noprefix .intel_syntax noprefix
.code64 .code64
/* Macros for x64 stack unwind OPs */ /* GAS needs explicit [rip] addressing */
#define RIP(address) address##[rip]
.macro .proc name /* Due to MASM's reverse syntax, we are forced to use a precompiler macro */
.func name #define MACRO(name, ...) .MACRO name, __VA_ARGS__
.global _\name
_\name: /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */
.macro .PROC name
.func \name
\name:
.cfi_startproc .cfi_startproc
.equ cfa_current_offset, -8 .equ cfa_current_offset, -8
.endm .endm
.macro .endproc /* ... and .ENDP, replacing ENDP */
.macro .ENDP
.cfi_endproc .cfi_endproc
.endfunc .endfunc
.endm .endm
/* MASM compatible PUBLIC */
#define PUBLIC .global
/* Macros for x64 stack unwind OPs */
.macro .allocstack size .macro .allocstack size
.cfi_adjust_cfa_offset \size .cfi_adjust_cfa_offset \size
.set cfa_current_offset, cfa_current_offset - \size .set cfa_current_offset, cfa_current_offset - \size
@ -83,4 +111,9 @@
.endm .endm
#define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__, #define UNIMPLEMENTED UNIMPLEMENTED2 __FILE__, __LINE__,
/* MASM/ML uses ".if" for runtime conditionals, and "if" for compile time
conditionals. We therefore use "if", too. .if shouldn't be used at all */
#define if .if
#define endif .endif
#endif #endif