From patchwork Thu Oct 17 00:05:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11194595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ACEFE17E6 for ; Thu, 17 Oct 2019 00:05:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A8EA218DE for ; Thu, 17 Oct 2019 00:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404535AbfJQAF5 (ORCPT ); Wed, 16 Oct 2019 20:05:57 -0400 Received: from mga03.intel.com ([134.134.136.65]:28763 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727859AbfJQAF5 (ORCPT ); Wed, 16 Oct 2019 20:05:57 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 17:05:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,305,1566889200"; d="scan'208";a="370965125" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.41]) by orsmga005.jf.intel.com with ESMTP; 16 Oct 2019 17:05:55 -0700 From: Sean Christopherson To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org, Cedric Xing Subject: [PATCH for_v23 v2 2/3] x86/vdso: sgx: Use an extra push to align the stack Date: Wed, 16 Oct 2019 17:05:53 -0700 Message-Id: <20191017000554.11927-3-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20191017000554.11927-1-sean.j.christopherson@intel.com> References: <20191017000554.11927-1-sean.j.christopherson@intel.com> MIME-Version: 1.0 Sender: linux-sgx-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org Use a "PUSH reg" instead of "SUB imm32, reg" to align the stack. The PUSH is a one-byte opcode, whereas the SUB is a four-byte opcode. Suggested-by: Cedric Xing Signed-off-by: Sean Christopherson --- arch/x86/entry/vdso/vsgx_enter_enclave.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/entry/vdso/vsgx_enter_enclave.S b/arch/x86/entry/vdso/vsgx_enter_enclave.S index e56737cc9f2c..d36043b99dc6 100644 --- a/arch/x86/entry/vdso/vsgx_enter_enclave.S +++ b/arch/x86/entry/vdso/vsgx_enter_enclave.S @@ -142,10 +142,10 @@ ENTRY(__vdso_sgx_enter_enclave) /* * Align stack per x86_64 ABI. Note, %rsp needs to be 16-byte aligned - * _after_ pushing the three parameters on the stack. + * _after_ pushing the parameters on the stack, hence the bonus push. */ and $-0x10, %rsp - sub $0x8, %rsp + push %rax /* Push @e, the "return" value and @tcs as params to the callback. */ push 0x18(%rbp)