From 459f389307f682ed28e2981d935819f83db87f6e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 30 Jan 2010 00:22:03 +0000 Subject: [PATCH] Update some asm macros, partly adding MASM/ML support svn path=/branches/ros-amd64-bringup/; revision=45328 --- reactos/include/reactos/asm.h | 47 +++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/reactos/include/reactos/asm.h b/reactos/include/reactos/asm.h index 8d8f48d1a74..3aef7f1b595 100644 --- a/reactos/include/reactos/asm.h +++ b/reactos/include/reactos/asm.h @@ -8,26 +8,54 @@ #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 .code64 -/* Macros for x64 stack unwind OPs */ +/* GAS needs explicit [rip] addressing */ +#define RIP(address) address##[rip] -.macro .proc name - .func name - .global _\name - _\name: +/* Due to MASM's reverse syntax, we are forced to use a precompiler macro */ +#define MACRO(name, ...) .MACRO name, __VA_ARGS__ + +/* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ +.macro .PROC name + .func \name + \name: .cfi_startproc .equ cfa_current_offset, -8 .endm -.macro .endproc +/* ... and .ENDP, replacing ENDP */ +.macro .ENDP .cfi_endproc .endfunc .endm +/* MASM compatible PUBLIC */ +#define PUBLIC .global + +/* Macros for x64 stack unwind OPs */ + .macro .allocstack size .cfi_adjust_cfa_offset \size .set cfa_current_offset, cfa_current_offset - \size @@ -83,4 +111,9 @@ .endm #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 -- 2.17.1