Author: ros-arm-bringup
Date: Sat Jan 2 02:28:36 2010
New Revision: 44868
URL:
http://svn.reactos.org/svn/reactos?rev=44868&view=rev
Log:
NMI Support Patch 8:
[NTOS]: Implement a GNU Assembler version of the Windows SDK ASM calling convention
macros. Only stdCall and its helpers have been written -- feel free to write the rest.
Based on callconv.inc from Microsoft). SUGGESTION: Slowly start rewriting current code to
use calling convention macros as it is much cleaner.
Added:
trunk/reactos/ntoskrnl/include/internal/i386/callconv.s (with props)
Added: trunk/reactos/ntoskrnl/include/internal/i386/callconv.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/i386/callconv.s (added)
+++ trunk/reactos/ntoskrnl/include/internal/i386/callconv.s [iso-8859-1] Sat Jan 2
02:28:36 2010
@@ -1,0 +1,100 @@
+/*
+ * PROJECT: ReactOS Source Development Kit (SDK)
+ * LICENSE: BSD - See COPYING.ARM in the top level directory
+ * FILE: include/ddk/api/callconv.s
+ * PURPOSE: x86 Calling Convention Helpers
+ * PROGRAMMERS: ReactOS Portable Systems Group
+ */
+
+/* INCLUDES *******************************************************************/
+
+//
+// @name CountArg
+//
+// This macro counts the number of arguments in the ArgList and returns
+// the value in cCount.
+//
+// @param cCount - Count of arguments
+// @param ArgList - Argument list
+//
+// @remark None.
+//
+.macro CountArg cCount:req,ArgList:vararg
+
+ cCount = 0
+
+ .irp arg, \ArgList
+ cCount = cCount+1
+ .endr
+
+.endm
+
+//
+// @name RevPush
+//
+// This macro pushes the arguments in ArgList in the reverse order
+// and returns the number of arguments in cCount
+//
+// @param cCount - Count of arguments
+// @param ArgList - Argument list
+//
+// @remark None.
+//
+.macro RevPush cCount:req,ArgList:vararg
+ LOCAL index, x
+
+ CountArg cCount, ArgList
+
+ index = cCount
+ .rept cCount
+ x = 0
+ .irp arg,ArgList
+ x=x+1
+ .ifeq index-x
+ push arg
+ .exitm
+ .endif
+ .endr
+
+ index = index-1
+ .endr
+.endm
+
+//
+// @name stdCallCall
+//
+// This macro performs a function call using the STDCALL convention and applies
+// the correct name decoration required based on the stack bytes
+//
+// @param Func - Function name
+// @param N - Number of stack bytes for arguments
+//
+// @remark None.
+//
+.macro stdCallCall Func:req,N:req
+ .ifdef __imp_&Func&@&N
+ call dword ptr [__imp_&Func&@&N]
+ .else
+ call Func&@&N
+ .endif
+.endm
+
+//
+// @name stdCall
+//
+// This macro pushes the arguments required for a function call using the
+// STDCALL convention and then issues the call
+//
+// @param Func - Function name
+// @param ArgList - Argument list
+//
+// @remark None.
+//
+.macro stdCall Func:req,ArgList:vararg
+ LOCAL Bytes
+
+ RevPush Bytes,ArgList
+ Bytes = Bytes*4
+
+ stdCallCall Func, %(Bytes)
+.endm
Propchange: trunk/reactos/ntoskrnl/include/internal/i386/callconv.s
------------------------------------------------------------------------------
svn:eol-style = native