From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=pete@akeo.ie; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0A18B21CB2E20 for ; Fri, 23 Feb 2018 01:44:16 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id z81so3496693wmb.4 for ; Fri, 23 Feb 2018 01:50:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uu8zG75hJgmAJAe1YFDwFs5FQ6aK9KasDGm5ayYy0j8=; b=RIfW32Kh/JA9pwXw8xAQOHUONliEA23eW9HXPE4Cd48deg8QAlhrbLEf1r1+ZJ4PCD sSQSbN9UNJo1DA0ybEIphhbp2T2vOLi55Dv83gD3jFMbATIhRp/oZ4zeK3MPEWiOWQnE o+vHfpcrHKs2NsONLrr7hQ6yoLoXx2SROCKTePPrxsboZN0HEprTEDGR5pdObQQYqyPW Rrx8nJ6f0qNuyEICaQn/6AdRaKi6biqof4P8qhPxHupscINd2eYpuKW7r6vj3wHy6t9U uNMrziaXEDwkb2PHfMJHz9AsitEmmEqnZutoyaRLl+2buyN0dziPtUu+2BCL6f8ib41p UF0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uu8zG75hJgmAJAe1YFDwFs5FQ6aK9KasDGm5ayYy0j8=; b=MGSQVZtzbRxqQgp+xkdmKBQxNzwXKD5OtATD+dauSDNmx2oaknr5mOe2GvBDrD4+2L 10j0MuNtaTEDErJR2igelty50BBFTi+W+YYg5lnbmQrWIfAH+zWNxQmx2uzzm8s4xXLZ sd/pFq8966204IT0lS0EeBWv+T8b2QYGKXzYW4onUITBYIWAt1dHpybeYPSZsYL0fznD TPQb2lJDUB08V67EqRlvBQDQ6bpUCqRIEHmlda6NKyE6eUuT74HdaQ+ad9yUOVqDdjKC qbI4j8vB6JRIt6jxh4Oy4t6Pg0uG6GmvSEojaCaei091TJ7ulNrD/rkYckeBwR7yGWFP K59A== X-Gm-Message-State: APf1xPAg42t1BONUz9h1hu2DB2gJo1+maO4V8OvSQUiHKzA0V6Aj7L2y 2bCOOWmHjFtVvYEzbavtNWXRp50bEMM= X-Google-Smtp-Source: AH8x227NuHD+UPB/N8MnqP9WVtI6n6NO8EoSZFKIRmbCSz4wOurzz8JdlDqITyQCOBvIKJOhLoQr8g== X-Received: by 10.80.224.139 with SMTP id f11mr2075227edl.50.1519379417072; Fri, 23 Feb 2018 01:50:17 -0800 (PST) Received: from localhost.localdomain ([84.203.54.151]) by smtp.gmail.com with ESMTPSA id z11sm1640521edh.94.2018.02.23.01.50.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Feb 2018 01:50:16 -0800 (PST) From: Pete Batard To: edk2-devel@lists.01.org Cc: liming.gao@intel.com, ard.biesheuvel@linaro.org Date: Fri, 23 Feb 2018 09:50:02 +0000 Message-Id: <20180223095003.6012-4-pete@akeo.ie> X-Mailer: git-send-email 2.9.3.windows.2 In-Reply-To: <20180223095003.6012-1-pete@akeo.ie> References: <20180223095003.6012-1-pete@akeo.ie> Subject: [PATCH 3/4] MdePkg/Include: Add VA list support for VS2017/ARM64 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Feb 2018 09:44:17 -0000 We need to explicitly call the built-in __va_start() for ARM64, otherwise the variable parameters are not properly enqueued for the next function calls. Also do the same for ARM, as as it doesn't harm us. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pete Batard --- MdePkg/Include/Base.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index a94182f08886..4f7bd4449c36 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -668,16 +668,15 @@ struct _LIST_ENTRY { #define VA_COPY(Dest, Start) __va_copy (Dest, Start) -#elif defined(_M_ARM) +#elif defined(_M_ARM) || defined(_M_ARM64) // // 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_START(Marker, Parameter) __va_start (&Marker, &Parameter, _INT_SIZE_OF (Parameter), __alignof(Parameter), &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))) -- 2.9.3.windows.2