public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Pete Batard <pete@akeo.ie>
To: edk2-devel@lists.01.org
Cc: liming.gao@intel.com, ard.biesheuvel@linaro.org
Subject: [PATCH v4 5/6] MdePkg/Include: Add VA list support for VS2017/ARM
Date: Wed, 10 Jan 2018 16:26:43 +0000	[thread overview]
Message-ID: <20180110162644.11208-6-pete@akeo.ie> (raw)
In-Reply-To: <20180110162644.11208-1-pete@akeo.ie>

VA_START, VA_END and VA_COPY are the same as the generic macros.
VA_ARG was reverse engineered from MS ARM assembly output.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
---
 MdePkg/Include/Base.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index 29db8a253e2f..7152ccda9764 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -660,6 +660,19 @@ struct _LIST_ENTRY {
 
 #define VA_COPY(Dest, Start)          __va_copy (Dest, Start)
 
+#elif defined(_M_ARM)
+//
+// MSFT ARM variable argument list support.
+// Same as the generic macros below, except for VA_ARG that needs extra adjustment.
+//
+
+typedef char* VA_LIST;
+
+#define VA_START(Marker, Parameter)     (Marker = (VA_LIST) ((UINTN) & (Parameter) + _INT_SIZE_OF(Parameter)))
+#define VA_ARG(Marker, TYPE)            (*(TYPE *) ((Marker += _INT_SIZE_OF(TYPE) + ((-(INTN)Marker) & (sizeof(TYPE) - 1))) - _INT_SIZE_OF (TYPE)))
+#define VA_END(Marker)                  (Marker = (VA_LIST) 0)
+#define VA_COPY(Dest, Start)            ((void)((Dest) = (Start)))
+
 #elif defined(__GNUC__)
 
 #if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)
-- 
2.9.3.windows.2



  parent reply	other threads:[~2018-01-10 16:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 16:26 [PATCH v4 0/6] Add ARM support for VS2017 Pete Batard
2018-01-10 16:26 ` [PATCH v4 1/6] MdePkg: Disable some Level 4 warnings for VS2017/ARM Pete Batard
2018-01-10 16:26 ` [PATCH v4 2/6] MdePkg/Library/BaseStackCheckLib: Add Null handler " Pete Batard
2018-01-10 16:26 ` [PATCH v4 3/6] MdePkg/Library/BaseLib: Enable VS2017/ARM builds Pete Batard
2018-01-10 16:26 ` [PATCH v4 4/6] ArmPkg/Library/CompilerIntrinsicsLib: " Pete Batard
2018-01-11 10:46   ` Ard Biesheuvel
2018-01-11 15:30     ` Cohen, Eugene
2018-01-11 16:31       ` Pete Batard
2018-01-11 16:56         ` Cohen, Eugene
2018-01-12  9:58           ` Ard Biesheuvel
2018-01-12 11:10             ` Pete Batard
2018-01-12 13:25               ` Ard Biesheuvel
2018-01-10 16:26 ` Pete Batard [this message]
2018-01-10 16:26 ` [PATCH v4 6/6] BaseTools/Conf: Add VS2017/ARM support Pete Batard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180110162644.11208-6-pete@akeo.ie \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox